From: bangerth Date: Mon, 8 Dec 2008 02:49:00 +0000 (+0000) Subject: Import boost 1.37. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70cc73a6b8de24b3274ba339c1f972110dc94ddc;p=dealii-svn.git Import boost 1.37. git-svn-id: https://svn.dealii.org/trunk@17876 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/contrib/boost/include/boost-1.37.0/aligned_storage.hpp b/deal.II/contrib/boost/include/boost-1.37.0/aligned_storage.hpp new file mode 100644 index 0000000000..cfaf7877a1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/aligned_storage.hpp @@ -0,0 +1,170 @@ +//----------------------------------------------------------------------------- +// boost aligned_storage.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2002-2003 +// Eric Friedman, Itay Maman +// +// 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_ALIGNED_STORAGE_HPP +#define BOOST_ALIGNED_STORAGE_HPP + +#include // for std::size_t + +#include "boost/config.hpp" +#include "boost/detail/workaround.hpp" +#include "boost/type_traits/alignment_of.hpp" +#include "boost/type_traits/type_with_alignment.hpp" +#include "boost/type_traits/is_pod.hpp" + +#include "boost/mpl/eval_if.hpp" +#include "boost/mpl/identity.hpp" + +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { + +namespace detail { namespace aligned_storage { + +BOOST_STATIC_CONSTANT( + std::size_t + , alignment_of_max_align = ::boost::alignment_of::value + ); + +// +// To be TR1 conforming this must be a POD type: +// +template < + std::size_t size_ + , std::size_t alignment_ +> +struct aligned_storage_imp +{ + union data_t + { + char buf[size_]; + + typename mpl::eval_if_c< + alignment_ == std::size_t(-1) + , mpl::identity + , type_with_alignment + >::type align_; + } data_; +}; + +}} // namespace detail::aligned_storage + +template < + std::size_t size_ + , std::size_t alignment_ = std::size_t(-1) +> +class aligned_storage +{ +private: // representation + + detail::aligned_storage::aligned_storage_imp data_; + +public: // constants + + typedef detail::aligned_storage::aligned_storage_imp type; + + BOOST_STATIC_CONSTANT( + std::size_t + , size = size_ + ); + BOOST_STATIC_CONSTANT( + std::size_t + , alignment = ( + alignment_ == std::size_t(-1) + ? ::boost::detail::aligned_storage::alignment_of_max_align + : alignment_ + ) + ); + +#if defined(__GNUC__) &&\ + (__GNUC__ > 3) ||\ + (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 ||\ + (__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >=3))) + +private: // noncopyable + + aligned_storage(const aligned_storage&); + aligned_storage& operator=(const aligned_storage&); + +#else // gcc less than 3.2.3 + +public: // _should_ be noncopyable, but GCC compiler emits error + + aligned_storage(const aligned_storage&); + aligned_storage& operator=(const aligned_storage&); + +#endif // gcc < 3.2.3 workaround + +public: // structors + + aligned_storage() + { + } + + ~aligned_storage() + { + } + +public: // accessors + + void* address() + { + return this; + } + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + + const void* address() const + { + return this; + } + +#else // MSVC6 + + const void* address() const; + +#endif // MSVC6 workaround + +}; + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +// MSVC6 seems not to like inline functions with const void* returns, so we +// declare the following here: + +template +const void* aligned_storage::address() const +{ + return const_cast< aligned_storage* >(this)->address(); +} + +#endif // MSVC6 workaround + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +// +// Make sure that is_pod recognises aligned_storage<>::type +// as a POD (Note that aligned_storage<> itself is not a POD): +// +template +struct is_pod > + BOOST_TT_AUX_BOOL_C_BASE(true) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true) +}; +#endif + + +} // namespace boost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_ALIGNED_STORAGE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/any.hpp b/deal.II/contrib/boost/include/boost-1.37.0/any.hpp new file mode 100644 index 0000000000..483daca32e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/any.hpp @@ -0,0 +1,237 @@ +// See http://www.boost.org/libs/any for Documentation. + +#ifndef BOOST_ANY_INCLUDED +#define BOOST_ANY_INCLUDED + +// what: variant type boost::any +// who: contributed by Kevlin Henney, +// with features contributed and bugs found by +// Ed Brey, Mark Rodgers, Peter Dimov, and James Curran +// when: July 2001 +// where: tested with BCC 5.5, MSVC 6.0, and g++ 2.95 + +#include +#include + +#include "boost/config.hpp" +#include +#include +#include +#include + +namespace boost +{ + class any + { + public: // structors + + any() + : content(0) + { + } + + template + any(const ValueType & value) + : content(new holder(value)) + { + } + + any(const any & other) + : content(other.content ? other.content->clone() : 0) + { + } + + ~any() + { + delete content; + } + + public: // modifiers + + any & swap(any & rhs) + { + std::swap(content, rhs.content); + return *this; + } + + template + any & operator=(const ValueType & rhs) + { + any(rhs).swap(*this); + return *this; + } + + any & operator=(const any & rhs) + { + any(rhs).swap(*this); + return *this; + } + + public: // queries + + bool empty() const + { + return !content; + } + + const std::type_info & type() const + { + return content ? content->type() : typeid(void); + } + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + private: // types +#else + public: // types (public so any_cast can be non-friend) +#endif + + class placeholder + { + public: // structors + + virtual ~placeholder() + { + } + + public: // queries + + virtual const std::type_info & type() const = 0; + + virtual placeholder * clone() const = 0; + + }; + + template + class holder : public placeholder + { + public: // structors + + holder(const ValueType & value) + : held(value) + { + } + + public: // queries + + virtual const std::type_info & type() const + { + return typeid(ValueType); + } + + virtual placeholder * clone() const + { + return new holder(held); + } + + public: // representation + + ValueType held; + + private: // intentionally left unimplemented + holder & operator=(const holder &); + }; + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + + private: // representation + + template + friend ValueType * any_cast(any *); + + template + friend ValueType * unsafe_any_cast(any *); + +#else + + public: // representation (public so any_cast can be non-friend) + +#endif + + placeholder * content; + + }; + + class bad_any_cast : public std::bad_cast + { + public: + virtual const char * what() const throw() + { + return "boost::bad_any_cast: " + "failed conversion using boost::any_cast"; + } + }; + + template + ValueType * any_cast(any * operand) + { + return operand && operand->type() == typeid(ValueType) + ? &static_cast *>(operand->content)->held + : 0; + } + + template + inline const ValueType * any_cast(const any * operand) + { + return any_cast(const_cast(operand)); + } + + template + ValueType any_cast(any & operand) + { + typedef BOOST_DEDUCED_TYPENAME remove_reference::type nonref; + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // If 'nonref' is still reference type, it means the user has not + // specialized 'remove_reference'. + + // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro + // to generate specialization of remove_reference for your class + // See type traits library documentation for details + BOOST_STATIC_ASSERT(!is_reference::value); +#endif + + nonref * result = any_cast(&operand); + if(!result) + boost::throw_exception(bad_any_cast()); + return *result; + } + + template + inline ValueType any_cast(const any & operand) + { + typedef BOOST_DEDUCED_TYPENAME remove_reference::type nonref; + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // The comment in the above version of 'any_cast' explains when this + // assert is fired and what to do. + BOOST_STATIC_ASSERT(!is_reference::value); +#endif + + return any_cast(const_cast(operand)); + } + + // Note: The "unsafe" versions of any_cast are not part of the + // public interface and may be removed at any time. They are + // required where we know what type is stored in the any and can't + // use typeid() comparison, e.g., when our types may travel across + // different shared libraries. + template + inline ValueType * unsafe_any_cast(any * operand) + { + return &static_cast *>(operand->content)->held; + } + + template + inline const ValueType * unsafe_any_cast(const any * operand) + { + return unsafe_any_cast(const_cast(operand)); + } +} + +// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved. +// +// 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) + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/array.hpp b/deal.II/contrib/boost/include/boost-1.37.0/array.hpp new file mode 100644 index 0000000000..52218aac51 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/array.hpp @@ -0,0 +1,321 @@ +/* The following code declares class array, + * an STL container (as wrapper) for arrays of constant size. + * + * See + * http://www.boost.org/libs/array/ + * for documentation. + * + * The original author site is at: http://www.josuttis.com/ + * + * (C) Copyright Nicolai M. Josuttis 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) + * + * 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis) + * 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries. + * 05 Aug 2001 - minor update (Nico Josuttis) + * 20 Jan 2001 - STLport fix (Beman Dawes) + * 29 Sep 2000 - Initial Revision (Nico Josuttis) + * + * Jan 29, 2004 + */ +#ifndef BOOST_ARRAY_HPP +#define BOOST_ARRAY_HPP + +#include +#include +#include + +// Handles broken standard libraries better than +#include +#include +#include + +// FIXES for broken compilers +#include + + +namespace boost { + + template + class array { + public: + T elems[N]; // fixed-size array of elements of type T + + public: + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // iterator support + iterator begin() { return elems; } + const_iterator begin() const { return elems; } + iterator end() { return elems+N; } + const_iterator end() const { return elems+N; } + + // reverse iterator support +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) + // workaround for broken reverse_iterator in VC7 + typedef std::reverse_iterator > reverse_iterator; + typedef std::reverse_iterator > const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#endif + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + // operator[] + reference operator[](size_type i) + { + BOOST_ASSERT( i < N && "out of range" ); + return elems[i]; + } + + const_reference operator[](size_type i) const + { + BOOST_ASSERT( i < N && "out of range" ); + return elems[i]; + } + + // at() with range check + reference at(size_type i) { rangecheck(i); return elems[i]; } + const_reference at(size_type i) const { rangecheck(i); return elems[i]; } + + // front() and back() + reference front() + { + return elems[0]; + } + + const_reference front() const + { + return elems[0]; + } + + reference back() + { + return elems[N-1]; + } + + const_reference back() const + { + return elems[N-1]; + } + + // size is constant + static size_type size() { return N; } + static bool empty() { return false; } + static size_type max_size() { return N; } + enum { static_size = N }; + + // swap (note: linear complexity) + void swap (array& y) { + std::swap_ranges(begin(),end(),y.begin()); + } + + // direct access to data (read-only) + const T* data() const { return elems; } + T* data() { return elems; } + + // use array as C array (direct read/write access to data) + T* c_array() { return elems; } + + // assignment with type conversion + template + array& operator= (const array& rhs) { + std::copy(rhs.begin(),rhs.end(), begin()); + return *this; + } + + // assign one value to all elements + void assign (const T& value) + { + std::fill_n(begin(),size(),value); + } + + // check range (may be private because it is static) + static void rangecheck (size_type i) { + if (i >= size()) { + throw std::out_of_range("array<>: index out of range"); + } + } + + }; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + template< class T > + class array< T, 0 > { + + public: + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // iterator support + iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); } + const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); } + iterator end() { return begin(); } + const_iterator end() const { return begin(); } + + // reverse iterator support +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) + // workaround for broken reverse_iterator in VC7 + typedef std::reverse_iterator > reverse_iterator; + typedef std::reverse_iterator > const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#endif + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + // operator[] + reference operator[](size_type i) + { + return failed_rangecheck(); + } + + const_reference operator[](size_type i) const + { + return failed_rangecheck(); + } + + // at() with range check + reference at(size_type i) { return failed_rangecheck(); } + const_reference at(size_type i) const { return failed_rangecheck(); } + + // front() and back() + reference front() + { + return failed_rangecheck(); + } + + const_reference front() const + { + return failed_rangecheck(); + } + + reference back() + { + return failed_rangecheck(); + } + + const_reference back() const + { + return failed_rangecheck(); + } + + // size is constant + static size_type size() { return 0; } + static bool empty() { return true; } + static size_type max_size() { return 0; } + enum { static_size = 0 }; + + void swap (array& y) { + } + + // direct access to data (read-only) + const T* data() const { return 0; } + T* data() { return 0; } + + // use array as C array (direct read/write access to data) + T* c_array() { return 0; } + + // assignment with type conversion + template + array& operator= (const array& ) { + return *this; + } + + // assign one value to all elements + void assign (const T& ) { } + + // check range (may be private because it is static) + static reference failed_rangecheck () { + std::out_of_range e("attempt to access element of an empty array"); + boost::throw_exception(e); + // + // We need to return something here to keep + // some compilers happy: however we will never + // actually get here.... + // + static T placeholder; + return placeholder; + } + }; +#endif + + // comparisons + template + bool operator== (const array& x, const array& y) { + return std::equal(x.begin(), x.end(), y.begin()); + } + template + bool operator< (const array& x, const array& y) { + return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); + } + template + bool operator!= (const array& x, const array& y) { + return !(x==y); + } + template + bool operator> (const array& x, const array& y) { + return y + bool operator<= (const array& x, const array& y) { + return !(y + bool operator>= (const array& x, const array& y) { + return !(x + inline void swap (array& x, array& y) { + x.swap(y); + } + +} /* namespace boost */ + +#endif /*BOOST_ARRAY_HPP*/ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/asio.hpp b/deal.II/contrib/boost/include/boost-1.37.0/asio.hpp new file mode 100644 index 0000000000..5d8b43b299 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/asio.hpp @@ -0,0 +1,100 @@ +// +// asio.hpp +// ~~~~~~~~ +// +// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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 www.boost.org/libs/asio for documentation. +// + +#ifndef BOOST_ASIO_HPP +#define BOOST_ASIO_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_ASIO_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/assert.hpp b/deal.II/contrib/boost/include/boost-1.37.0/assert.hpp new file mode 100644 index 0000000000..c227f17b9e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/assert.hpp @@ -0,0 +1,50 @@ +// +// boost/assert.hpp - BOOST_ASSERT(expr) +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Note: There are no include guards. This is intentional. +// +// See http://www.boost.org/libs/utility/assert.html for documentation. +// + +#undef BOOST_ASSERT + +#if defined(BOOST_DISABLE_ASSERTS) + +# define BOOST_ASSERT(expr) ((void)0) + +#elif defined(BOOST_ENABLE_ASSERT_HANDLER) + +#include + +namespace boost +{ + +void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined + +} // namespace boost + +#define BOOST_ASSERT(expr) ((expr)? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) + +#else +# include // .h to support old libraries w/o - effect is the same +# define BOOST_ASSERT(expr) assert(expr) +#endif + +#undef BOOST_VERIFY + +#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) ) + +# define BOOST_VERIFY(expr) ((void)(expr)) + +#else + +# define BOOST_VERIFY(expr) BOOST_ASSERT(expr) + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/assign.hpp b/deal.II/contrib/boost/include/boost-1.37.0/assign.hpp new file mode 100644 index 0000000000..d74a56601c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/assign.hpp @@ -0,0 +1,24 @@ +// Boost.Assign library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/assign/ +// + + +#ifndef BOOST_ASSIGN_HPP +#define BOOST_ASSIGN_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bimap.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bimap.hpp new file mode 100644 index 0000000000..51d726dd32 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bimap.hpp @@ -0,0 +1,19 @@ +// Boost.Bimap +// +// Copyright (c) 2006-2007 Matias Capeletto +// +// 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 www.boost.org/libs/bimap for documentation. + +// Convenience header + +#include + +namespace boost +{ + using ::boost::bimaps::bimap; +} + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind.hpp new file mode 100644 index 0000000000..07b84d377a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind.hpp @@ -0,0 +1,1719 @@ +#ifndef BOOST_BIND_HPP_INCLUDED +#define BOOST_BIND_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind.hpp - binds function objects to arguments +// +// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2001 David Abrahams +// Copyright (c) 2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include +#include +#include +#include +#include +#include +#include + +// Borland-specific bug, visit_each() silently fails to produce code + +#if defined(__BORLANDC__) +# define BOOST_BIND_VISIT_EACH boost::visit_each +#else +# define BOOST_BIND_VISIT_EACH visit_each +#endif + +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +#endif + +namespace boost +{ + +namespace _bi // implementation details +{ + +// result_traits + +template struct result_traits +{ + typedef R type; +}; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +struct unspecified {}; + +template struct result_traits +{ + typedef typename F::result_type type; +}; + +template struct result_traits< unspecified, reference_wrapper > +{ + typedef typename F::result_type type; +}; + +#endif + +// ref_compare + +template bool ref_compare( T const & a, T const & b, long ) +{ + return a == b; +} + +template bool ref_compare( arg const &, arg const &, int ) +{ + return true; +} + +template bool ref_compare( arg (*) (), arg (*) (), int ) +{ + return true; +} + +template bool ref_compare( reference_wrapper const & a, reference_wrapper const & b, int ) +{ + return a.get_pointer() == b.get_pointer(); +} + +// bind_t forward declaration for listN + +template class bind_t; + +// value + +template class value +{ +public: + + value(T const & t): t_(t) {} + + T & get() { return t_; } + T const & get() const { return t_; } + + bool operator==(value const & rhs) const + { + return t_ == rhs.t_; + } + +private: + + T t_; +}; + +// type + +template class type {}; + +// unwrap + +template struct unwrapper +{ + static inline F & unwrap( F & f, long ) + { + return f; + } + + template static inline F2 & unwrap( reference_wrapper rf, int ) + { + return rf.get(); + } + + template static inline _mfi::dm unwrap( R T::* pm, int ) + { + return _mfi::dm( pm ); + } +}; + +// listN + +class list0 +{ +public: + + list0() {} + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A &, long) + { + return unwrapper::unwrap(f, 0)(); + } + + template R operator()(type, F const & f, A &, long) const + { + return unwrapper::unwrap(f, 0)(); + } + + template void operator()(type, F & f, A &, int) + { + unwrapper::unwrap(f, 0)(); + } + + template void operator()(type, F const & f, A &, int) const + { + unwrapper::unwrap(f, 0)(); + } + + template void accept(V &) const + { + } + + bool operator==(list0 const &) const + { + return true; + } +}; + +template< class A1 > class list1: private storage1< A1 > +{ +private: + + typedef storage1< A1 > base_type; + +public: + + explicit list1( A1 a1 ): base_type( a1 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list1 const & rhs) const + { + return ref_compare(base_type::a1_, rhs.a1_, 0); + } +}; + +struct logical_and; +struct logical_or; + +template< class A1, class A2 > class list2: private storage2< A1, A2 > +{ +private: + + typedef storage2< A1, A2 > base_type; + +public: + + list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template bool operator()( type, logical_and & /*f*/, A & a, int ) + { + return a[ base_type::a1_ ] && a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_and const & /*f*/, A & a, int ) const + { + return a[ base_type::a1_ ] && a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_or & /*f*/, A & a, int ) + { + return a[ base_type::a1_ ] || a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_or const & /*f*/, A & a, int ) const + { + return a[ base_type::a1_ ] || a[ base_type::a2_ ]; + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list2 const & rhs) const + { + return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0); + } +}; + +template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > +{ +private: + + typedef storage3< A1, A2, A3 > base_type; + +public: + + list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list3 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 > +{ +private: + + typedef storage4< A1, A2, A3, A4 > base_type; + +public: + + list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list4 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 > +{ +private: + + typedef storage5< A1, A2, A3, A4, A5 > base_type; + +public: + + list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list5 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ); + } +}; + +template class list6: private storage6< A1, A2, A3, A4, A5, A6 > +{ +private: + + typedef storage6< A1, A2, A3, A4, A5, A6 > base_type; + +public: + + list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list6 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ); + } +}; + +template class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 > +{ +private: + + typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type; + +public: + + list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list7 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ +private: + + typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type; + +public: + + list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list8 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ); + } +}; + +template class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > +{ +private: + + typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type; + +public: + + list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + A9 operator[] (boost::arg<9>) const { return base_type::a9_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } + A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list9 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ) && + ref_compare( base_type::a9_, rhs.a9_, 0 ); + } +}; + +// bind_t + +#ifndef BOOST_NO_VOID_RETURNS + +template class bind_t +{ +public: + + typedef bind_t this_type; + + bind_t(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN return +#include +#undef BOOST_BIND_RETURN + +}; + +#else + +template struct bind_t_generator +{ + +template class implementation +{ +public: + + typedef implementation this_type; + + implementation(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN return +#include +#undef BOOST_BIND_RETURN + +}; + +}; + +template<> struct bind_t_generator +{ + +template class implementation +{ +private: + + typedef void R; + +public: + + typedef implementation this_type; + + implementation(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN +#include +#undef BOOST_BIND_RETURN + +}; + +}; + +template class bind_t: public bind_t_generator::BOOST_NESTED_TEMPLATE implementation +{ +public: + + bind_t(F f, L const & l): bind_t_generator::BOOST_NESTED_TEMPLATE implementation(f, l) {} + +}; + +#endif + +// function_equal + +#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// put overloads in _bi, rely on ADL + +# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +template bool function_equal( bind_t const & a, bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( bind_t const & a, bind_t const & b, int ) +{ + return a.compare(b); +} + +# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// put overloads in boost + +} // namespace _bi + +# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +template bool function_equal( _bi::bind_t const & a, _bi::bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( _bi::bind_t const & a, _bi::bind_t const & b, int ) +{ + return a.compare(b); +} + +# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +namespace _bi +{ + +#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// add_value + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530) + +#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) ) + +template struct add_value +{ + typedef _bi::value type; +}; + +#else + +template< class T, int I > struct add_value_2 +{ + typedef boost::arg type; +}; + +template< class T > struct add_value_2< T, 0 > +{ + typedef _bi::value< T > type; +}; + +template struct add_value +{ + typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type; +}; + +#endif + +template struct add_value< value > +{ + typedef _bi::value type; +}; + +template struct add_value< reference_wrapper > +{ + typedef reference_wrapper type; +}; + +template struct add_value< arg > +{ + typedef boost::arg type; +}; + +template struct add_value< arg (*) () > +{ + typedef boost::arg (*type) (); +}; + +template struct add_value< bind_t > +{ + typedef bind_t type; +}; + +#else + +template struct _avt_0; + +template<> struct _avt_0<1> +{ + template struct inner + { + typedef T type; + }; +}; + +template<> struct _avt_0<2> +{ + template struct inner + { + typedef value type; + }; +}; + +typedef char (&_avt_r1) [1]; +typedef char (&_avt_r2) [2]; + +template _avt_r1 _avt_f(value); +template _avt_r1 _avt_f(reference_wrapper); +template _avt_r1 _avt_f(arg); +template _avt_r1 _avt_f(arg (*) ()); +template _avt_r1 _avt_f(bind_t); + +_avt_r2 _avt_f(...); + +template struct add_value +{ + static T t(); + typedef typename _avt_0::template inner::type type; +}; + +#endif + +// list_av_N + +template struct list_av_1 +{ + typedef typename add_value::type B1; + typedef list1 type; +}; + +template struct list_av_2 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef list2 type; +}; + +template struct list_av_3 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef list3 type; +}; + +template struct list_av_4 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef list4 type; +}; + +template struct list_av_5 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef list5 type; +}; + +template struct list_av_6 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef list6 type; +}; + +template struct list_av_7 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef list7 type; +}; + +template struct list_av_8 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef list8 type; +}; + +template struct list_av_9 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef typename add_value::type B9; + typedef list9 type; +}; + +// operator! + +struct logical_not +{ + template bool operator()(V const & v) const { return !v; } +}; + +template + bind_t< bool, logical_not, list1< bind_t > > + operator! (bind_t const & f) +{ + typedef list1< bind_t > list_type; + return bind_t ( logical_not(), list_type(f) ); +} + +// relational operators + +#define BOOST_BIND_OPERATOR( op, name ) \ +\ +struct name \ +{ \ + template bool operator()(V const & v, W const & w) const { return v op w; } \ +}; \ + \ +template \ + bind_t< bool, name, list2< bind_t, typename add_value::type > > \ + operator op (bind_t const & f, A2 a2) \ +{ \ + typedef typename add_value::type B2; \ + typedef list2< bind_t, B2> list_type; \ + return bind_t ( name(), list_type(f, a2) ); \ +} + +BOOST_BIND_OPERATOR( ==, equal ) +BOOST_BIND_OPERATOR( !=, not_equal ) + +BOOST_BIND_OPERATOR( <, less ) +BOOST_BIND_OPERATOR( <=, less_equal ) + +BOOST_BIND_OPERATOR( >, greater ) +BOOST_BIND_OPERATOR( >=, greater_equal ) + +BOOST_BIND_OPERATOR( &&, logical_and ) +BOOST_BIND_OPERATOR( ||, logical_or ) + +#undef BOOST_BIND_OPERATOR + +#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) + +// resolve ambiguity with rel_ops + +#define BOOST_BIND_OPERATOR( op, name ) \ +\ +template \ + bind_t< bool, name, list2< bind_t, bind_t > > \ + operator op (bind_t const & f, bind_t const & g) \ +{ \ + typedef list2< bind_t, bind_t > list_type; \ + return bind_t ( name(), list_type(f, g) ); \ +} + +BOOST_BIND_OPERATOR( !=, not_equal ) +BOOST_BIND_OPERATOR( <=, less_equal ) +BOOST_BIND_OPERATOR( >, greater ) +BOOST_BIND_OPERATOR( >=, greater_equal ) + +#endif + +// visit_each, ADL + +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \ + && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) + +template void visit_each( V & v, value const & t, int ) +{ + using boost::visit_each; + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); +} + +template void visit_each( V & v, bind_t const & t, int ) +{ + t.accept( v ); +} + +#endif + +} // namespace _bi + +// visit_each, no ADL + +#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \ + || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) + +template void visit_each( V & v, _bi::value const & t, int ) +{ + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); +} + +template void visit_each( V & v, _bi::bind_t const & t, int ) +{ + t.accept( v ); +} + +#endif + +// is_bind_expression + +template< class T > struct is_bind_expression +{ + enum _vt { value = 0 }; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > > +{ + enum _vt { value = 1 }; +}; + +#endif + +// bind + +#ifndef BOOST_BIND +#define BOOST_BIND bind +#endif + +// generic function objects + +template + _bi::bind_t + BOOST_BIND(F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +// generic function objects, alternative syntax + +template + _bi::bind_t + BOOST_BIND(boost::type, F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +// adaptable function objects + +template + _bi::bind_t<_bi::unspecified, F, _bi::list0> + BOOST_BIND(F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type()); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +// function pointers + +#define BOOST_BIND_CC +#define BOOST_BIND_ST + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST + +#ifdef BOOST_BIND_ENABLE_STDCALL + +#define BOOST_BIND_CC __stdcall +#define BOOST_BIND_ST + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST + +#endif + +#ifdef BOOST_BIND_ENABLE_FASTCALL + +#define BOOST_BIND_CC __fastcall +#define BOOST_BIND_ST + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST + +#endif + +#ifdef BOOST_BIND_ENABLE_PASCAL + +#define BOOST_BIND_ST pascal +#define BOOST_BIND_CC + +#include + +#undef BOOST_BIND_ST +#undef BOOST_BIND_CC + +#endif + +// member function pointers + +#define BOOST_BIND_MF_NAME(X) X +#define BOOST_BIND_MF_CC + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC + +#ifdef BOOST_MEM_FN_ENABLE_CDECL + +#define BOOST_BIND_MF_NAME(X) X##_cdecl +#define BOOST_BIND_MF_CC __cdecl + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_BIND_MF_NAME(X) X##_stdcall +#define BOOST_BIND_MF_CC __stdcall + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_BIND_MF_NAME(X) X##_fastcall +#define BOOST_BIND_MF_CC __fastcall + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC + +#endif + +// data member pointers + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) ) + +template +_bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > + BOOST_BIND(R T::*f, A1 a1) +{ + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t( F(f), list_type(a1) ); +} + +#else + +namespace _bi +{ + +template< class Pm, int I > struct add_cref; + +template< class M, class T > struct add_cref< M T::*, 0 > +{ + typedef M type; +}; + +template< class M, class T > struct add_cref< M T::*, 1 > +{ + typedef M const & type; +}; + +template< class R, class T > struct add_cref< R (T::*) (), 1 > +{ + typedef void type; +}; + +#if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) ) + +template< class R, class T > struct add_cref< R (T::*) () const, 1 > +{ + typedef void type; +}; + +#endif // __IBMCPP__ + +template struct isref +{ + enum value_type { value = 0 }; +}; + +template struct isref< R& > +{ + enum value_type { value = 1 }; +}; + +template struct isref< R* > +{ + enum value_type { value = 1 }; +}; + +template struct dm_result +{ + typedef typename add_cref< Pm, 1 >::type type; +}; + +template struct dm_result< Pm, bind_t > +{ + typedef typename bind_t::result_type result_type; + typedef typename add_cref< Pm, isref< result_type >::value >::type type; +}; + +} // namespace _bi + +template< class A1, class M, class T > + +_bi::bind_t< + typename _bi::dm_result< M T::*, A1 >::type, + _mfi::dm, + typename _bi::list_av_1::type +> + +BOOST_BIND( M T::*f, A1 a1 ) +{ + typedef typename _bi::dm_result< M T::*, A1 >::type result_type; + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); +} + +#endif + +} // namespace boost + +#ifndef BOOST_BIND_NO_PLACEHOLDERS + +# include + +#endif + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/apply.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/apply.hpp new file mode 100644 index 0000000000..6a43a89ac8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/apply.hpp @@ -0,0 +1,74 @@ +#ifndef BOOST_BIND_APPLY_HPP_INCLUDED +#define BOOST_BIND_APPLY_HPP_INCLUDED + +// +// apply.hpp +// +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// 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) +// + +namespace boost +{ + +template struct apply +{ + typedef R result_type; + + template result_type operator()(F & f) const + { + return f(); + } + + template result_type operator()(F & f, A1 & a1) const + { + return f(a1); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2) const + { + return f(a1, a2); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3) const + { + return f(a1, a2, a3); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4) const + { + return f(a1, a2, a3, a4); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const + { + return f(a1, a2, a3, a4, a5); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const + { + return f(a1, a2, a3, a4, a5, a6); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const + { + return f(a1, a2, a3, a4, a5, a6, a7); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const + { + return f(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const + { + return f(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +}; + +} // namespace boost + +#endif // #ifndef BOOST_BIND_APPLY_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/arg.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/arg.hpp new file mode 100644 index 0000000000..0d5cd03a74 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/arg.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_BIND_ARG_HPP_INCLUDED +#define BOOST_BIND_ARG_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/arg.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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/bind/bind.html for documentation. +// + +#include +#include + +namespace boost +{ + +template< int I > struct arg +{ + arg() + { + } + + template< class T > arg( T const & /* t */ ) + { + // static assert I == is_placeholder::value + typedef char T_must_be_placeholder[ I == is_placeholder::value? 1: -1 ]; + } +}; + +template< int I > bool operator==( arg const &, arg const & ) +{ + return true; +} + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< int I > struct is_placeholder< arg > +{ + enum _vt { value = I }; +}; + +template< int I > struct is_placeholder< arg (*) () > +{ + enum _vt { value = I }; +}; + +#endif + +} // namespace boost + +#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_cc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_cc.hpp new file mode 100644 index 0000000000..35f8eceb9e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_cc.hpp @@ -0,0 +1,117 @@ +// +// bind/bind_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// 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/bind/bind.html for documentation. +// + +template + _bi::bind_t + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) ()) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (); + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1), A1 a1) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1); + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2), A1 a1, A2 a2) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2); + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3), A1 a1, A2 a2, A3 a3) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3); + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4); + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5); + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6); + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7); + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8); + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8, B9), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8, B9); + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_mf2_cc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_mf2_cc.hpp new file mode 100644 index 0000000000..66476bc19d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_mf2_cc.hpp @@ -0,0 +1,228 @@ +// +// bind/bind_mf2_cc.hpp - member functions, type<> syntax +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +// 0 + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (), A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) () const, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +// 1 + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +// 2 + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2), A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2) const, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +// 3 + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3), A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +// 4 + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +// 5 + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +// 6 + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +// 7 + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +// 8 + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_mf_cc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_mf_cc.hpp new file mode 100644 index 0000000000..88be8222f3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_mf_cc.hpp @@ -0,0 +1,227 @@ +// +// bind/bind_mf_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// 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/bind/bind.html for documentation. +// + +// 0 + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (), A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +// 1 + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +// 2 + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2), A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +// 3 + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3), A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +// 4 + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +// 5 + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +// 6 + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +// 7 + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +// 8 + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_template.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_template.hpp new file mode 100644 index 0000000000..411d20c74e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/bind_template.hpp @@ -0,0 +1,345 @@ +// +// bind/bind_template.hpp +// +// Do not include this header directly. +// +// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. +// +// 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/bind/bind.html for documentation. +// + + typedef typename result_traits::type result_type; + + result_type operator()() + { + list0 a; + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + result_type operator()() const + { + list0 a; + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1) + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1) const + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1) + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1) const + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 const & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) const + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type eval(A & a) + { + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type eval(A & a) const + { + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template void accept(V & v) const + { +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) + + using boost::visit_each; + +#endif + BOOST_BIND_VISIT_EACH(v, f_, 0); + l_.accept(v); + } + + bool compare(this_type const & rhs) const + { + return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_; + } + +private: + + F f_; + L l_; diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/make_adaptable.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/make_adaptable.hpp new file mode 100644 index 0000000000..b9f083e307 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/make_adaptable.hpp @@ -0,0 +1,187 @@ +#ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED +#define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED + +// +// make_adaptable.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// + +namespace boost +{ + +namespace _bi +{ + +template class af0 +{ +public: + + typedef R result_type; + + explicit af0(F f): f_(f) + { + } + + result_type operator()() + { + return f_(); + } + + result_type operator()() const + { + return f_(); + } + +private: + + F f_; +}; + +template class af1 +{ +public: + + typedef R result_type; + typedef A1 argument_type; + typedef A1 arg1_type; + + explicit af1(F f): f_(f) + { + } + + result_type operator()(A1 a1) + { + return f_(a1); + } + + result_type operator()(A1 a1) const + { + return f_(a1); + } + +private: + + F f_; +}; + +template class af2 +{ +public: + + typedef R result_type; + typedef A1 first_argument_type; + typedef A2 second_argument_type; + typedef A1 arg1_type; + typedef A2 arg2_type; + + explicit af2(F f): f_(f) + { + } + + result_type operator()(A1 a1, A2 a2) + { + return f_(a1, a2); + } + + result_type operator()(A1 a1, A2 a2) const + { + return f_(a1, a2); + } + +private: + + F f_; +}; + +template class af3 +{ +public: + + typedef R result_type; + typedef A1 arg1_type; + typedef A2 arg2_type; + typedef A3 arg3_type; + + explicit af3(F f): f_(f) + { + } + + result_type operator()(A1 a1, A2 a2, A3 a3) + { + return f_(a1, a2, a3); + } + + result_type operator()(A1 a1, A2 a2, A3 a3) const + { + return f_(a1, a2, a3); + } + +private: + + F f_; +}; + +template class af4 +{ +public: + + typedef R result_type; + typedef A1 arg1_type; + typedef A2 arg2_type; + typedef A3 arg3_type; + typedef A4 arg4_type; + + explicit af4(F f): f_(f) + { + } + + result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) + { + return f_(a1, a2, a3, a4); + } + + result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const + { + return f_(a1, a2, a3, a4); + } + +private: + + F f_; +}; + +} // namespace _bi + +template _bi::af0 make_adaptable(F f) +{ + return _bi::af0(f); +} + +template _bi::af1 make_adaptable(F f) +{ + return _bi::af1(f); +} + +template _bi::af2 make_adaptable(F f) +{ + return _bi::af2(f); +} + +template _bi::af3 make_adaptable(F f) +{ + return _bi::af3(f); +} + +template _bi::af4 make_adaptable(F f) +{ + return _bi::af4(f); +} + +} // namespace boost + +#endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_cc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_cc.hpp new file mode 100644 index 0000000000..8b6ea0ba13 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_cc.hpp @@ -0,0 +1,103 @@ +// +// bind/mem_fn_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// 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/bind/mem_fn.html for documentation. +// + +template _mfi::BOOST_MEM_FN_NAME(mf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) ()) +{ + return _mfi::BOOST_MEM_FN_NAME(mf0)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) () const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf0)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf1)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf1)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf2)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf2)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf3)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf3)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf4)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf4)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf5)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf5)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf6)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf6)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf7)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf7)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf8)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf8)(f); +} diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_template.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_template.hpp new file mode 100644 index 0000000000..1db0713b77 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_template.hpp @@ -0,0 +1,1020 @@ +// +// bind/mem_fn_template.hpp +// +// Do not include this header directly +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// 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/bind/mem_fn.html for documentation. +// + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +# define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS +#endif + +// mf0 + +template class BOOST_MEM_FN_NAME(mf0) +{ +public: + + typedef R result_type; + typedef T * argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ()) + F f_; + + template R call(U & u, T const *) const + { + BOOST_MEM_FN_RETURN (u.*f_)(); + } + + template R call(U & u, void const *) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {} + + R operator()(T * p) const + { + BOOST_MEM_FN_RETURN (p->*f_)(); + } + + template R operator()(U & u) const + { + BOOST_MEM_FN_RETURN call(u, &u); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u) const + { + BOOST_MEM_FN_RETURN call(u, &u); + } + +#endif + + R operator()(T & t) const + { + BOOST_MEM_FN_RETURN (t.*f_)(); + } + + bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf0 + +template class BOOST_MEM_FN_NAME(cmf0) +{ +public: + + typedef R result_type; + typedef T const * argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const) + F f_; + + template R call(U & u, T const *) const + { + BOOST_MEM_FN_RETURN (u.*f_)(); + } + + template R call(U & u, void const *) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {} + + template R operator()(U const & u) const + { + BOOST_MEM_FN_RETURN call(u, &u); + } + + R operator()(T const & t) const + { + BOOST_MEM_FN_RETURN (t.*f_)(); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf1 + +template class BOOST_MEM_FN_NAME(mf1) +{ +public: + + typedef R result_type; + typedef T * first_argument_type; + typedef A1 second_argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1)) + F f_; + + template R call(U & u, T const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1); + } + + template R call(U & u, void const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {} + + R operator()(T * p, A1 a1) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1); + } + + template R operator()(U & u, A1 a1) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1); + } + +#endif + + R operator()(T & t, A1 a1) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1); + } + + bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf1 + +template class BOOST_MEM_FN_NAME(cmf1) +{ +public: + + typedef R result_type; + typedef T const * first_argument_type; + typedef A1 second_argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const) + F f_; + + template R call(U & u, T const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1); + } + + template R call(U & u, void const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1); + } + + R operator()(T const & t, A1 a1) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf2 + +template class BOOST_MEM_FN_NAME(mf2) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2); + } + + template R operator()(U & u, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); + } + + bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf2 + +template class BOOST_MEM_FN_NAME(cmf2) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2); + } + + R operator()(T const & t, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf3 + +template class BOOST_MEM_FN_NAME(mf3) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); + } + + bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf3 + +template class BOOST_MEM_FN_NAME(cmf3) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf4 + +template class BOOST_MEM_FN_NAME(mf4) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); + } + + bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf4 + +template class BOOST_MEM_FN_NAME(cmf4) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf5 + +template class BOOST_MEM_FN_NAME(mf5) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); + } + + bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf5 + +template class BOOST_MEM_FN_NAME(cmf5) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf6 + +template class BOOST_MEM_FN_NAME(mf6) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); + } + + bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf6 + +template class BOOST_MEM_FN_NAME(cmf6) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf7 + +template class BOOST_MEM_FN_NAME(mf7) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf7 + +template class BOOST_MEM_FN_NAME(cmf7) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf8 + +template class BOOST_MEM_FN_NAME(mf8) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf8 + +template class BOOST_MEM_FN_NAME(cmf8) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {} + + R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +#undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_vw.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_vw.hpp new file mode 100644 index 0000000000..f3fc58db04 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/mem_fn_vw.hpp @@ -0,0 +1,130 @@ +// +// bind/mem_fn_vw.hpp - void return helper wrappers +// +// Do not include this header directly +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// 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/bind/mem_fn.html for documentation. +// + +template struct BOOST_MEM_FN_NAME(mf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (); + explicit BOOST_MEM_FN_NAME(mf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0) +{ + typedef R (BOOST_MEM_FN_CC T::*F) () const; + explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1); + explicit BOOST_MEM_FN_NAME(mf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1) const; + explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2); + explicit BOOST_MEM_FN_NAME(mf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const; + explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3); + explicit BOOST_MEM_FN_NAME(mf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const; + explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4); + explicit BOOST_MEM_FN_NAME(mf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const; + explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5); + explicit BOOST_MEM_FN_NAME(mf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const; + explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6); + explicit BOOST_MEM_FN_NAME(mf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const; + explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7); + explicit BOOST_MEM_FN_NAME(mf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const; + explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8); + explicit BOOST_MEM_FN_NAME(mf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const; + explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)(f) {} +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/placeholders.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/placeholders.hpp new file mode 100644 index 0000000000..43baee6bde --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/placeholders.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED +#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/placeholders.hpp - _N definitions +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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/bind/bind.html for documentation. +// + +#include +#include + +namespace +{ + +#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ <= 400) + +static inline boost::arg<1> _1() { return boost::arg<1>(); } +static inline boost::arg<2> _2() { return boost::arg<2>(); } +static inline boost::arg<3> _3() { return boost::arg<3>(); } +static inline boost::arg<4> _4() { return boost::arg<4>(); } +static inline boost::arg<5> _5() { return boost::arg<5>(); } +static inline boost::arg<6> _6() { return boost::arg<6>(); } +static inline boost::arg<7> _7() { return boost::arg<7>(); } +static inline boost::arg<8> _8() { return boost::arg<8>(); } +static inline boost::arg<9> _9() { return boost::arg<9>(); } + +#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__) + +static boost::arg<1> _1; +static boost::arg<2> _2; +static boost::arg<3> _3; +static boost::arg<4> _4; +static boost::arg<5> _5; +static boost::arg<6> _6; +static boost::arg<7> _7; +static boost::arg<8> _8; +static boost::arg<9> _9; + +#else + +boost::arg<1> _1; +boost::arg<2> _2; +boost::arg<3> _3; +boost::arg<4> _4; +boost::arg<5> _5; +boost::arg<6> _6; +boost::arg<7> _7; +boost::arg<8> _8; +boost::arg<9> _9; + +#endif + +} // unnamed namespace + +#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/protect.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/protect.hpp new file mode 100644 index 0000000000..b1ff2a2a8e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/protect.hpp @@ -0,0 +1,144 @@ +#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED +#define BOOST_BIND_PROTECT_HPP_INCLUDED + +// +// protect.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// + +namespace boost +{ + +namespace _bi +{ + +template class protected_bind_t +{ +public: + + typedef typename F::result_type result_type; + + explicit protected_bind_t(F f): f_(f) + { + } + + result_type operator()() + { + return f_(); + } + + result_type operator()() const + { + return f_(); + } + + template result_type operator()(A1 & a1) + { + return f_(a1); + } + + template result_type operator()(A1 & a1) const + { + return f_(a1); + } + + template result_type operator()(A1 & a1, A2 & a2) + { + return f_(a1, a2); + } + + template result_type operator()(A1 & a1, A2 & a2) const + { + return f_(a1, a2); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) + { + return f_(a1, a2, a3); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) const + { + return f_(a1, a2, a3); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) + { + return f_(a1, a2, a3, a4); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const + { + return f_(a1, a2, a3, a4); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) + { + return f_(a1, a2, a3, a4, a5); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const + { + return f_(a1, a2, a3, a4, a5); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) + { + return f_(a1, a2, a3, a4, a5, a6); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const + { + return f_(a1, a2, a3, a4, a5, a6); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) + { + return f_(a1, a2, a3, a4, a5, a6, a7); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const + { + return f_(a1, a2, a3, a4, a5, a6, a7); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + +private: + + F f_; +}; + +} // namespace _bi + +template _bi::protected_bind_t protect(F f) +{ + return _bi::protected_bind_t(f); +} + +} // namespace boost + +#endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/bind/storage.hpp b/deal.II/contrib/boost/include/boost-1.37.0/bind/storage.hpp new file mode 100644 index 0000000000..be490b0f59 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/bind/storage.hpp @@ -0,0 +1,475 @@ +#ifndef BOOST_BIND_STORAGE_HPP_INCLUDED +#define BOOST_BIND_STORAGE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/storage.hpp +// +// boost/bind.hpp support header, optimized storage +// +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +#endif + +namespace boost +{ + +namespace _bi +{ + +// 1 + +template struct storage1 +{ + explicit storage1( A1 a1 ): a1_( a1 ) {} + + template void accept(V & v) const + { + BOOST_BIND_VISIT_EACH(v, a1_, 0); + } + + A1 a1_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( __BORLANDC__ ) + +template struct storage1< boost::arg > +{ + explicit storage1( boost::arg ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +template struct storage1< boost::arg (*) () > +{ + explicit storage1( boost::arg (*) () ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +#endif + +// 2 + +template struct storage2: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, A2 a2 ): storage1( a1 ), a2_( a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a2_, 0); + } + + A2 a2_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage2< A1, boost::arg >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +template struct storage2< A1, boost::arg (*) () >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg (*) () ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +#endif + +// 3 + +template struct storage3: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, A3 a3 ): storage2( a1, a2 ), a3_( a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a3_, 0); + } + + A3 a3_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage3< A1, A2, boost::arg >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +template struct storage3< A1, A2, boost::arg (*) () >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg (*) () ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +#endif + +// 4 + +template struct storage4: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, A4 a4 ): storage3( a1, a2, a3 ), a4_( a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a4_, 0); + } + + A4 a4_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage4< A1, A2, A3, boost::arg >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +template struct storage4< A1, A2, A3, boost::arg (*) () >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg (*) () ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +#endif + +// 5 + +template struct storage5: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): storage4( a1, a2, a3, a4 ), a5_( a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a5_, 0); + } + + A5 a5_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage5< A1, A2, A3, A4, boost::arg >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +template struct storage5< A1, A2, A3, A4, boost::arg (*) () >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg (*) () ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +#endif + +// 6 + +template struct storage6: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): storage5( a1, a2, a3, a4, a5 ), a6_( a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a6_, 0); + } + + A6 a6_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage6< A1, A2, A3, A4, A5, boost::arg >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +template struct storage6< A1, A2, A3, A4, A5, boost::arg (*) () >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg (*) () ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +#endif + +// 7 + +template struct storage7: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): storage6( a1, a2, a3, a4, a5, a6 ), a7_( a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a7_, 0); + } + + A7 a7_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg (*) () >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg (*) () ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +#endif + +// 8 + +template struct storage8: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): storage7( a1, a2, a3, a4, a5, a6, a7 ), a8_( a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a8_, 0); + } + + A8 a8_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg (*) () >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg (*) () ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +#endif + +// 9 + +template struct storage9: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ), a9_( a9 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a9_, 0); + } + + A9 a9_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg (*) () >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg (*) () ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +#endif + +} // namespace _bi + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_STORAGE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/blank.hpp b/deal.II/contrib/boost/include/boost-1.37.0/blank.hpp new file mode 100644 index 0000000000..f84f2d9ea0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/blank.hpp @@ -0,0 +1,100 @@ +//----------------------------------------------------------------------------- +// boost blank.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2003 +// Eric Friedman +// +// 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_BLANK_HPP +#define BOOST_BLANK_HPP + +#include "boost/blank_fwd.hpp" + +#include // for std::basic_ostream forward declare + +#include "boost/detail/templated_streams.hpp" +#include "boost/mpl/bool.hpp" +#include "boost/type_traits/is_empty.hpp" +#include "boost/type_traits/is_pod.hpp" +#include "boost/type_traits/is_stateless.hpp" + +namespace boost { + +struct blank +{ +}; + +// type traits specializations +// + +template <> +struct is_pod< blank > + : mpl::true_ +{ +}; + +template <> +struct is_empty< blank > + : mpl::true_ +{ +}; + +template <> +struct is_stateless< blank > + : mpl::true_ +{ +}; + +// relational operators +// + +inline bool operator==(const blank&, const blank&) +{ + return true; +} + +inline bool operator<=(const blank&, const blank&) +{ + return true; +} + +inline bool operator>=(const blank&, const blank&) +{ + return true; +} + +inline bool operator!=(const blank&, const blank&) +{ + return false; +} + +inline bool operator<(const blank&, const blank&) +{ + return false; +} + +inline bool operator>(const blank&, const blank&) +{ + return false; +} + +// streaming support +// +BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) +inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<( + BOOST_TEMPLATED_STREAM(ostream, E,T)& out + , const blank& + ) +{ + // (output nothing) + return out; +} + +} // namespace boost + +#endif // BOOST_BLANK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/blank_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/blank_fwd.hpp new file mode 100644 index 0000000000..8bfe97c469 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/blank_fwd.hpp @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------------- +// boost blank_fwd.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2003 +// Eric Friedman +// +// 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_BLANK_FWD_HPP +#define BOOST_BLANK_FWD_HPP + +namespace boost { + +struct blank; + +} // namespace boost + +#endif // BOOST_BLANK_FWD_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/call_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/call_traits.hpp new file mode 100644 index 0000000000..5253a6de58 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/call_traits.hpp @@ -0,0 +1,24 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// 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/utility for most recent version including documentation. + +// See boost/detail/call_traits.hpp and boost/detail/ob_call_traits.hpp +// for full copyright notices. + +#ifndef BOOST_CALL_TRAITS_HPP +#define BOOST_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else +#include +#endif + +#endif // BOOST_CALL_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/cast.hpp b/deal.II/contrib/boost/include/boost-1.37.0/cast.hpp new file mode 100644 index 0000000000..2615d183fa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/cast.hpp @@ -0,0 +1,107 @@ +// boost cast.hpp header file ----------------------------------------------// + +// (C) Copyright Kevlin Henney and Dave Abrahams 1999. +// 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/conversion for Documentation. + +// Revision History +// 23 JUn 05 numeric_cast removed and redirected to the new verion (Fernando Cacciola) +// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included +// instead (the workaround did not +// actually compile when BOOST_NO_LIMITS was defined in +// any case, so we loose nothing). (John Maddock) +// 21 Jan 01 Undid a bug I introduced yesterday. numeric_cast<> never +// worked with stock GCC; trying to get it to do that broke +// vc-stlport. +// 20 Jan 01 Moved BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS to config.hpp. +// Removed unused BOOST_EXPLICIT_TARGET macro. Moved +// boost::detail::type to boost/type.hpp. Made it compile with +// stock gcc again (Dave Abrahams) +// 29 Nov 00 Remove nested namespace cast, cleanup spacing before Formal +// Review (Beman Dawes) +// 19 Oct 00 Fix numeric_cast for floating-point types (Dave Abrahams) +// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC +// (Dave Abrahams) +// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams) +// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes) +// 27 Jun 00 More MSVC6 workarounds +// 15 Jun 00 Add workarounds for MSVC6 +// 2 Feb 00 Remove bad_numeric_cast ";" syntax error (Doncho Angelov) +// 26 Jan 00 Add missing throw() to bad_numeric_cast::what(0 (Adam Levar) +// 29 Dec 99 Change using declarations so usages in other namespaces work +// correctly (Dave Abrahams) +// 23 Sep 99 Change polymorphic_downcast assert to also detect M.I. errors +// as suggested Darin Adler and improved by Valentin Bonnard. +// 2 Sep 99 Remove controversial asserts, simplify, rename. +// 30 Aug 99 Move to cast.hpp, replace value_cast with numeric_cast, +// place in nested namespace. +// 3 Aug 99 Initial version + +#ifndef BOOST_CAST_HPP +#define BOOST_CAST_HPP + +# include +# include +# include +# include +# include +# include + +// It has been demonstrated numerous times that MSVC 6.0 fails silently at link +// time if you use a template function which has template parameters that don't +// appear in the function's argument list. +// +// TODO: Add this to config.hpp? +# if defined(BOOST_MSVC) && BOOST_MSVC < 1300 +# define BOOST_EXPLICIT_DEFAULT_TARGET , ::boost::type* = 0 +# else +# define BOOST_EXPLICIT_DEFAULT_TARGET +# endif + +namespace boost +{ +// See the documentation for descriptions of how to choose between +// static_cast<>, dynamic_cast<>, polymorphic_cast<> and polymorphic_downcast<> + +// polymorphic_cast --------------------------------------------------------// + + // Runtime checked polymorphic downcasts and crosscasts. + // Suggested in The C++ Programming Language, 3rd Ed, Bjarne Stroustrup, + // section 15.8 exercise 1, page 425. + + template + inline Target polymorphic_cast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET) + { + Target tmp = dynamic_cast(x); + if ( tmp == 0 ) throw std::bad_cast(); + return tmp; + } + +// polymorphic_downcast ----------------------------------------------------// + + // BOOST_ASSERT() checked polymorphic downcast. Crosscasts prohibited. + + // WARNING: Because this cast uses BOOST_ASSERT(), it violates + // the One Definition Rule if used in multiple translation units + // where BOOST_DISABLE_ASSERTS, BOOST_ENABLE_ASSERT_HANDLER + // NDEBUG are defined inconsistently. + + // Contributed by Dave Abrahams + + template + inline Target polymorphic_downcast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET) + { + BOOST_ASSERT( dynamic_cast(x) == x ); // detect logic error + return static_cast(x); + } + +# undef BOOST_EXPLICIT_DEFAULT_TARGET + +} // namespace boost + +# include + +#endif // BOOST_CAST_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/cerrno.hpp b/deal.II/contrib/boost/include/boost-1.37.0/cerrno.hpp new file mode 100644 index 0000000000..6f2669846d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/cerrno.hpp @@ -0,0 +1,331 @@ +// Boost cerrno.hpp header -------------------------------------------------// + +// Copyright Beman Dawes 2005. +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/system + +#ifndef BOOST_CERRNO_HPP +#define BOOST_CERRNO_HPP + +#include + +// supply errno values likely to be missing, particularly on Windows + +#ifndef EAFNOSUPPORT +#define EAFNOSUPPORT 9901 +#endif + +#ifndef EADDRINUSE +#define EADDRINUSE 9902 +#endif + +#ifndef EADDRNOTAVAIL +#define EADDRNOTAVAIL 9903 +#endif + +#ifndef EISCONN +#define EISCONN 9904 +#endif + +#ifndef EBADMSG +#define EBADMSG 9905 +#endif + +#ifndef ECONNABORTED +#define ECONNABORTED 9906 +#endif + +#ifndef EALREADY +#define EALREADY 9907 +#endif + +#ifndef ECONNREFUSED +#define ECONNREFUSED 9908 +#endif + +#ifndef ECONNRESET +#define ECONNRESET 9909 +#endif + +#ifndef EDESTADDRREQ +#define EDESTADDRREQ 9910 +#endif + +#ifndef EHOSTUNREACH +#define EHOSTUNREACH 9911 +#endif + +#ifndef EIDRM +#define EIDRM 9912 +#endif + +#ifndef EMSGSIZE +#define EMSGSIZE 9913 +#endif + +#ifndef ENETDOWN +#define ENETDOWN 9914 +#endif + +#ifndef ENETRESET +#define ENETRESET 9915 +#endif + +#ifndef ENETUNREACH +#define ENETUNREACH 9916 +#endif + +#ifndef ENOBUFS +#define ENOBUFS 9917 +#endif + +#ifndef ENOLINK +#define ENOLINK 9918 +#endif + +#ifndef ENODATA +#define ENODATA 9919 +#endif + +#ifndef ENOMSG +#define ENOMSG 9920 +#endif + +#ifndef ENOPROTOOPT +#define ENOPROTOOPT 9921 +#endif + +#ifndef ENOSR +#define ENOSR 9922 +#endif + +#ifndef ENOTSOCK +#define ENOTSOCK 9923 +#endif + +#ifndef ENOSTR +#define ENOSTR 9924 +#endif + +#ifndef ENOTCONN +#define ENOTCONN 9925 +#endif + +#ifndef ENOTSUP +#define ENOTSUP 9926 +#endif + +#ifndef ECANCELED +#define ECANCELED 9927 +#endif + +#ifndef EINPROGRESS +#define EINPROGRESS 9928 +#endif + +#ifndef EOPNOTSUPP +#define EOPNOTSUPP 9929 +#endif + +#ifndef EWOULDBLOCK +#define EWOULDBLOCK 9930 +#endif + +#ifndef EOWNERDEAD +#define EOWNERDEAD 9931 +#endif + +#ifndef EPROTO +#define EPROTO 9932 +#endif + +#ifndef EPROTONOSUPPORT +#define EPROTONOSUPPORT 9933 +#endif + +#ifndef ENOTRECOVERABLE +#define ENOTRECOVERABLE 9934 +#endif + +#ifndef ETIME +#define ETIME 9935 +#endif + +#ifndef ETXTBSY +#define ETXTBSY 9936 +#endif + +#ifndef ETIMEDOUT +#define ETIMEDOUT 9938 +#endif + +#ifndef ELOOP +#define ELOOP 9939 +#endif + +#ifndef EOVERFLOW +#define EOVERFLOW 9940 +#endif + +#ifndef EPROTOTYPE +#define EPROTOTYPE 9941 +#endif + +#ifndef ENOSYS +#define ENOSYS 9942 +#endif + +#ifndef EINVAL +#define EINVAL 9943 +#endif + +#ifndef ERANGE +#define ERANGE 9944 +#endif + +#ifndef EILSEQ +#define EILSEQ 9945 +#endif + +// Windows Mobile doesn't appear to define these: + +#ifndef E2BIG +#define E2BIG 9946 +#endif + +#ifndef EDOM +#define EDOM 9947 +#endif + +#ifndef EFAULT +#define EFAULT 9948 +#endif + +#ifndef EBADF +#define EBADF 9949 +#endif + +#ifndef EPIPE +#define EPIPE 9950 +#endif + +#ifndef EXDEV +#define EXDEV 9951 +#endif + +#ifndef EBUSY +#define EBUSY 9952 +#endif + +#ifndef ENOTEMPTY +#define ENOTEMPTY 9953 +#endif + +#ifndef ENOEXEC +#define ENOEXEC 9954 +#endif + +#ifndef EEXIST +#define EEXIST 9955 +#endif + +#ifndef EFBIG +#define EFBIG 9956 +#endif + +#ifndef ENAMETOOLONG +#define ENAMETOOLONG 9957 +#endif + +#ifndef ENOTTY +#define ENOTTY 9958 +#endif + +#ifndef EINTR +#define EINTR 9959 +#endif + +#ifndef ESPIPE +#define ESPIPE 9960 +#endif + +#ifndef EIO +#define EIO 9961 +#endif + +#ifndef EISDIR +#define EISDIR 9962 +#endif + +#ifndef ECHILD +#define ECHILD 9963 +#endif + +#ifndef ENOLCK +#define ENOLCK 9964 +#endif + +#ifndef ENOSPC +#define ENOSPC 9965 +#endif + +#ifndef ENXIO +#define ENXIO 9966 +#endif + +#ifndef ENODEV +#define ENODEV 9967 +#endif + +#ifndef ENOENT +#define ENOENT 9968 +#endif + +#ifndef ESRCH +#define ESRCH 9969 +#endif + +#ifndef ENOTDIR +#define ENOTDIR 9970 +#endif + +#ifndef ENOMEM +#define ENOMEM 9971 +#endif + +#ifndef EPERM +#define EPERM 9972 +#endif + +#ifndef EACCES +#define EACCES 9973 +#endif + +#ifndef EROFS +#define EROFS 9974 +#endif + +#ifndef EDEADLK +#define EDEADLK 9975 +#endif + +#ifndef EAGAIN +#define EAGAIN 9976 +#endif + +#ifndef ENFILE +#define ENFILE 9977 +#endif + +#ifndef EMFILE +#define EMFILE 9978 +#endif + +#ifndef EMLINK +#define EMLINK 9979 +#endif + +#endif // include guard diff --git a/deal.II/contrib/boost/include/boost-1.37.0/checked_delete.hpp b/deal.II/contrib/boost/include/boost-1.37.0/checked_delete.hpp new file mode 100644 index 0000000000..9bb84e8e1b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/checked_delete.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED +#define BOOST_CHECKED_DELETE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/checked_delete.hpp +// +// Copyright (c) 2002, 2003 Peter Dimov +// Copyright (c) 2003 Daniel Frey +// Copyright (c) 2003 Howard Hinnant +// +// 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/utility/checked_delete.html for documentation. +// + +namespace boost +{ + +// verify that types are complete for increased safety + +template inline void checked_delete(T * x) +{ + // intentionally complex - simplification causes regressions + typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; + (void) sizeof(type_must_be_complete); + delete x; +} + +template inline void checked_array_delete(T * x) +{ + typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; + (void) sizeof(type_must_be_complete); + delete [] x; +} + +template struct checked_deleter +{ + typedef void result_type; + typedef T * argument_type; + + void operator()(T * x) const + { + // boost:: disables ADL + boost::checked_delete(x); + } +}; + +template struct checked_array_deleter +{ + typedef void result_type; + typedef T * argument_type; + + void operator()(T * x) const + { + boost::checked_array_delete(x); + } +}; + +} // namespace boost + +#endif // #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/circular_buffer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/circular_buffer.hpp new file mode 100644 index 0000000000..13cc94fef7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/circular_buffer.hpp @@ -0,0 +1,74 @@ +// Circular buffer library header file. + +// Copyright (c) 2003-2008 Jan Gaspar + +// 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 www.boost.org/libs/circular_buffer for documentation. + +#if !defined(BOOST_CIRCULAR_BUFFER_HPP) +#define BOOST_CIRCULAR_BUFFER_HPP + +#if defined(_MSC_VER) && _MSC_VER >= 1200 + #pragma once +#endif + +#include +#include + +// BOOST_CB_ENABLE_DEBUG: Debug support control. +#if defined(NDEBUG) || defined(BOOST_CB_DISABLE_DEBUG) + #define BOOST_CB_ENABLE_DEBUG 0 +#else + #define BOOST_CB_ENABLE_DEBUG 1 +#endif + +// BOOST_CB_ASSERT: Runtime assertion. +#if BOOST_CB_ENABLE_DEBUG + #include + #define BOOST_CB_ASSERT(Expr) BOOST_ASSERT(Expr) +#else + #define BOOST_CB_ASSERT(Expr) ((void)0) +#endif + +// BOOST_CB_STATIC_ASSERT: Compile time assertion. +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + #define BOOST_CB_STATIC_ASSERT(Expr) ((void)0) +#else + #include + #define BOOST_CB_STATIC_ASSERT(Expr) BOOST_STATIC_ASSERT(Expr) +#endif + +// BOOST_CB_IS_CONVERTIBLE: Check if Iterator::value_type is convertible to Type. +#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) || \ + BOOST_WORKAROUND(BOOST_MSVC, < 1300) + #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0) +#else + #include + #include + #define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \ + BOOST_CB_STATIC_ASSERT((is_convertible::value_type, Type>::value)) +#endif + +// BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS: +// Check if the STL provides templated iterator constructors for its containers. +#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_CB_STATIC_ASSERT(false); +#else + #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0); +#endif + +#include +#include +#include +#include + +#undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS +#undef BOOST_CB_IS_CONVERTIBLE +#undef BOOST_CB_STATIC_ASSERT +#undef BOOST_CB_ASSERT +#undef BOOST_CB_ENABLE_DEBUG + +#endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP) diff --git a/deal.II/contrib/boost/include/boost-1.37.0/circular_buffer_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/circular_buffer_fwd.hpp new file mode 100644 index 0000000000..6fdb43e037 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/circular_buffer_fwd.hpp @@ -0,0 +1,43 @@ +// Forward declaration of the circular buffer and its adaptor. + +// Copyright (c) 2003-2008 Jan Gaspar + +// 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 www.boost.org/libs/circular_buffer for documentation. + +#if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP) +#define BOOST_CIRCULAR_BUFFER_FWD_HPP + +#if defined(_MSC_VER) && _MSC_VER >= 1200 + #pragma once +#endif + +#include +#if !defined(BOOST_NO_STD_ALLOCATOR) + #include +#else + #include +#endif + +namespace boost { + +#if !defined(BOOST_NO_STD_ALLOCATOR) + #define BOOST_CB_DEFAULT_ALLOCATOR(T) std::allocator +#else + #define BOOST_CB_DEFAULT_ALLOCATOR(T) BOOST_DEDUCED_TYPENAME std::vector::allocator_type +#endif + +template +class circular_buffer; + +template +class circular_buffer_space_optimized; + +#undef BOOST_CB_DEFAULT_ALLOCATOR + +} // namespace boost + +#endif // #if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP) diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cassert b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cassert new file mode 100644 index 0000000000..5bc7329dde --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cassert @@ -0,0 +1,10 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CASSERT_HEADER +#define __CASSERT_HEADER + +#include + +#endif // CASSERT_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cctype b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cctype new file mode 100644 index 0000000000..1ad03cb5ca --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cctype @@ -0,0 +1,26 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CCTYPE_HEADER +#define __CCTYPE_HEADER + +#include + +namespace std { + using ::isalnum; + using ::isdigit; + using ::isprint; + using ::isupper; + using ::tolower; + using ::isalpha; + using ::isgraph; + using ::ispunct; + using ::isxdigit; + using ::toupper; + using ::iscntrl; + using ::islower; + using ::isspace; +} + +#endif // CCTYPE_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cerrno b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cerrno new file mode 100644 index 0000000000..4d57b80875 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cerrno @@ -0,0 +1,10 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CERRNO_HEADER +#define __CERRNO_HEADER + +#include + +#endif // CERRNO_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cfloat b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cfloat new file mode 100644 index 0000000000..9d3d53318c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cfloat @@ -0,0 +1,10 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CFLOAT_HEADER +#define __CFLOAT_HEADER + +#include + +#endif // CFLOAT_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/climits b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/climits new file mode 100644 index 0000000000..b71b7f5eb4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/climits @@ -0,0 +1,10 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CLIMITS_HEADER +#define __CLIMITS_HEADER + +#include + +#endif // CLIMITS_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/clocale b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/clocale new file mode 100644 index 0000000000..b3ba3c859f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/clocale @@ -0,0 +1,16 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CLOCALE_HEADER +#define __CLOCALE_HEADER + +#include + +namespace std { + using ::lconv; + using ::localeconv; + using ::setlocale; +} + +#endif // CLOCALE_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cmath b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cmath new file mode 100644 index 0000000000..70dc8843ed --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cmath @@ -0,0 +1,35 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CMATH_HEADER +#define __CMATH_HEADER + +#include + +namespace std { + using ::acos; + using ::cos; + using ::fmod; + using ::modf; + using ::tan; + using ::asin; + using ::cosh; + using ::frexp; + using ::pow; + using ::tanh; + using ::atan; + using ::exp; + using ::ldexp; + using ::sin; + using ::atan2; + using ::fabs; + using ::log; + using ::sinh; + using ::ceil; + using ::floor; + using ::log10; + using ::sqrt; +} + +#endif // CMATH_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/csetjmp b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/csetjmp new file mode 100644 index 0000000000..aa6a019dfe --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/csetjmp @@ -0,0 +1,15 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CSETJMP_HEADER +#define __CSETJMP_HEADER + +#include + +namespace std { + using ::jmp_buf; + using ::longjmp; +} + +#endif // CSETJMP_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/csignal b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/csignal new file mode 100644 index 0000000000..37e11d9e4a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/csignal @@ -0,0 +1,16 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CSIGNAL_HEADER +#define __CSIGNAL_HEADER + +#include + +namespace std { + using ::sig_atomic_t; + using ::raise; + using ::signal; +} + +#endif // CSIGNAL_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdarg b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdarg new file mode 100644 index 0000000000..5e1dd749f0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdarg @@ -0,0 +1,14 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CSTDARG_HEADER +#define __CSTDARG_HEADER + +#include + +namespace std { + using ::va_list; +} + +#endif // CSTDARG_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstddef b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstddef new file mode 100644 index 0000000000..c00a55c1f3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstddef @@ -0,0 +1,15 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CSTDDEF_HEADER +#define __CSTDDEF_HEADER + +#include + +namespace std { + using ::ptrdiff_t; + using ::size_t; +} + +#endif // CSTDDEF_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdio b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdio new file mode 100644 index 0000000000..8a48077ce3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdio @@ -0,0 +1,57 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CSTDIO_HEADER +#define __CSTDIO_HEADER + +#include + +namespace std { + using ::FILE; + using ::fpos_t; + using ::size_t; + using ::clearerr; + using ::fgets; + using ::fscanf; + using ::gets; + using ::rename; + using ::tmpfile; + using ::fclose; + using ::fopen; + using ::fseek; + using ::perror; + using ::rewind; + using ::tmpnam; + using ::feof; + using ::fprintf; + using ::fsetpos; + using ::printf; + using ::scanf; + using ::ungetc; + using ::ferror; + using ::fputc; + using ::ftell; + using ::putc; + using ::setbuf; + using ::vfprintf; + using ::fflush; + using ::fputs; + using ::fwrite; + using ::putchar; + using ::setvbuf; + using ::vprintf; + using ::fgetc; + using ::fread; + using ::getc; + using ::puts; + using ::sprintf; + using ::vsprintf; + using ::fgetpos; + using ::freopen; + using ::getchar; + using ::remove; + using ::sscanf; +} + +#endif // CSTDIO_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdlib b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdlib new file mode 100644 index 0000000000..7592ffcf3d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstdlib @@ -0,0 +1,43 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CSTDLIB_HEADER +#define __CSTDLIB_HEADER + +#include + +namespace std { + using ::abort; + using ::atexit; + using ::exit; + using ::getenv; + using ::system; + using ::calloc; + using ::malloc; + using ::free; + using ::realloc; + using ::atol; + using ::mblen; + using ::strtod; + using ::wctomb; + using ::atof; + using ::mbstowcs; + using ::strtol; + using ::wcstombs; + using ::atoi; + using ::mbtowc; + using ::strtoul; + using ::bsearch; + using ::qsort; + using ::div_t; + using ::ldiv_t; + using ::abs; + using ::labs; + using ::srand; + using ::div; + using ::ldiv; + using ::rand; +} + +#endif // CSTDLIB_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstring b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstring new file mode 100644 index 0000000000..e913597a64 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cstring @@ -0,0 +1,36 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CSTRING_HEADER +#define __CSTRING_HEADER + +#include + +namespace std { + using ::size_t; + using ::memchr; + using ::strcat; + using ::strcspn; + using ::strncpy; + using ::strtok; + using ::memcmp; + using ::strchr; + using ::strerror; + using ::strpbrk; + using ::strxfrm; + using ::memcpy; + using ::strcmp; + using ::strlen; + using ::strrchr; + using ::memmove; + using ::strcoll; + using ::strncat; + using ::strspn; + using ::memset; + using ::strcpy; + using ::strncmp; + using ::strstr; +} + +#endif // CSTRING_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/ctime b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/ctime new file mode 100644 index 0000000000..0c8ac9abf2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/ctime @@ -0,0 +1,26 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CTIME_HEADER +#define __CTIME_HEADER + +#include + +namespace std { + using ::size_t; + using ::clock_t; + using ::time_t; + using ::tm; + using ::asctime; + using ::clock; + using ::difftime; + using ::localtime; + using ::strftime; + using ::ctime; + using ::gmtime; + using ::mktime; + using ::time; +} + +#endif // CTIME_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cwchar b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cwchar new file mode 100644 index 0000000000..f9fbd30955 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cwchar @@ -0,0 +1,156 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CWCHAR_HEADER +#define __CWCHAR_HEADER + +#include + +namespace std { + using ::mbstate_t; + using ::wint_t; + using ::size_t; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::btowc; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::getwchar; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::ungetwc; +#endif + using ::wcscpy; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wcsrtombs; +#endif +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wmemchr; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::fgetwc; +#endif +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::mbrlen; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::vfwprintf; +#endif +#endif + using ::wcscspn; + using ::wcsspn; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wmemcmp; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::fgetws; +#endif +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::mbrtowc; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::vswprintf; +#endif +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::wcsftime; +#endif + using ::wcsstr; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wmemcpy; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::fputwc; +#endif +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::mbsinit; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::vwprintf; +#endif +#endif + using ::wcslen; + using ::wcstod; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wmemmove; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::fputws; +#endif +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::mbsrtowcs; +#endif +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wcrtomb; +#endif + using ::wcsncat; + using ::wcstok; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wmemset; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) +#if !(defined(__DECCXX_VER) && __DECCXX_VER <= 60290024) + using ::fwide; +#endif +#endif +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::putwc; +#endif + using ::wcscat; + using ::wcsncmp; + using ::wcstol; +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wprintf; +#endif +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::fwprintf; +#endif +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::putwchar; +#endif + using ::wcschr; + using ::wcsncpy; + using ::wcstoul; +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wscanf; +#endif +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::fwscanf; +#endif +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::swprintf; +#endif +#endif + using ::wcscmp; + using ::wcspbrk; + using ::wcsxfrm; +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) + using ::getwc; +#endif +#if !(defined(__linux) && defined(__DECCXX_VER) && __DECCXX_VER <= 60390005) +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::swscanf; +#endif +#endif + using ::wcscoll; + using ::wcsrchr; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wctob; +#endif +} + +#endif // CWCHAR_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cwctype b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cwctype new file mode 100644 index 0000000000..cf8f07b074 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compatibility/cpp_c_headers/cwctype @@ -0,0 +1,39 @@ +// This file is automatically generated. Do not edit. +// ['../../libs/compatibility/generate_cpp_c_headers.py'] +// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST') + +#ifndef __CWCTYPE_HEADER +#define __CWCTYPE_HEADER + +#include + +namespace std { +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wctrans_t; +#endif + using ::wctype_t; + using ::wint_t; + using ::iswalnum; + using ::iswctype; + using ::iswlower; + using ::iswspace; +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::towctrans; +#endif +#if !(defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 740) + using ::wctrans; +#endif + using ::iswalpha; + using ::iswdigit; + using ::iswprint; + using ::iswupper; + using ::towlower; + using ::wctype; + using ::iswcntrl; + using ::iswgraph; + using ::iswpunct; + using ::iswxdigit; + using ::towupper; +} + +#endif // CWCTYPE_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/compressed_pair.hpp b/deal.II/contrib/boost/include/boost-1.37.0/compressed_pair.hpp new file mode 100644 index 0000000000..e6cd6a074a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/compressed_pair.hpp @@ -0,0 +1,24 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// 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/utility for most recent version including documentation. + +// See boost/detail/compressed_pair.hpp and boost/detail/ob_compressed_pair.hpp +// for full copyright notices. + +#ifndef BOOST_COMPRESSED_PAIR_HPP +#define BOOST_COMPRESSED_PAIR_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else +#include +#endif + +#endif // BOOST_COMPRESSED_PAIR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/assert.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/assert.hpp new file mode 100644 index 0000000000..80eca817ac --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/assert.hpp @@ -0,0 +1,46 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_ASSERT_DWA2006430_HPP +# define BOOST_CONCEPT_ASSERT_DWA2006430_HPP + +# include +# include + +// The old protocol used a constraints() member function in concept +// checking classes. If the compiler supports SFINAE, we can detect +// that function and seamlessly support the old concept checking +// classes. In this release, backward compatibility with the old +// concept checking classes is enabled by default, where available. +// The old protocol is deprecated, though, and backward compatibility +// will no longer be the default in the next release. + +# if !defined(BOOST_NO_OLD_CONCEPT_SUPPORT) \ + && !defined(BOOST_NO_SFINAE) \ + \ + && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4)) \ + && !(BOOST_WORKAROUND(__GNUC__, == 2)) + +// Note: gcc-2.96 through 3.3.x have some SFINAE, but no ability to +// check for the presence of particularmember functions. + +# define BOOST_OLD_CONCEPT_SUPPORT + +# endif + +# ifdef BOOST_MSVC +# include +# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# include +# else +# include +# endif + + // Usage, in class or function context: + // + // BOOST_CONCEPT_ASSERT((UnaryFunctionConcept)); + // +# define BOOST_CONCEPT_ASSERT(ModelInParens) \ + BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) + +#endif // BOOST_CONCEPT_ASSERT_DWA2006430_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/borland.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/borland.hpp new file mode 100644 index 0000000000..59fec55bad --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/borland.hpp @@ -0,0 +1,29 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP +# define BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP + +# include + +namespace boost { namespace concept { + +template +struct require; + +template +struct require +{ + enum { instantiate = sizeof((((Model*)0)->~Model()), 3) }; +}; + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ + enum \ + { \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + boost::concept::require::instantiate \ + } + +}} // namespace boost::concept + +#endif // BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/concept_def.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/concept_def.hpp new file mode 100644 index 0000000000..79f628e999 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/concept_def.hpp @@ -0,0 +1,51 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP +# define BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP +# include +# include +# include +# include +#endif // BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP + +// BOOST_concept(SomeName, (p1)(p2)...(pN)) +// +// Expands to "template struct SomeName" +// +// Also defines an equivalent SomeNameConcept for backward compatibility. +// Maybe in the next release we can kill off the "Concept" suffix for good. +#if BOOST_WORKAROUND(__GNUC__, <= 3) +# define BOOST_concept(name, params) \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name; /* forward declaration */ \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct BOOST_PP_CAT(name,Concept) \ + : name< BOOST_PP_SEQ_ENUM(params) > \ + { \ + /* at least 2.96 and 3.4.3 both need this */ \ + BOOST_PP_CAT(name,Concept)(); \ + }; \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name +#else +# define BOOST_concept(name, params) \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name; /* forward declaration */ \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct BOOST_PP_CAT(name,Concept) \ + : name< BOOST_PP_SEQ_ENUM(params) > \ + { \ + }; \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name +#endif + +// Helper for BOOST_concept, above. +# define BOOST_CONCEPT_typename(r, ignored, index, t) \ + BOOST_PP_COMMA_IF(index) typename t + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/concept_undef.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/concept_undef.hpp new file mode 100644 index 0000000000..713db89123 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/concept_undef.hpp @@ -0,0 +1,5 @@ +// Copyright David Abrahams 2006. 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) +# undef BOOST_concept_typename +# undef BOOST_concept diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/general.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/general.hpp new file mode 100644 index 0000000000..f36f9c44e9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/general.hpp @@ -0,0 +1,66 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP +# define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP + +# include + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include +# include +# endif + +// This implementation works on Comeau and GCC, all the way back to +// 2.95 +namespace boost { namespace concept { + +template +struct requirement_; + +namespace detail +{ + template struct instantiate {}; +} + +template +struct requirement +{ + static void failed() { ((Model*)0)->~Model(); } +}; + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + +template +struct constraint +{ + static void failed() { ((Model*)0)->constraints(); } +}; + +template +struct requirement_ + : mpl::if_< + concept::not_satisfied + , constraint + , requirement + >::type +{}; + +# else + +// For GCC-2.x, these can't have exactly the same name +template +struct requirement_ + : requirement +{}; + +# endif + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ + typedef ::boost::concept::detail::instantiate< \ + &::boost::concept::requirement_::failed> \ + BOOST_PP_CAT(boost_concept_check,__LINE__) + +}} + +#endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/has_constraints.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/has_constraints.hpp new file mode 100644 index 0000000000..3112b55514 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/has_constraints.hpp @@ -0,0 +1,48 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP +# define BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP + +# include +# include +namespace boost { namespace concept { + +namespace detail +{ + +// Here we implement the metafunction that detects whether a +// constraints metafunction exists + typedef char yes; + typedef char (&no)[2]; + + template + struct wrap_constraints {}; + +#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) + // Work around the following bogus error in Sun Studio 11, by + // turning off the has_constraints function entirely: + // Error: complex expression not allowed in dependent template + // argument expression + inline no has_constraints_(...); +#else + template + inline yes has_constraints_(Model*, wrap_constraints* = 0); + inline no has_constraints_(...); +#endif +} + +// This would be called "detail::has_constraints," but it has a strong +// tendency to show up in error messages. +template +struct not_satisfied +{ + BOOST_STATIC_CONSTANT( + bool + , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) ); + typedef mpl::bool_ type; +}; + +}} // namespace boost::concept::detail + +#endif // BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/msvc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/msvc.hpp new file mode 100644 index 0000000000..3aadb79216 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/detail/msvc.hpp @@ -0,0 +1,92 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_CHECK_MSVC_DWA2006429_HPP +# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP + +# include + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include +# include +# endif + + +namespace boost { namespace concept { + +template +struct check +{ + virtual void failed(Model* x) + { + x->~Model(); + } +}; + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + +namespace detail +{ + // No need for a virtual function here, since evaluating + // not_satisfied below will have already instantiated the + // constraints() member. + struct constraint {}; +} + +template +struct require + : mpl::if_c< + not_satisfied::value + , detail::constraint + , check + >::type +{}; + +# else + +template +struct require + : check +{}; + +# endif + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + +// +// The iterator library sees some really strange errors unless we +// do things this way. +// +template +struct require +{ + virtual void failed(Model*) + { + require(); + } +}; + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ +enum \ +{ \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept::require) \ +} + +# else // Not vc-7.1 + +template +require +require_(void(*)(Model)); + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ +enum \ +{ \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept::require_((ModelFnPtr)0)) \ +} + +# endif +}} + +#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/requires.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/requires.hpp new file mode 100644 index 0000000000..024ba742c9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/requires.hpp @@ -0,0 +1,78 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_REQUIRES_DWA2006430_HPP +# define BOOST_CONCEPT_REQUIRES_DWA2006430_HPP + +# include +# include +# include +# include + +namespace boost { + +// Template for use in handwritten assertions +template +struct requires_ : More +{ +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + typedef typename More::type type; +# endif + BOOST_CONCEPT_ASSERT((Model)); +}; + +// Template for use by macros, where models must be wrapped in parens. +// This isn't in namespace detail to keep extra cruft out of resulting +// error messages. +template +struct _requires_ +{ + enum { value = 0 }; + BOOST_CONCEPT_ASSERT_FN(ModelFn); +}; + +template +struct Requires_ : ::boost::parameter::aux::unaryfunptr_arg_type +{ +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + typedef typename ::boost::parameter::aux::unaryfunptr_arg_type::type type; +# endif +}; + +# if BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1010)) +# define BOOST_CONCEPT_REQUIRES_(r,data,t) | (::boost::_requires_::value) +# else +# define BOOST_CONCEPT_REQUIRES_(r,data,t) + (::boost::_requires_::value) +# endif + +#if defined(NDEBUG) || BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +# define BOOST_CONCEPT_REQUIRES(models, result) \ + typename ::boost::parameter::aux::unaryfunptr_arg_type::type + +#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + +// Same thing as below without the initial typename +# define BOOST_CONCEPT_REQUIRES(models, result) \ + ::boost::Requires_< \ + (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \ + ::boost::parameter::aux::unaryfunptr_arg_type \ + >::type + +#else + +// This just ICEs on MSVC6 :( +# define BOOST_CONCEPT_REQUIRES(models, result) \ + typename ::boost::Requires_< \ + (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \ + void(*)result \ + >::type + +#endif + +// C++0x proposed syntax changed. This supports an older usage +#define BOOST_CONCEPT_WHERE(models,result) BOOST_CONCEPT_REQUIRES(models,result) + +} // namespace boost::concept_check + +#endif // BOOST_CONCEPT_REQUIRES_DWA2006430_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept/usage.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept/usage.hpp new file mode 100644 index 0000000000..9af8ca3cc2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept/usage.hpp @@ -0,0 +1,43 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_USAGE_DWA2006919_HPP +# define BOOST_CONCEPT_USAGE_DWA2006919_HPP + +# include +# include + +namespace boost { namespace concept { + +# if BOOST_WORKAROUND(__GNUC__, == 2) + +# define BOOST_CONCEPT_USAGE(model) ~model() + +# else + +template +struct usage_requirements +{ + ~usage_requirements() { ((Model*)0)->~Model(); } +}; + +# if BOOST_WORKAROUND(__GNUC__, <= 3) + +# define BOOST_CONCEPT_USAGE(model) \ + model(); /* at least 2.96 and 3.4.3 both need this :( */ \ + BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements)); \ + ~model() + +# else + +# define BOOST_CONCEPT_USAGE(model) \ + BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements)); \ + ~model() + +# endif + +# endif + +}} // namespace boost::concept + +#endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept_archetype.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept_archetype.hpp new file mode 100644 index 0000000000..f21c817384 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept_archetype.hpp @@ -0,0 +1,669 @@ +// +// (C) Copyright Jeremy Siek 2000. +// 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) +// +// Revision History: +// +// 17 July 2001: Added const to some member functions. (Jeremy Siek) +// 05 May 2001: Removed static dummy_cons object. (Jeremy Siek) + +// See http://www.boost.org/libs/concept_check for documentation. + +#ifndef BOOST_CONCEPT_ARCHETYPES_HPP +#define BOOST_CONCEPT_ARCHETYPES_HPP + +#include +#include +#include +#include + +namespace boost { + + //=========================================================================== + // Basic Archetype Classes + + namespace detail { + class dummy_constructor { }; + } + + // A type that models no concept. The template parameter + // is only there so that null_archetype types can be created + // that have different type. + template + class null_archetype { + private: + null_archetype() { } + null_archetype(const null_archetype&) { } + null_archetype& operator=(const null_archetype&) { return *this; } + public: + null_archetype(detail::dummy_constructor) { } +#ifndef __MWERKS__ + template + friend void dummy_friend(); // just to avoid warnings +#endif + }; + + // This is a helper class that provides a way to get a reference to + // an object. The get() function will never be called at run-time + // (nothing in this file will) so this seemingly very bad function + // is really quite innocent. The name of this class needs to be + // changed. + template + class static_object + { + public: + static T& get() + { +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + return *reinterpret_cast(0); +#else + static char d[sizeof(T)]; + return *reinterpret_cast(d); +#endif + } + }; + + template > + class default_constructible_archetype : public Base { + public: + default_constructible_archetype() + : Base(static_object::get()) { } + default_constructible_archetype(detail::dummy_constructor x) : Base(x) { } + }; + + template > + class assignable_archetype : public Base { + assignable_archetype() { } + assignable_archetype(const assignable_archetype&) { } + public: + assignable_archetype& operator=(const assignable_archetype&) { + return *this; + } + assignable_archetype(detail::dummy_constructor x) : Base(x) { } + }; + + template > + class copy_constructible_archetype : public Base { + public: + copy_constructible_archetype() + : Base(static_object::get()) { } + copy_constructible_archetype(const copy_constructible_archetype&) + : Base(static_object::get()) { } + copy_constructible_archetype(detail::dummy_constructor x) : Base(x) { } + }; + + template > + class sgi_assignable_archetype : public Base { + public: + sgi_assignable_archetype(const sgi_assignable_archetype&) + : Base(static_object::get()) { } + sgi_assignable_archetype& operator=(const sgi_assignable_archetype&) { + return *this; + } + sgi_assignable_archetype(const detail::dummy_constructor& x) : Base(x) { } + }; + + struct default_archetype_base { + default_archetype_base(detail::dummy_constructor) { } + }; + + // Careful, don't use same type for T and Base. That results in the + // conversion operator being invalid. Since T is often + // null_archetype, can't use null_archetype for Base. + template + class convertible_to_archetype : public Base { + private: + convertible_to_archetype() { } + convertible_to_archetype(const convertible_to_archetype& ) { } + convertible_to_archetype& operator=(const convertible_to_archetype&) + { return *this; } + public: + convertible_to_archetype(detail::dummy_constructor x) : Base(x) { } + operator const T&() const { return static_object::get(); } + }; + + template + class convertible_from_archetype : public Base { + private: + convertible_from_archetype() { } + convertible_from_archetype(const convertible_from_archetype& ) { } + convertible_from_archetype& operator=(const convertible_from_archetype&) + { return *this; } + public: + convertible_from_archetype(detail::dummy_constructor x) : Base(x) { } + convertible_from_archetype(const T&) { } + convertible_from_archetype& operator=(const T&) + { return *this; } + }; + + class boolean_archetype { + public: + boolean_archetype(const boolean_archetype&) { } + operator bool() const { return true; } + boolean_archetype(detail::dummy_constructor) { } + private: + boolean_archetype() { } + boolean_archetype& operator=(const boolean_archetype&) { return *this; } + }; + + template > + class equality_comparable_archetype : public Base { + public: + equality_comparable_archetype(detail::dummy_constructor x) : Base(x) { } + }; + template + boolean_archetype + operator==(const equality_comparable_archetype&, + const equality_comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator!=(const equality_comparable_archetype&, + const equality_comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + + + template > + class equality_comparable2_first_archetype : public Base { + public: + equality_comparable2_first_archetype(detail::dummy_constructor x) + : Base(x) { } + }; + template > + class equality_comparable2_second_archetype : public Base { + public: + equality_comparable2_second_archetype(detail::dummy_constructor x) + : Base(x) { } + }; + template + boolean_archetype + operator==(const equality_comparable2_first_archetype&, + const equality_comparable2_second_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator!=(const equality_comparable2_first_archetype&, + const equality_comparable2_second_archetype&) + { + return boolean_archetype(static_object::get()); + } + + + template > + class less_than_comparable_archetype : public Base { + public: + less_than_comparable_archetype(detail::dummy_constructor x) : Base(x) { } + }; + template + boolean_archetype + operator<(const less_than_comparable_archetype&, + const less_than_comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + + + + template > + class comparable_archetype : public Base { + public: + comparable_archetype(detail::dummy_constructor x) : Base(x) { } + }; + template + boolean_archetype + operator<(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator<=(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator>(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator>=(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + + + // The purpose of the optags is so that one can specify + // exactly which types the operator< is defined between. + // This is useful for allowing the operations: + // + // A a; B b; + // a < b + // b < a + // + // without also allowing the combinations: + // + // a < a + // b < b + // + struct optag1 { }; + struct optag2 { }; + struct optag3 { }; + +#define BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(OP, NAME) \ + template , class Tag = optag1 > \ + class NAME##_first_archetype : public Base { \ + public: \ + NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template , class Tag = optag1 > \ + class NAME##_second_archetype : public Base { \ + public: \ + NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template \ + boolean_archetype \ + operator OP (const NAME##_first_archetype&, \ + const NAME##_second_archetype&) \ + { \ + return boolean_archetype(static_object::get()); \ + } + + BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(==, equal_op) + BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(!=, not_equal_op) + BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(<, less_than_op) + BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(<=, less_equal_op) + BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(>, greater_than_op) + BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(>=, greater_equal_op) + +#define BOOST_DEFINE_OPERATOR_ARCHETYPE(OP, NAME) \ + template > \ + class NAME##_archetype : public Base { \ + public: \ + NAME##_archetype(detail::dummy_constructor x) : Base(x) { } \ + NAME##_archetype(const NAME##_archetype&) \ + : Base(static_object::get()) { } \ + NAME##_archetype& operator=(const NAME##_archetype&) { return *this; } \ + }; \ + template \ + NAME##_archetype \ + operator OP (const NAME##_archetype&,\ + const NAME##_archetype&) \ + { \ + return \ + NAME##_archetype(static_object::get()); \ + } + + BOOST_DEFINE_OPERATOR_ARCHETYPE(+, addable) + BOOST_DEFINE_OPERATOR_ARCHETYPE(-, subtractable) + BOOST_DEFINE_OPERATOR_ARCHETYPE(*, multipliable) + BOOST_DEFINE_OPERATOR_ARCHETYPE(/, dividable) + BOOST_DEFINE_OPERATOR_ARCHETYPE(%, modable) + + // As is, these are useless because of the return type. + // Need to invent a better way... +#define BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(OP, NAME) \ + template > \ + class NAME##_first_archetype : public Base { \ + public: \ + NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template > \ + class NAME##_second_archetype : public Base { \ + public: \ + NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template \ + Return \ + operator OP (const NAME##_first_archetype&, \ + const NAME##_second_archetype&) \ + { \ + return Return(static_object::get()); \ + } + + BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(+, plus_op) + BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(*, time_op) + BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(/, divide_op) + BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(-, subtract_op) + BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(%, mod_op) + + //=========================================================================== + // Function Object Archetype Classes + + template + class generator_archetype { + public: + const Return& operator()() { + return static_object::get(); + } + }; + + class void_generator_archetype { + public: + void operator()() { } + }; + + template + class unary_function_archetype { + private: + unary_function_archetype() { } + public: + unary_function_archetype(detail::dummy_constructor) { } + const Return& operator()(const Arg&) const { + return static_object::get(); + } + }; + + template + class binary_function_archetype { + private: + binary_function_archetype() { } + public: + binary_function_archetype(detail::dummy_constructor) { } + const Return& operator()(const Arg1&, const Arg2&) const { + return static_object::get(); + } + }; + + template + class unary_predicate_archetype { + typedef boolean_archetype Return; + unary_predicate_archetype() { } + public: + unary_predicate_archetype(detail::dummy_constructor) { } + const Return& operator()(const Arg&) const { + return static_object::get(); + } + }; + + template > + class binary_predicate_archetype { + typedef boolean_archetype Return; + binary_predicate_archetype() { } + public: + binary_predicate_archetype(detail::dummy_constructor) { } + const Return& operator()(const Arg1&, const Arg2&) const { + return static_object::get(); + } + }; + + //=========================================================================== + // Iterator Archetype Classes + + template + class input_iterator_archetype + { + private: + typedef input_iterator_archetype self; + public: + typedef std::input_iterator_tag iterator_category; + typedef T value_type; + struct reference { + operator const value_type&() const { return static_object::get(); } + }; + typedef const T* pointer; + typedef std::ptrdiff_t difference_type; + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return reference(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + class input_iterator_archetype_no_proxy + { + private: + typedef input_iterator_archetype_no_proxy self; + public: + typedef std::input_iterator_tag iterator_category; + typedef T value_type; + typedef const T& reference; + typedef const T* pointer; + typedef std::ptrdiff_t difference_type; + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return static_object::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + struct output_proxy { + output_proxy& operator=(const T&) { return *this; } + }; + + template + class output_iterator_archetype + { + public: + typedef output_iterator_archetype self; + public: + typedef std::output_iterator_tag iterator_category; + typedef output_proxy value_type; + typedef output_proxy reference; + typedef void pointer; + typedef void difference_type; + output_iterator_archetype(detail::dummy_constructor) { } + output_iterator_archetype(const self&) { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return output_proxy(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + private: + output_iterator_archetype() { } + }; + + template + class input_output_iterator_archetype + { + private: + typedef input_output_iterator_archetype self; + struct in_out_tag : public std::input_iterator_tag, public std::output_iterator_tag { }; + public: + typedef in_out_tag iterator_category; + typedef T value_type; + struct reference { + reference& operator=(const T&) { return *this; } + operator value_type() { return static_object::get(); } + }; + typedef const T* pointer; + typedef std::ptrdiff_t difference_type; + input_output_iterator_archetype() { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return reference(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + class forward_iterator_archetype + { + public: + typedef forward_iterator_archetype self; + public: + typedef std::forward_iterator_tag iterator_category; + typedef T value_type; + typedef const T& reference; + typedef T const* pointer; + typedef std::ptrdiff_t difference_type; + forward_iterator_archetype() { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return static_object::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + class mutable_forward_iterator_archetype + { + public: + typedef mutable_forward_iterator_archetype self; + public: + typedef std::forward_iterator_tag iterator_category; + typedef T value_type; + typedef T& reference; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + mutable_forward_iterator_archetype() { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return static_object::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + class bidirectional_iterator_archetype + { + public: + typedef bidirectional_iterator_archetype self; + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef T value_type; + typedef const T& reference; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + bidirectional_iterator_archetype() { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return static_object::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + self& operator--() { return *this; } + self operator--(int) { return *this; } + }; + + template + class mutable_bidirectional_iterator_archetype + { + public: + typedef mutable_bidirectional_iterator_archetype self; + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef T value_type; + typedef T& reference; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + mutable_bidirectional_iterator_archetype() { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return static_object::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + self& operator--() { return *this; } + self operator--(int) { return *this; } + }; + + template + class random_access_iterator_archetype + { + public: + typedef random_access_iterator_archetype self; + public: + typedef std::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef const T& reference; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + random_access_iterator_archetype() { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return static_object::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + self& operator--() { return *this; } + self operator--(int) { return *this; } + reference operator[](difference_type) const + { return static_object::get(); } + self& operator+=(difference_type) { return *this; } + self& operator-=(difference_type) { return *this; } + difference_type operator-(const self&) const + { return difference_type(); } + self operator+(difference_type) const { return *this; } + self operator-(difference_type) const { return *this; } + bool operator<(const self&) const { return true; } + bool operator<=(const self&) const { return true; } + bool operator>(const self&) const { return true; } + bool operator>=(const self&) const { return true; } + }; + template + random_access_iterator_archetype + operator+(typename random_access_iterator_archetype::difference_type, + const random_access_iterator_archetype& x) + { return x; } + + + template + class mutable_random_access_iterator_archetype + { + public: + typedef mutable_random_access_iterator_archetype self; + public: + typedef std::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef T& reference; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + mutable_random_access_iterator_archetype() { } + self& operator=(const self&) { return *this; } + bool operator==(const self&) const { return true; } + bool operator!=(const self&) const { return true; } + reference operator*() const { return static_object::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + self& operator--() { return *this; } + self operator--(int) { return *this; } + reference operator[](difference_type) const + { return static_object::get(); } + self& operator+=(difference_type) { return *this; } + self& operator-=(difference_type) { return *this; } + difference_type operator-(const self&) const + { return difference_type(); } + self operator+(difference_type) const { return *this; } + self operator-(difference_type) const { return *this; } + bool operator<(const self&) const { return true; } + bool operator<=(const self&) const { return true; } + bool operator>(const self&) const { return true; } + bool operator>=(const self&) const { return true; } + }; + template + mutable_random_access_iterator_archetype + operator+ + (typename mutable_random_access_iterator_archetype::difference_type, + const mutable_random_access_iterator_archetype& x) + { return x; } + +} // namespace boost + +#endif // BOOST_CONCEPT_ARCHETYPES_H diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept_check.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept_check.hpp new file mode 100644 index 0000000000..4e9fddfb41 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept_check.hpp @@ -0,0 +1,988 @@ +// +// (C) Copyright Jeremy Siek 2000. +// 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) +// +// Revision History: +// 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek) +// 02 April 2001: Removed limits header altogether. (Jeremy Siek) +// 01 April 2001: Modified to use new header. (JMaddock) +// + +// See http://www.boost.org/libs/concept_check for documentation. + +#ifndef BOOST_CONCEPT_CHECKS_HPP +# define BOOST_CONCEPT_CHECKS_HPP + +# include + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include +# include + +namespace boost +{ + + // + // Backward compatibility + // + + template + inline void function_requires(Model* = 0) + { + BOOST_CONCEPT_ASSERT((Model)); + } + template inline void ignore_unused_variable_warning(T const&) {} + +# define BOOST_CLASS_REQUIRE(type_var, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept)) + +# define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept)) + +# define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept)) + +# define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept)) + + + // + // Begin concept definitions + // + BOOST_concept(Integer, (T)) + { + BOOST_CONCEPT_USAGE(Integer) + { + x.error_type_must_be_an_integer_type(); + } + private: + T x; + }; + + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; +# if defined(BOOST_HAS_LONG_LONG) + template <> struct Integer< ::boost::long_long_type> {}; + template <> struct Integer< ::boost::ulong_long_type> {}; +# elif defined(BOOST_HAS_MS_INT64) + template <> struct Integer<__int64> {}; + template <> struct Integer {}; +# endif + + BOOST_concept(SignedInteger,(T)) { + BOOST_CONCEPT_USAGE(SignedInteger) { + x.error_type_must_be_a_signed_integer_type(); + } + private: + T x; + }; + template <> struct SignedInteger { }; + template <> struct SignedInteger {}; + template <> struct SignedInteger {}; + template <> struct SignedInteger {}; +# if defined(BOOST_HAS_LONG_LONG) + template <> struct SignedInteger< ::boost::long_long_type> {}; +# elif defined(BOOST_HAS_MS_INT64) + template <> struct SignedInteger<__int64> {}; +# endif + + BOOST_concept(UnsignedInteger,(T)) { + BOOST_CONCEPT_USAGE(UnsignedInteger) { + x.error_type_must_be_an_unsigned_integer_type(); + } + private: + T x; + }; + + template <> struct UnsignedInteger {}; + template <> struct UnsignedInteger {}; + template <> struct UnsignedInteger {}; + template <> struct UnsignedInteger {}; +# if defined(BOOST_HAS_LONG_LONG) + template <> struct UnsignedInteger< ::boost::ulong_long_type> {}; +# elif defined(BOOST_HAS_MS_INT64) + template <> struct UnsignedInteger {}; +# endif + + //=========================================================================== + // Basic Concepts + + BOOST_concept(DefaultConstructible,(TT)) + { + BOOST_CONCEPT_USAGE(DefaultConstructible) { + TT a; // require default constructor + ignore_unused_variable_warning(a); + } + }; + + BOOST_concept(Assignable,(TT)) + { + BOOST_CONCEPT_USAGE(Assignable) { +#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL + a = a; // require assignment operator +#endif + const_constraints(a); + } + private: + void const_constraints(const TT& b) { +#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL + a = b; // const required for argument to assignment +#endif + } + private: + TT a; + }; + + + BOOST_concept(CopyConstructible,(TT)) + { + BOOST_CONCEPT_USAGE(CopyConstructible) { + TT a(b); // require copy constructor + TT* ptr = &a; // require address of operator + const_constraints(a); + ignore_unused_variable_warning(ptr); + } + private: + void const_constraints(const TT& a) { + TT c(a); // require const copy constructor + const TT* ptr = &a; // require const address of operator + ignore_unused_variable_warning(c); + ignore_unused_variable_warning(ptr); + } + TT b; + }; + + // The SGI STL version of Assignable requires copy constructor and operator= + BOOST_concept(SGIAssignable,(TT)) + { + BOOST_CONCEPT_USAGE(SGIAssignable) { + TT b(a); +#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL + a = a; // require assignment operator +#endif + const_constraints(a); + ignore_unused_variable_warning(b); + } + private: + void const_constraints(const TT& b) { + TT c(b); +#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL + a = b; // const required for argument to assignment +#endif + ignore_unused_variable_warning(c); + } + TT a; + }; + + BOOST_concept(Convertible,(X)(Y)) + { + BOOST_CONCEPT_USAGE(Convertible) { + Y y = x; + ignore_unused_variable_warning(y); + } + private: + X x; + }; + + // The C++ standard requirements for many concepts talk about return + // types that must be "convertible to bool". The problem with this + // requirement is that it leaves the door open for evil proxies that + // define things like operator|| with strange return types. Two + // possible solutions are: + // 1) require the return type to be exactly bool + // 2) stay with convertible to bool, and also + // specify stuff about all the logical operators. + // For now we just test for convertible to bool. + template + void require_boolean_expr(const TT& t) { + bool x = t; + ignore_unused_variable_warning(x); + } + + BOOST_concept(EqualityComparable,(TT)) + { + BOOST_CONCEPT_USAGE(EqualityComparable) { + require_boolean_expr(a == b); + require_boolean_expr(a != b); + } + private: + TT a, b; + }; + + BOOST_concept(LessThanComparable,(TT)) + { + BOOST_CONCEPT_USAGE(LessThanComparable) { + require_boolean_expr(a < b); + } + private: + TT a, b; + }; + + // This is equivalent to SGI STL's LessThanComparable. + BOOST_concept(Comparable,(TT)) + { + BOOST_CONCEPT_USAGE(Comparable) { + require_boolean_expr(a < b); + require_boolean_expr(a > b); + require_boolean_expr(a <= b); + require_boolean_expr(a >= b); + } + private: + TT a, b; + }; + +#define BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(OP,NAME) \ + BOOST_concept(NAME, (First)(Second)) \ + { \ + BOOST_CONCEPT_USAGE(NAME) { (void)constraints_(); } \ + private: \ + bool constraints_() { return a OP b; } \ + First a; \ + Second b; \ + } + +#define BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(OP,NAME) \ + BOOST_concept(NAME, (Ret)(First)(Second)) \ + { \ + BOOST_CONCEPT_USAGE(NAME) { (void)constraints_(); } \ + private: \ + Ret constraints_() { return a OP b; } \ + First a; \ + Second b; \ + } + + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOp); + + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOp); + + //=========================================================================== + // Function Object Concepts + + BOOST_concept(Generator,(Func)(Return)) + { + BOOST_CONCEPT_USAGE(Generator) { test(is_void()); } + + private: + void test(boost::mpl::false_) + { + // Do we really want a reference here? + const Return& r = f(); + ignore_unused_variable_warning(r); + } + + void test(boost::mpl::true_) + { + f(); + } + + Func f; + }; + + BOOST_concept(UnaryFunction,(Func)(Return)(Arg)) + { + BOOST_CONCEPT_USAGE(UnaryFunction) { test(is_void()); } + + private: + void test(boost::mpl::false_) + { + f(arg); // "priming the pump" this way keeps msvc6 happy (ICE) + Return r = f(arg); + ignore_unused_variable_warning(r); + } + + void test(boost::mpl::true_) + { + f(arg); + } + + Func f; + Arg arg; + }; + + BOOST_concept(BinaryFunction,(Func)(Return)(First)(Second)) + { + BOOST_CONCEPT_USAGE(BinaryFunction) { test(is_void()); } + private: + void test(boost::mpl::false_) + { + f(first,second); + Return r = f(first, second); // require operator() + (void)r; + } + + void test(boost::mpl::true_) + { + f(first,second); + } + + Func f; + First first; + Second second; + }; + + BOOST_concept(UnaryPredicate,(Func)(Arg)) + { + BOOST_CONCEPT_USAGE(UnaryPredicate) { + require_boolean_expr(f(arg)); // require operator() returning bool + } + private: + Func f; + Arg arg; + }; + + BOOST_concept(BinaryPredicate,(Func)(First)(Second)) + { + BOOST_CONCEPT_USAGE(BinaryPredicate) { + require_boolean_expr(f(a, b)); // require operator() returning bool + } + private: + Func f; + First a; + Second b; + }; + + // use this when functor is used inside a container class like std::set + BOOST_concept(Const_BinaryPredicate,(Func)(First)(Second)) + : BinaryPredicate + { + BOOST_CONCEPT_USAGE(Const_BinaryPredicate) { + const_constraints(f); + } + private: + void const_constraints(const Func& fun) { + // operator() must be a const member function + require_boolean_expr(fun(a, b)); + } + Func f; + First a; + Second b; + }; + + BOOST_concept(AdaptableGenerator,(Func)(Return)) + : Generator + { + typedef typename Func::result_type result_type; + + BOOST_CONCEPT_USAGE(AdaptableGenerator) + { + BOOST_CONCEPT_ASSERT((Convertible)); + } + }; + + BOOST_concept(AdaptableUnaryFunction,(Func)(Return)(Arg)) + : UnaryFunction + { + typedef typename Func::argument_type argument_type; + typedef typename Func::result_type result_type; + + ~AdaptableUnaryFunction() + { + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_CONCEPT_ASSERT((Convertible)); + } + }; + + BOOST_concept(AdaptableBinaryFunction,(Func)(Return)(First)(Second)) + : BinaryFunction< + Func + , typename Func::result_type + , typename Func::first_argument_type + , typename Func::second_argument_type + > + { + typedef typename Func::first_argument_type first_argument_type; + typedef typename Func::second_argument_type second_argument_type; + typedef typename Func::result_type result_type; + + ~AdaptableBinaryFunction() + { + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_CONCEPT_ASSERT((Convertible)); + } + }; + + BOOST_concept(AdaptablePredicate,(Func)(Arg)) + : UnaryPredicate + , AdaptableUnaryFunction + { + }; + + BOOST_concept(AdaptableBinaryPredicate,(Func)(First)(Second)) + : BinaryPredicate + , AdaptableBinaryFunction + { + }; + + //=========================================================================== + // Iterator Concepts + + BOOST_concept(InputIterator,(TT)) + : Assignable + , EqualityComparable + { + typedef typename boost::detail::iterator_traits::value_type value_type; + typedef typename boost::detail::iterator_traits::difference_type difference_type; + typedef typename boost::detail::iterator_traits::reference reference; + typedef typename boost::detail::iterator_traits::pointer pointer; + typedef typename boost::detail::iterator_traits::iterator_category iterator_category; + + BOOST_CONCEPT_USAGE(InputIterator) + { + BOOST_CONCEPT_ASSERT((SignedInteger)); + BOOST_CONCEPT_ASSERT((Convertible)); + + TT j(i); + (void)*i; // require dereference operator + ++j; // require preincrement operator + i++; // require postincrement operator + } + private: + TT i; + }; + + BOOST_concept(OutputIterator,(TT)(ValueT)) + : Assignable + { + BOOST_CONCEPT_USAGE(OutputIterator) { + + ++i; // require preincrement operator + i++; // require postincrement operator + *i++ = t; // require postincrement and assignment + } + private: + TT i, j; + ValueT t; + }; + + BOOST_concept(ForwardIterator,(TT)) + : InputIterator + { + BOOST_CONCEPT_USAGE(ForwardIterator) + { + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME ForwardIterator::iterator_category + , std::forward_iterator_tag + >)); + + typename InputIterator::reference r = *i; + ignore_unused_variable_warning(r); + } + + private: + TT i; + }; + + BOOST_concept(Mutable_ForwardIterator,(TT)) + : ForwardIterator + { + BOOST_CONCEPT_USAGE(Mutable_ForwardIterator) { + *i++ = *i; // require postincrement and assignment + } + private: + TT i; + }; + + BOOST_concept(BidirectionalIterator,(TT)) + : ForwardIterator + { + BOOST_CONCEPT_USAGE(BidirectionalIterator) + { + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalIterator::iterator_category + , std::bidirectional_iterator_tag + >)); + + --i; // require predecrement operator + i--; // require postdecrement operator + } + private: + TT i; + }; + + BOOST_concept(Mutable_BidirectionalIterator,(TT)) + : BidirectionalIterator + , Mutable_ForwardIterator + { + BOOST_CONCEPT_USAGE(Mutable_BidirectionalIterator) + { + *i-- = *i; // require postdecrement and assignment + } + private: + TT i; + }; + + BOOST_concept(RandomAccessIterator,(TT)) + : BidirectionalIterator + , Comparable + { + BOOST_CONCEPT_USAGE(RandomAccessIterator) + { + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalIterator::iterator_category + , std::random_access_iterator_tag + >)); + + i += n; // require assignment addition operator + i = i + n; i = n + i; // require addition with difference type + i -= n; // require assignment subtraction operator + i = i - n; // require subtraction with difference type + n = i - j; // require difference operator + (void)i[n]; // require element access operator + } + + private: + TT a, b; + TT i, j; + typename boost::detail::iterator_traits::difference_type n; + }; + + BOOST_concept(Mutable_RandomAccessIterator,(TT)) + : RandomAccessIterator + , Mutable_BidirectionalIterator + { + BOOST_CONCEPT_USAGE(Mutable_RandomAccessIterator) + { + i[n] = *i; // require element access and assignment + } + private: + TT i; + typename boost::detail::iterator_traits::difference_type n; + }; + + //=========================================================================== + // Container s + + BOOST_concept(Container,(C)) + : Assignable + { + typedef typename C::value_type value_type; + typedef typename C::difference_type difference_type; + typedef typename C::size_type size_type; + typedef typename C::const_reference const_reference; + typedef typename C::const_pointer const_pointer; + typedef typename C::const_iterator const_iterator; + + BOOST_CONCEPT_USAGE(Container) + { + BOOST_CONCEPT_ASSERT((InputIterator)); + const_constraints(c); + } + + private: + void const_constraints(const C& cc) { + i = cc.begin(); + i = cc.end(); + n = cc.size(); + n = cc.max_size(); + b = cc.empty(); + } + C c; + bool b; + const_iterator i; + size_type n; + }; + + BOOST_concept(Mutable_Container,(C)) + : Container + { + typedef typename C::reference reference; + typedef typename C::iterator iterator; + typedef typename C::pointer pointer; + + BOOST_CONCEPT_USAGE(Mutable_Container) + { + BOOST_CONCEPT_ASSERT(( + Assignable)); + + BOOST_CONCEPT_ASSERT((InputIterator)); + + i = c.begin(); + i = c.end(); + c.swap(c2); + } + + private: + iterator i; + C c, c2; + }; + + BOOST_concept(ForwardContainer,(C)) + : Container + { + BOOST_CONCEPT_USAGE(ForwardContainer) + { + BOOST_CONCEPT_ASSERT(( + ForwardIterator< + typename ForwardContainer::const_iterator + >)); + } + }; + + BOOST_concept(Mutable_ForwardContainer,(C)) + : ForwardContainer + , Mutable_Container + { + BOOST_CONCEPT_USAGE(Mutable_ForwardContainer) + { + BOOST_CONCEPT_ASSERT(( + Mutable_ForwardIterator< + typename Mutable_ForwardContainer::iterator + >)); + } + }; + + BOOST_concept(ReversibleContainer,(C)) + : ForwardContainer + { + typedef typename + C::const_reverse_iterator + const_reverse_iterator; + + BOOST_CONCEPT_USAGE(ReversibleContainer) + { + BOOST_CONCEPT_ASSERT(( + BidirectionalIterator< + typename ReversibleContainer::const_iterator>)); + + BOOST_CONCEPT_ASSERT((BidirectionalIterator)); + + const_constraints(c); + } + private: + void const_constraints(const C& cc) + { + const_reverse_iterator i = cc.rbegin(); + i = cc.rend(); + } + C c; + }; + + BOOST_concept(Mutable_ReversibleContainer,(C)) + : Mutable_ForwardContainer + , ReversibleContainer + { + typedef typename C::reverse_iterator reverse_iterator; + + BOOST_CONCEPT_USAGE(Mutable_ReversibleContainer) + { + typedef typename Mutable_ForwardContainer::iterator iterator; + BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator)); + BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator)); + + reverse_iterator i = c.rbegin(); + i = c.rend(); + } + private: + C c; + }; + + BOOST_concept(RandomAccessContainer,(C)) + : ReversibleContainer + { + typedef typename C::size_type size_type; + typedef typename C::const_reference const_reference; + + BOOST_CONCEPT_USAGE(RandomAccessContainer) + { + BOOST_CONCEPT_ASSERT(( + RandomAccessIterator< + typename RandomAccessContainer::const_iterator + >)); + + const_constraints(c); + } + private: + void const_constraints(const C& cc) + { + const_reference r = cc[n]; + ignore_unused_variable_warning(r); + } + + C c; + size_type n; + }; + + BOOST_concept(Mutable_RandomAccessContainer,(C)) + : Mutable_ReversibleContainer + , RandomAccessContainer + { + private: + typedef Mutable_RandomAccessContainer self; + public: + BOOST_CONCEPT_USAGE(Mutable_RandomAccessContainer) + { + BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator)); + BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator)); + + typename self::reference r = c[i]; + ignore_unused_variable_warning(r); + } + + private: + typename Mutable_ReversibleContainer::size_type i; + C c; + }; + + // A Sequence is inherently mutable + BOOST_concept(Sequence,(S)) + : Mutable_ForwardContainer + // Matt Austern's book puts DefaultConstructible here, the C++ + // standard places it in Container --JGS + // ... so why aren't we following the standard? --DWA + , DefaultConstructible + { + BOOST_CONCEPT_USAGE(Sequence) + { + S + c(n), + c2(n, t), + c3(first, last); + + c.insert(p, t); + c.insert(p, n, t); + c.insert(p, first, last); + + c.erase(p); + c.erase(p, q); + + typename Sequence::reference r = c.front(); + + ignore_unused_variable_warning(c); + ignore_unused_variable_warning(c2); + ignore_unused_variable_warning(c3); + ignore_unused_variable_warning(r); + const_constraints(c); + } + private: + void const_constraints(const S& c) { + typename Sequence::const_reference r = c.front(); + ignore_unused_variable_warning(r); + } + + typename S::value_type t; + typename S::size_type n; + typename S::value_type* first, *last; + typename S::iterator p, q; + }; + + BOOST_concept(FrontInsertionSequence,(S)) + : Sequence + { + BOOST_CONCEPT_USAGE(FrontInsertionSequence) + { + c.push_front(t); + c.pop_front(); + } + private: + S c; + typename S::value_type t; + }; + + BOOST_concept(BackInsertionSequence,(S)) + : Sequence + { + BOOST_CONCEPT_USAGE(BackInsertionSequence) + { + c.push_back(t); + c.pop_back(); + typename BackInsertionSequence::reference r = c.back(); + ignore_unused_variable_warning(r); + const_constraints(c); + } + private: + void const_constraints(const S& cc) { + typename BackInsertionSequence::const_reference + r = cc.back(); + ignore_unused_variable_warning(r); + }; + S c; + typename S::value_type t; + }; + + BOOST_concept(AssociativeContainer,(C)) + : ForwardContainer + , DefaultConstructible + { + typedef typename C::key_type key_type; + typedef typename C::key_compare key_compare; + typedef typename C::value_compare value_compare; + typedef typename C::iterator iterator; + + BOOST_CONCEPT_USAGE(AssociativeContainer) + { + i = c.find(k); + r = c.equal_range(k); + c.erase(k); + c.erase(i); + c.erase(r.first, r.second); + const_constraints(c); + BOOST_CONCEPT_ASSERT((BinaryPredicate)); + + typedef typename AssociativeContainer::value_type value_type_; + BOOST_CONCEPT_ASSERT((BinaryPredicate)); + } + + // Redundant with the base concept, but it helps below. + typedef typename C::const_iterator const_iterator; + private: + void const_constraints(const C& cc) + { + ci = cc.find(k); + n = cc.count(k); + cr = cc.equal_range(k); + } + + C c; + iterator i; + std::pair r; + const_iterator ci; + std::pair cr; + typename C::key_type k; + typename C::size_type n; + }; + + BOOST_concept(UniqueAssociativeContainer,(C)) + : AssociativeContainer + { + BOOST_CONCEPT_USAGE(UniqueAssociativeContainer) + { + C c(first, last); + + pos_flag = c.insert(t); + c.insert(first, last); + + ignore_unused_variable_warning(c); + } + private: + std::pair pos_flag; + typename C::value_type t; + typename C::value_type* first, *last; + }; + + BOOST_concept(MultipleAssociativeContainer,(C)) + : AssociativeContainer + { + BOOST_CONCEPT_USAGE(MultipleAssociativeContainer) + { + C c(first, last); + + pos = c.insert(t); + c.insert(first, last); + + ignore_unused_variable_warning(c); + ignore_unused_variable_warning(pos); + } + private: + typename C::iterator pos; + typename C::value_type t; + typename C::value_type* first, *last; + }; + + BOOST_concept(SimpleAssociativeContainer,(C)) + : AssociativeContainer + { + BOOST_CONCEPT_USAGE(SimpleAssociativeContainer) + { + typedef typename C::key_type key_type; + typedef typename C::value_type value_type; + BOOST_MPL_ASSERT((boost::is_same)); + } + }; + + BOOST_concept(PairAssociativeContainer,(C)) + : AssociativeContainer + { + BOOST_CONCEPT_USAGE(PairAssociativeContainer) + { + typedef typename C::key_type key_type; + typedef typename C::value_type value_type; + typedef typename C::mapped_type mapped_type; + typedef std::pair required_value_type; + BOOST_MPL_ASSERT((boost::is_same)); + } + }; + + BOOST_concept(SortedAssociativeContainer,(C)) + : AssociativeContainer + , ReversibleContainer + { + BOOST_CONCEPT_USAGE(SortedAssociativeContainer) + { + C + c(kc), + c2(first, last), + c3(first, last, kc); + + p = c.upper_bound(k); + p = c.lower_bound(k); + r = c.equal_range(k); + + c.insert(p, t); + + ignore_unused_variable_warning(c); + ignore_unused_variable_warning(c2); + ignore_unused_variable_warning(c3); + const_constraints(c); + } + + void const_constraints(const C& c) + { + kc = c.key_comp(); + vc = c.value_comp(); + + cp = c.upper_bound(k); + cp = c.lower_bound(k); + cr = c.equal_range(k); + } + + private: + typename C::key_compare kc; + typename C::value_compare vc; + typename C::value_type t; + typename C::key_type k; + typedef typename C::iterator iterator; + typedef typename C::const_iterator const_iterator; + + typedef SortedAssociativeContainer self; + iterator p; + const_iterator cp; + std::pair r; + std::pair cr; + typename C::value_type* first, *last; + }; + + // HashedAssociativeContainer + +} // namespace boost + +# include + +#endif // BOOST_CONCEPT_CHECKS_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept_check/borland.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/borland.hpp new file mode 100644 index 0000000000..107926bb31 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/borland.hpp @@ -0,0 +1,25 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_CHECK_BORLAND_DWA2006429_HPP +# define BOOST_CONCEPT_CHECK_BORLAND_DWA2006429_HPP + +namespace boost { + +template +struct concept_check; + +template +struct concept_check +{ + enum { instantiate = sizeof((((Model*)0)->~Model()), 3) }; +}; + +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ + enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + boost::concept_check::instantiate \ + } + +} // namespace boost::concept_checking + +#endif // BOOST_CONCEPT_CHECK_BORLAND_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept_check/general.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/general.hpp new file mode 100644 index 0000000000..cd09fb043e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/general.hpp @@ -0,0 +1,82 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_CHECK_MSVC_DWA2006429_HPP +# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include +# include +# endif + + +// This implementation works on GCC and Comeau, but has actually been +// fairly carefully tuned to work on GCC versions starting with +// gcc-2.95.x. If you're trying to get an additional compiler to pass +// the tests you might consider breaking out a separate gcc.hpp and +// starting over on the general case. +namespace boost +{ + namespace concept_checking + { + template struct instantiate {}; + } + + template struct concept_check_; + + template + void concept_check_failed() + { + ((Model*)0)->~Model(); + } + + template + struct concept_check + { + concept_checking::instantiate > x; + enum { instantiate = 1 }; + }; + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + + template + void constraint_check_failed() + { + ((Model*)0)->constraints(); + } + + template + struct constraint_check + { + concept_checking::instantiate > x; + enum { instantiate = 1 }; + }; + + template + struct concept_check_ + : mpl::if_c< + concept_checking::has_constraints::value + , constraint_check + , concept_check + >::type + {}; + +# else + + template + struct concept_check_ + : concept_check + {}; + +# endif + + // Usage, in class or function context: + // + // BOOST_CONCEPT_ASSERT((UnaryFunctionConcept)); +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ + enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + ::boost::concept_check_::instantiate \ + } +} + +#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept_check/has_constraints.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/has_constraints.hpp new file mode 100644 index 0000000000..e19f664f62 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/has_constraints.hpp @@ -0,0 +1,31 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP +# define BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP + +namespace boost { namespace concept_checking { + +// Here we implement the "metafunction" that detects whether a +// constraints metafunction exists +typedef char yes; +typedef char (&no)[2]; + +template +struct wrap_constraints {}; + +template +inline yes has_constraints_(Model*, wrap_constraints* = 0); +inline no has_constraints_(...); + +template +struct has_constraints +{ + BOOST_STATIC_CONSTANT( + bool + , value = sizeof( concept_checking::has_constraints_((Model*)0) ) == 1 ); +}; + +}} // namespace boost::concept_checking + +#endif // BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/concept_check/msvc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/msvc.hpp new file mode 100644 index 0000000000..3968469a89 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/concept_check/msvc.hpp @@ -0,0 +1,90 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_CHECK_MSVC_DWA2006429_HPP +# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include +# include +# endif + + +namespace boost +{ + namespace concept_checking + { + template + struct concept_check_ + { + virtual void failed(Model* x) + { + x->~Model(); + } + }; + } + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + + namespace concept_checking + { + template + struct constraint_check + { + virtual void failed(Model* x) + { + x->constraints(); + } + }; + } + + template + struct concept_check + : mpl::if_c< + concept_checking::has_constraints::value + , concept_checking::constraint_check + , concept_checking::concept_check_ + >::type + {}; + +# else + + template + struct concept_check + : concept_checking::concept_check_ + {}; + +# endif + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + + // + // The iterator library sees some really strange errors unless we + // use partial specialization to extract the model type with + // msvc-7.1 + // + template + struct concept_check + : concept_check + { }; + +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ + enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept_check) \ + } + +# else + + template + concept_check + concept_check_(void(*)(Model)); + +# define BOOST_CONCEPT_ASSERT( ModelInParens ) \ + enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept_check_((void(*) ModelInParens)0)) \ + } + +# endif +} + +#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config.hpp new file mode 100644 index 0000000000..055a27855b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config.hpp @@ -0,0 +1,70 @@ +// Boost config.hpp configuration header file ------------------------------// + +// (C) Copyright John Maddock 2002. +// 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/config for most recent version. + +// Boost config.hpp policy and rationale documentation has been moved to +// http://www.boost.org/libs/config +// +// CAUTION: This file is intended to be completely stable - +// DO NOT MODIFY THIS FILE! +// + +#ifndef BOOST_CONFIG_HPP +#define BOOST_CONFIG_HPP + +// if we don't have a user config, then use the default location: +#if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG) +# define BOOST_USER_CONFIG +#endif +// include it first: +#ifdef BOOST_USER_CONFIG +# include BOOST_USER_CONFIG +#endif + +// if we don't have a compiler config set, try and find one: +#if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG) +# include +#endif +// if we have a compiler config, include it now: +#ifdef BOOST_COMPILER_CONFIG +# include BOOST_COMPILER_CONFIG +#endif + +// if we don't have a std library config set, try and find one: +#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) +# include +#endif +// if we have a std library config, include it now: +#ifdef BOOST_STDLIB_CONFIG +# include BOOST_STDLIB_CONFIG +#endif + +// if we don't have a platform config set, try and find one: +#if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG) +# include +#endif +// if we have a platform config, include it now: +#ifdef BOOST_PLATFORM_CONFIG +# include BOOST_PLATFORM_CONFIG +#endif + +// get config suffix code: +#include + +#endif // BOOST_CONFIG_HPP + + + + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/abi/borland_prefix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/borland_prefix.hpp new file mode 100644 index 0000000000..49f4249499 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/borland_prefix.hpp @@ -0,0 +1,27 @@ +// (C) Copyright John Maddock 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) + +// for C++ Builder the following options effect the ABI: +// +// -b (on or off - effect emum sizes) +// -Vx (on or off - empty members) +// -Ve (on or off - empty base classes) +// -aX (alignment - 5 options). +// -pX (Calling convention - 4 options) +// -VmX (member pointer size and layout - 5 options) +// -VC (on or off, changes name mangling) +// -Vl (on or off, changes struct layout). + +// In addition the following warnings are sufficiently annoying (and +// unfixable) to have them turned off by default: +// +// 8027 - functions containing [for|while] loops are not expanded inline +// 8026 - functions taking class by value arguments are not expanded inline + +#pragma nopushoptwarn +# pragma option push -Vx -Ve -a8 -b -pc -Vmv -VC- -Vl- -w-8027 -w-8026 + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/abi/borland_suffix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/borland_suffix.hpp new file mode 100644 index 0000000000..940535f381 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/borland_suffix.hpp @@ -0,0 +1,12 @@ +// (C) Copyright John Maddock 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) + +# pragma option pop +#pragma nopushoptwarn + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/abi/msvc_prefix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/msvc_prefix.hpp new file mode 100644 index 0000000000..97f06cdc0c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/msvc_prefix.hpp @@ -0,0 +1,22 @@ +// (C) Copyright John Maddock 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) + +// +// Boost binaries are built with the compiler's default ABI settings, +// if the user changes their default alignment in the VS IDE then their +// code will no longer be binary compatible with the bjam built binaries +// unless this header is included to force Boost code into a consistent ABI. +// +// Note that inclusion of this header is only necessary for libraries with +// separate source, header only libraries DO NOT need this as long as all +// translation units are built with the same options. +// +#if defined(_M_X64) +# pragma pack(push,16) +#else +# pragma pack(push,8) +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/abi/msvc_suffix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/msvc_suffix.hpp new file mode 100644 index 0000000000..a64d783eb0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/abi/msvc_suffix.hpp @@ -0,0 +1,8 @@ +// (C) Copyright John Maddock 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) + +#pragma pack(pop) + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/abi_prefix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/abi_prefix.hpp new file mode 100644 index 0000000000..3b1347492c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/abi_prefix.hpp @@ -0,0 +1,25 @@ +// abi_prefix header -------------------------------------------------------// + +// (c) Copyright John Maddock 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). + +#ifndef BOOST_CONFIG_ABI_PREFIX_HPP +# define BOOST_CONFIG_ABI_PREFIX_HPP +#else +# error double inclusion of header boost/config/abi_prefix.hpp is an error +#endif + +#include + +// this must occur after all other includes and before any code appears: +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_PREFIX +#endif + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/abi_suffix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/abi_suffix.hpp new file mode 100644 index 0000000000..939161662a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/abi_suffix.hpp @@ -0,0 +1,27 @@ +// abi_sufffix header -------------------------------------------------------// + +// (c) Copyright John Maddock 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). + +// This header should be #included AFTER code that was preceded by a #include +// . + +#ifndef BOOST_CONFIG_ABI_PREFIX_HPP +# error Header boost/config/abi_suffix.hpp must only be used after boost/config/abi_prefix.hpp +#else +# undef BOOST_CONFIG_ABI_PREFIX_HPP +#endif + +// the suffix header occurs after all of our code: +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_SUFFIX +#endif + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/auto_link.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/auto_link.hpp new file mode 100644 index 0000000000..df58d4f926 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/auto_link.hpp @@ -0,0 +1,368 @@ +// (C) Copyright John Maddock 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) + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE auto_link.hpp + * VERSION see + * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers. + */ + +/************************************************************************* + +USAGE: +~~~~~~ + +Before including this header you must define one or more of define the following macros: + +BOOST_LIB_NAME: Required: A string containing the basename of the library, + for example boost_regex. +BOOST_LIB_TOOLSET: Optional: the base name of the toolset. +BOOST_DYN_LINK: Optional: when set link to dll rather than static library. +BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name + of the library selected (useful for debugging). +BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib, + rather than a mangled-name version. + +These macros will be undef'ed at the end of the header, further this header +has no include guards - so be sure to include it only once from your library! + +Algorithm: +~~~~~~~~~~ + +Libraries for Borland and Microsoft compilers are automatically +selected here, the name of the lib is selected according to the following +formula: + +BOOST_LIB_PREFIX + + BOOST_LIB_NAME + + "_" + + BOOST_LIB_TOOLSET + + BOOST_LIB_THREAD_OPT + + BOOST_LIB_RT_OPT + "-" + + BOOST_LIB_VERSION + +These are defined as: + +BOOST_LIB_PREFIX: "lib" for static libraries otherwise "". + +BOOST_LIB_NAME: The base name of the lib ( for example boost_regex). + +BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc). + +BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing. + +BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, + contains one or more of the following letters after + a hiphen: + + s static runtime (dynamic if not present). + d debug build (release if not present). + g debug/diagnostic runtime (release if not present). + p STLPort Build. + +BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. + + +***************************************************************************/ + +#ifdef __cplusplus +# ifndef BOOST_CONFIG_HPP +# include +# endif +#elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__) +// +// C language compatability (no, honestly) +// +# define BOOST_MSVC _MSC_VER +# define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) +# define BOOST_DO_STRINGIZE(X) #X +#endif +// +// Only include what follows for known and supported compilers: +// +#if defined(BOOST_MSVC) \ + || defined(__BORLANDC__) \ + || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \ + || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) + +#ifndef BOOST_VERSION_HPP +# include +#endif + +#ifndef BOOST_LIB_NAME +# error "Macro BOOST_LIB_NAME not set (internal error)" +#endif + +// +// error check: +// +#if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG) +# pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors") +# pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes") +# error "Incompatible build options" +#endif +// +// select toolset if not defined already: +// +#ifndef BOOST_LIB_TOOLSET +// Note: no compilers before 1200 are supported +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) + +# ifdef UNDER_CE + // vc6: +# define BOOST_LIB_TOOLSET "evc4" +# else + // vc6: +# define BOOST_LIB_TOOLSET "vc6" +# endif + +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) + + // vc7: +# define BOOST_LIB_TOOLSET "vc7" + +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310) + + // vc71: +# define BOOST_LIB_TOOLSET "vc71" + +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400) + + // vc80: +# define BOOST_LIB_TOOLSET "vc80" + +#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1500) + + // vc90: +# define BOOST_LIB_TOOLSET "vc90" + +#elif defined(__BORLANDC__) + + // CBuilder 6: +# define BOOST_LIB_TOOLSET "bcb" + +#elif defined(__ICL) + + // Intel C++, no version number: +# define BOOST_LIB_TOOLSET "iw" + +#elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF ) + + // Metrowerks CodeWarrior 8.x +# define BOOST_LIB_TOOLSET "cw8" + +#elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF ) + + // Metrowerks CodeWarrior 9.x +# define BOOST_LIB_TOOLSET "cw9" + +#endif +#endif // BOOST_LIB_TOOLSET + +// +// select thread opt: +// +#if defined(_MT) || defined(__MT__) +# define BOOST_LIB_THREAD_OPT "-mt" +#else +# define BOOST_LIB_THREAD_OPT +#endif + +#if defined(_MSC_VER) || defined(__MWERKS__) + +# ifdef _DLL + +# if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-gdp" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-gdp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-p" +# endif + +# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-gdpn" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-gdpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-pn" +# endif + +# else + +# if defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-gd" +# else +# define BOOST_LIB_RT_OPT +# endif + +# endif + +# else + +# if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-sgdp" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-sgdp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-sp" +# endif + +# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-sgdpn" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-sgdpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-spn" +# endif + +# else + +# if defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-sgd" +# else +# define BOOST_LIB_RT_OPT "-s" +# endif + +# endif + +# endif + +#elif defined(__BORLANDC__) + +// +// figure out whether we want the debug builds or not: +// +#if __BORLANDC__ > 0x561 +#pragma defineonoption BOOST_BORLAND_DEBUG -v +#endif +// +// sanity check: +// +#if defined(__STL_DEBUG) || defined(_STLP_DEBUG) +#error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form" +#endif + +# ifdef _RTLDLL + +# ifdef BOOST_BORLAND_DEBUG +# define BOOST_LIB_RT_OPT "-d" +# else +# define BOOST_LIB_RT_OPT +# endif + +# else + +# ifdef BOOST_BORLAND_DEBUG +# define BOOST_LIB_RT_OPT "-sd" +# else +# define BOOST_LIB_RT_OPT "-s" +# endif + +# endif + +#endif + +// +// select linkage opt: +// +#if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK) +# define BOOST_LIB_PREFIX +#elif defined(BOOST_DYN_LINK) +# error "Mixing a dll boost library with a static runtime is a really bad idea..." +#else +# define BOOST_LIB_PREFIX "lib" +#endif + +// +// now include the lib: +// +#if defined(BOOST_LIB_NAME) \ + && defined(BOOST_LIB_PREFIX) \ + && defined(BOOST_LIB_TOOLSET) \ + && defined(BOOST_LIB_THREAD_OPT) \ + && defined(BOOST_LIB_RT_OPT) \ + && defined(BOOST_LIB_VERSION) + +#ifndef BOOST_AUTO_LINK_NOMANGLE +# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +# ifdef BOOST_LIB_DIAGNOSTIC +# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +# endif +#else +# pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") +# ifdef BOOST_LIB_DIAGNOSTIC +# pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") +# endif +#endif + +#else +# error "some required macros where not defined (internal logic error)." +#endif + + +#endif // _MSC_VER || __BORLANDC__ + +// +// finally undef any macros we may have set: +// +#ifdef BOOST_LIB_PREFIX +# undef BOOST_LIB_PREFIX +#endif +#if defined(BOOST_LIB_NAME) +# undef BOOST_LIB_NAME +#endif +// Don't undef this one: it can be set by the user and should be the +// same for all libraries: +//#if defined(BOOST_LIB_TOOLSET) +//# undef BOOST_LIB_TOOLSET +//#endif +#if defined(BOOST_LIB_THREAD_OPT) +# undef BOOST_LIB_THREAD_OPT +#endif +#if defined(BOOST_LIB_RT_OPT) +# undef BOOST_LIB_RT_OPT +#endif +#if defined(BOOST_LIB_LINK_OPT) +# undef BOOST_LIB_LINK_OPT +#endif +#if defined(BOOST_LIB_DEBUG_OPT) +# undef BOOST_LIB_DEBUG_OPT +#endif +#if defined(BOOST_DYN_LINK) +# undef BOOST_DYN_LINK +#endif +#if defined(BOOST_AUTO_LINK_NOMANGLE) +# undef BOOST_AUTO_LINK_NOMANGLE +#endif + + + + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/borland.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/borland.hpp new file mode 100644 index 0000000000..d16c06d069 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/borland.hpp @@ -0,0 +1,243 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. + +// Borland C++ compiler setup: + +// +// versions check: +// we don't support Borland prior to version 5.4: +#if __BORLANDC__ < 0x540 +# error "Compiler not supported or configured - please reconfigure" +#endif + +// last known and checked version is 0x600 (Builder X preview) +// or 0x593 (CodeGear C++ Builder 2007 December 2007 update): +#if (__BORLANDC__ > 0x593) && (__BORLANDC__ != 0x600) +//# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +//# else +//# pragma message( "Unknown compiler version - please run the configure tests and report the results") +//# endif +#elif (__BORLANDC__ == 0x600) +# error "CBuilderX preview compiler is no longer supported" +#endif + +// +// Support macros to help with standard library detection +#if (__BORLANDC__ < 0x560) || defined(_USE_OLD_RW_STL) +# define BOOST_BCB_WITH_ROGUE_WAVE +#elif __BORLANDC__ < 0x570 +# define BOOST_BCB_WITH_STLPORT +#else +# define BOOST_BCB_WITH_DINKUMWARE +#endif + +// +// Version 5.0 and below: +# if __BORLANDC__ <= 0x0550 +// Borland C++Builder 4 and 5: +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# if __BORLANDC__ == 0x0550 +// Borland C++Builder 5, command-line compiler 5.5: +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# endif +# endif + +// Version 5.51 and below: +#if (__BORLANDC__ <= 0x551) +# define BOOST_NO_CV_SPECIALIZATIONS +# define BOOST_NO_CV_VOID_SPECIALIZATIONS +# define BOOST_NO_DEDUCED_TYPENAME +// workaround for missing WCHAR_MAX/WCHAR_MIN: +#include +#include +#ifndef WCHAR_MAX +# define WCHAR_MAX 0xffff +#endif +#ifndef WCHAR_MIN +# define WCHAR_MIN 0 +#endif +#endif + +// Borland C++ Builder 6 and below: +#if (__BORLANDC__ <= 0x564) +# define BOOST_NO_INTEGRAL_INT64_T + +# ifdef NDEBUG + // fix broken so that Boost.test works: +# include +# undef strcmp +# endif + // fix broken errno declaration: +# include +# ifndef errno +# define errno errno +# endif + +#endif + +// +// new bug in 5.61: +#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x580) + // this seems to be needed by the command line compiler, but not the IDE: +# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS +#endif + +// Borland C++ Builder 2006 Update 2 and below: +#if (__BORLANDC__ <= 0x582) +# define BOOST_NO_SFINAE +# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG +# define BOOST_NO_TEMPLATE_TEMPLATES + +# define BOOST_NO_PRIVATE_IN_AGGREGATE + +# ifdef _WIN32 +# define BOOST_NO_SWPRINTF +# elif defined(linux) || defined(__linux__) || defined(__linux) + // we should really be able to do without this + // but the wcs* functions aren't imported into std:: +# define BOOST_NO_STDC_NAMESPACE + // _CPPUNWIND doesn't get automatically set for some reason: +# pragma defineonoption BOOST_CPPUNWIND -x +# endif +#endif + +// Borland C++ Builder 2007 December 2007 Update and below: +#if (__BORLANDC__ <= 0x593) + // we shouldn't really need this - but too many things choke + // without it, this needs more investigation: +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_NO_IS_ABSTRACT +# define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS + +// Temporary workaround +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif + +// Borland C++ Builder 2008 and below: +#if (__BORLANDC__ <= 0x601) +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +# define BOOST_ILLEGAL_CV_REFERENCES +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +# define BOOST_NO_USING_TEMPLATE +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +#endif + +// +// Positive Feature detection +// +// Borland C++ Builder 2008 and below: +#if (__BORLANDC__ >= 0x599) +# pragma defineonoption BOOST_CODEGEAR_0X_SUPPORT -Ax +#endif + +#if defined( BOOST_CODEGEAR_0X_SUPPORT ) +# #if __BORLANDC__ >= 0x610 +# define BOOST_HAS_ALIGNOF +# define BOOST_HAS_CHAR16_T +# define BOOST_HAS_CHAR32_T +# define BOOST_HAS_DECLTYPE +//# define BOOST_HAS_DEFAULTED_FN +//# define BOOST_HAS_DELETED_FN +# define BOOST_HAS_EXPLICIT_CONVERSION_OPS +//# define BOOST_HAS_NULLPTR +//# define BOOST_HAS_RAW_STRING +# define BOOST_HAS_REF_QUALIFIER +# define BOOST_HAS_RVALUE_REFS +//# define BOOST_HAS_SCOPED_ENUM +# define BOOST_HAS_STATIC_ASSERT +//# define BOOST_HAS_VARIADIC_TMPL +# #endif //__BORLANDC__ >= 0x610 +#endif + +#if __BORLANDC__ >= 0x590 +# define BOOST_HAS_TR1_HASH + +# define BOOST_HAS_MACRO_USE_FACET +#endif + +// +// Post 0x561 we have long long and stdint.h: +#if __BORLANDC__ >= 0x561 +# ifndef __NO_LONG_LONG +# define BOOST_HAS_LONG_LONG +# endif + // On non-Win32 platforms let the platform config figure this out: +# ifdef _WIN32 +# define BOOST_HAS_STDINT_H +# endif +#endif + +// Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is +// defined, then we have 0x560 or greater with the Rogue Wave implementation +// which presumably has the std::DBL_MAX bug. +#if defined( BOOST_BCB_WITH_ROGUE_WAVE ) +// is partly broken, some macros define symbols that are really in +// namespace std, so you end up having to use illegal constructs like +// std::DBL_MAX, as a fix we'll just include float.h and have done with: +#include +#endif +// +// __int64: +// +#if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__) +# define BOOST_HAS_MS_INT64 +#endif +// +// check for exception handling support: +// +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) +# define BOOST_NO_EXCEPTIONS +#endif +// +// all versions have a : +// +#ifndef __STRICT_ANSI__ +# define BOOST_HAS_DIRENT_H +#endif +// +// all versions support __declspec: +// +#ifndef __STRICT_ANSI__ +# define BOOST_HAS_DECLSPEC +#endif +// +// ABI fixing headers: +// +#if __BORLANDC__ < 0x600 // not implemented for version 6 compiler yet +#ifndef BOOST_ABI_PREFIX +# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" +#endif +#ifndef BOOST_ABI_SUFFIX +# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" +#endif +#endif +// +// Disable Win32 support in ANSI mode: +// +#if __BORLANDC__ < 0x600 +# pragma defineonoption BOOST_DISABLE_WIN32 -A +#elif defined(__STRICT_ANSI__) +# define BOOST_DISABLE_WIN32 +#endif +// +// MSVC compatibility mode does some nasty things: +// TODO: look up if this doesn't apply to the whole 12xx range +// +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_VOID_RETURNS +#endif + +#define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/codegear.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/codegear.hpp new file mode 100644 index 0000000000..d27817a94e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/codegear.hpp @@ -0,0 +1,135 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. + +// CodeGear C++ compiler setup: + +#if !defined( BOOST_WITH_CODEGEAR_WARNINGS ) +// these warnings occur frequently in optimized template code +# pragma warn -8004 // var assigned value, but never used +# pragma warn -8008 // condition always true/false +# pragma warn -8066 // dead code can never execute +# pragma warn -8104 // static members with ctors not threadsafe +# pragma warn -8105 // reference member in class without ctors +#endif +// +// versions check: +// last known and checked version is 0x610 +#if (__CODEGEARC__ > 0x610) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +# pragma message( "Unknown compiler version - please run the configure tests and report the results") +# endif +#endif + +// CodeGear C++ Builder 2009 +#if (__CODEGEARC__ <= 0x610) +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_PRIVATE_IN_AGGREGATE +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +# define BOOST_NO_USING_TEMPLATE + // we shouldn't really need this - but too many things choke + // without it, this needs more investigation: +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type +# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member + +// Temporary hack, until specific MPL preprocessed headers are generated +# define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +# ifdef NDEBUG + // fix broken so that Boost.test works: +# include +# undef strcmp +# endif + // fix broken errno declaration: +# include +# ifndef errno +# define errno errno +# endif + +#endif + + +# define BOOST_HAS_CHAR16_T +# define BOOST_HAS_CHAR32_T +# define BOOST_HAS_LONG_LONG + +//# define BOOST_HAS_ALIGNOF +# define BOOST_HAS_DECLTYPE +# define BOOST_HAS_EXPLICIT_CONVERSION_OPS +//# define BOOST_HAS_RVALUE_REFS +# define BOOST_HAS_SCOPED_ENUM +//# define BOOST_HAS_STATIC_ASSERT +# define BOOST_HAS_STD_TYPE_TRAITS + +# define BOOST_HAS_TR1_HASH +# define BOOST_HAS_TR1_TYPE_TRAITS +# define BOOST_HAS_TR1_UNORDERED_MAP +# define BOOST_HAS_TR1_UNORDERED_SET + +# define BOOST_HAS_MACRO_USE_FACET + + + // On non-Win32 platforms let the platform config figure this out: +# ifdef _WIN32 +# define BOOST_HAS_STDINT_H +# endif + +// +// __int64: +// +#if !defined(__STRICT_ANSI__) +# define BOOST_HAS_MS_INT64 +#endif +// +// check for exception handling support: +// +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) +# define BOOST_NO_EXCEPTIONS +#endif +// +// all versions have a : +// +#if !defined(__STRICT_ANSI__) +# define BOOST_HAS_DIRENT_H +#endif +// +// all versions support __declspec: +// +#if !defined(__STRICT_ANSI__) +# define BOOST_HAS_DECLSPEC +#endif +// +// ABI fixing headers: +// +#ifndef BOOST_ABI_PREFIX +# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" +#endif +#ifndef BOOST_ABI_SUFFIX +# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" +#endif +// +// Disable Win32 support in ANSI mode: +// +# pragma defineonoption BOOST_DISABLE_WIN32 -A +// +// MSVC compatibility mode does some nasty things: +// TODO: look up if this doesn't apply to the whole 12xx range +// +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_VOID_RETURNS +#endif + +#define BOOST_COMPILER "CodeGear C++ version " BOOST_STRINGIZE(__CODEGEARC__) + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/comeau.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/comeau.hpp new file mode 100644 index 0000000000..278222dcfd --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/comeau.hpp @@ -0,0 +1,59 @@ +// (C) Copyright John Maddock 2001. +// (C) Copyright Douglas Gregor 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Aleksey Gurtovoy 2003. +// (C) Copyright Beman Dawes 2003. +// (C) Copyright Jens Maurer 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 for most recent version. + +// Comeau C++ compiler setup: + +#include "boost/config/compiler/common_edg.hpp" + +#if (__COMO_VERSION__ <= 4245) + +# if defined(_MSC_VER) && _MSC_VER <= 1300 +# if _MSC_VER > 100 + // only set this in non-strict mode: +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# endif +# endif + +// Void returns don't work when emulating VC 6 (Peter Dimov) +// TODO: look up if this doesn't apply to the whole 12xx range +# if defined(_MSC_VER) && (_MSC_VER < 1300) +# define BOOST_NO_VOID_RETURNS +# endif + +#endif // version 4245 + +// +// enable __int64 support in VC emulation mode +// +# if defined(_MSC_VER) && (_MSC_VER >= 1200) +# define BOOST_HAS_MS_INT64 +# endif + +#define BOOST_COMPILER "Comeau compiler version " BOOST_STRINGIZE(__COMO_VERSION__) + +// +// versions check: +// we don't know Comeau prior to version 4245: +#if __COMO_VERSION__ < 4245 +# error "Compiler not configured - please reconfigure" +#endif +// +// last known and checked version is 4245: +#if (__COMO_VERSION__ > 4245) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/common_edg.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/common_edg.hpp new file mode 100644 index 0000000000..0443be1aea --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/common_edg.hpp @@ -0,0 +1,62 @@ +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Aleksey Gurtovoy 2002. +// (C) Copyright Markus Schoepflin 2005. +// 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 for most recent version. + +// +// Options common to all edg based compilers. +// +// This is included from within the individual compiler mini-configs. + +#ifndef __EDG_VERSION__ +# error This file requires that __EDG_VERSION__ be defined. +#endif + +#if (__EDG_VERSION__ <= 238) +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_SFINAE +#endif + +#if (__EDG_VERSION__ <= 240) +# define BOOST_NO_VOID_RETURNS +#endif + +#if (__EDG_VERSION__ <= 241) && !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +#endif + +#if (__EDG_VERSION__ <= 244) && !defined(BOOST_NO_TEMPLATE_TEMPLATES) +# define BOOST_NO_TEMPLATE_TEMPLATES +#endif + +#if (__EDG_VERSION__ < 300) && !defined(BOOST_NO_IS_ABSTRACT) +# define BOOST_NO_IS_ABSTRACT +#endif + +#if (__EDG_VERSION__ <= 303) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#endif + +// See also kai.hpp which checks a Kai-specific symbol for EH +# if !defined(__KCC) && !defined(__EXCEPTIONS) +# define BOOST_NO_EXCEPTIONS +# endif + +# if !defined(__NO_LONG_LONG) +# define BOOST_HAS_LONG_LONG +# endif + +#ifdef c_plusplus +// EDG has "long long" in non-strict mode +// However, some libraries have insufficient "long long" support +// #define BOOST_HAS_LONG_LONG +#endif + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/compaq_cxx.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/compaq_cxx.hpp new file mode 100644 index 0000000000..b44486c673 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/compaq_cxx.hpp @@ -0,0 +1,19 @@ +// (C) Copyright John Maddock 2001 - 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 for most recent version. + +// Tru64 C++ compiler setup (now HP): + +#define BOOST_COMPILER "HP Tru64 C++ " BOOST_STRINGIZE(__DECCXX_VER) + +#include "boost/config/compiler/common_edg.hpp" + +// +// versions check: +// Nothing to do here? + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/digitalmars.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/digitalmars.hpp new file mode 100644 index 0000000000..46848479b7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/digitalmars.hpp @@ -0,0 +1,67 @@ +// Copyright (C) Christof Meerwald 2003 +// Copyright (C) Dan Watkins 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) + +// Digital Mars C++ compiler setup: +#define BOOST_COMPILER __DMC_VERSION_STRING__ + +#define BOOST_HAS_LONG_LONG +#define BOOST_HAS_PRAGMA_ONCE + +#if (__DMC__ <= 0x833) +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_NO_TEMPLATE_TEMPLATES +#define BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING +#define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +#define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +#endif +#if (__DMC__ <= 0x840) || !defined(BOOST_STRICT_CONFIG) +#define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +#define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +#define BOOST_NO_OPERATORS_IN_NAMESPACE +#define BOOST_NO_UNREACHABLE_RETURN_DETECTION +#define BOOST_NO_SFINAE +#define BOOST_NO_USING_TEMPLATE +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#endif + +// +// has macros: +#if (__DMC__ >= 0x840) +#define BOOST_HAS_DIRENT_H +#define BOOST_HAS_STDINT_H +#define BOOST_HAS_WINTHREADS +#endif + +#if (__DMC__ >= 0x847) +#define BOOST_HAS_EXPM1 +#define BOOST_HAS_LOG1P +#endif + +// +// Is this really the best way to detect whether the std lib is in namespace std? +// +#include +#if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD) +# define BOOST_NO_STDC_NAMESPACE +#endif + + +// check for exception handling support: +#ifndef _CPPUNWIND +# define BOOST_NO_EXCEPTIONS +#endif + +#if __DMC__ < 0x800 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is ...: +#if (__DMC__ > 0x848) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/gcc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/gcc.hpp new file mode 100644 index 0000000000..27df829b24 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/gcc.hpp @@ -0,0 +1,158 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001 - 2002. +// (C) Copyright Jens Maurer 2001 - 2002. +// (C) Copyright Beman Dawes 2001 - 2003. +// (C) Copyright Douglas Gregor 2002. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Synge Todo 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 for most recent version. + +// GNU C++ compiler setup: + +#if __GNUC__ < 3 +# if __GNUC_MINOR__ == 91 + // egcs 1.1 won't parse shared_ptr.hpp without this: +# define BOOST_NO_AUTO_PTR +# endif +# if __GNUC_MINOR__ < 95 + // + // Prior to gcc 2.95 member templates only partly + // work - define BOOST_MSVC6_MEMBER_TEMPLATES + // instead since inline member templates mostly work. + // +# define BOOST_NO_MEMBER_TEMPLATES +# if __GNUC_MINOR__ >= 9 +# define BOOST_MSVC6_MEMBER_TEMPLATES +# endif +# endif + +# if __GNUC_MINOR__ < 96 +# define BOOST_NO_SFINAE +# endif + +# if __GNUC_MINOR__ <= 97 +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# endif + +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +# define BOOST_NO_IS_ABSTRACT +#elif __GNUC__ == 3 +# if defined (__PATHSCALE__) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +# define BOOST_NO_IS_ABSTRACT +# endif + // + // gcc-3.x problems: + // + // Bug specific to gcc 3.1 and 3.2: + // +# if ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2)) +# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +# endif +# if __GNUC_MINOR__ < 4 +# define BOOST_NO_IS_ABSTRACT +# endif +#endif +#if __GNUC__ < 4 +// +// All problems to gcc-3.x and earlier here: +// +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +#ifndef __EXCEPTIONS +# define BOOST_NO_EXCEPTIONS +#endif + + +// +// Threading support: Turn this on unconditionally here (except for +// those platforms where we can know for sure). It will get turned off again +// later if no threading API is detected. +// +#if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__) +# define BOOST_HAS_THREADS +#endif + +// +// gcc has "long long" +// +#define BOOST_HAS_LONG_LONG + +// +// gcc implements the named return value optimization since version 3.1 +// +#if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) +#define BOOST_HAS_NRVO +#endif +// +// RTTI and typeinfo detection is possible post gcc-4.3: +// +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 403 +# ifndef __GXX_RTTI +# define BOOST_NO_TYPEID +# define BOOST_NO_RTTI +# endif +#endif + +// +// C++0x features +// +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) +// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are +// passed on the command line, which in turn defines +// __GXX_EXPERIMENTAL_CXX0X__. +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_HAS_STATIC_ASSERT +# define BOOST_HAS_VARIADIC_TMPL +# define BOOST_HAS_RVALUE_REFS +# define BOOST_HAS_DECLTYPE +# endif +#endif + +// +// Potential C++0x features +// + +// Variadic templates compiler: +// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html +#ifdef __VARIADIC_TEMPLATES +# define BOOST_HAS_VARIADIC_TMPL +#endif + +// ConceptGCC compiler: +// http://www.generic-programming.org/software/ConceptGCC/ +#ifdef __GXX_CONCEPTS__ +# define BOOST_HAS_CONCEPTS +# define BOOST_COMPILER "ConceptGCC version " __VERSION__ +#endif + +#ifndef BOOST_COMPILER +# define BOOST_COMPILER "GNU C++ version " __VERSION__ +#endif + +// +// versions check: +// we don't know gcc prior to version 2.90: +#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90) +# error "Compiler not configured - please reconfigure" +#endif +// +// last known and checked version is 4.3 (Pre-release): +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 3)) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +// we don't emit warnings here anymore since there are no defect macros defined for +// gcc post 3.4, so any failures are gcc regressions... +//# warning "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/gcc_xml.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/gcc_xml.hpp new file mode 100644 index 0000000000..5dd67c7604 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/gcc_xml.hpp @@ -0,0 +1,30 @@ +// (C) Copyright John Maddock 2006. +// 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 for most recent version. + +// GCC-XML C++ compiler setup: + +# if !defined(__GCCXML_GNUC__) || ((__GCCXML_GNUC__ <= 3) && (__GCCXML_GNUC_MINOR__ <= 3)) +# define BOOST_NO_IS_ABSTRACT +# endif + +// +// Threading support: Turn this on unconditionally here (except for +// those platforms where we can know for sure). It will get turned off again +// later if no threading API is detected. +// +#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(linux) && !defined(__linux) && !defined(__linux__) +# define BOOST_HAS_THREADS +#endif + +// +// gcc has "long long" +// +#define BOOST_HAS_LONG_LONG + +#define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/greenhills.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/greenhills.hpp new file mode 100644 index 0000000000..038b6b2b52 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/greenhills.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2001. +// 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 for most recent version. + +// Greenhills C++ compiler setup: + +#define BOOST_COMPILER "Greenhills C++ version " BOOST_STRINGIZE(__ghs) + +#include "boost/config/compiler/common_edg.hpp" + +// +// versions check: +// we don't support Greenhills prior to version 0: +#if __ghs < 0 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0: +#if (__ghs > 0) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/hp_acc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/hp_acc.hpp new file mode 100644 index 0000000000..5a766c590c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/hp_acc.hpp @@ -0,0 +1,95 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Toon Knapen 2003. +// (C) Copyright Boris Gubenko 2006 - 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for most recent version. + +// HP aCC C++ compiler setup: + +#if defined(__EDG__) +#include "boost/config/compiler/common_edg.hpp" +#endif + +#if (__HP_aCC <= 33100) +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# if !defined(_NAMESPACE_STD) +# define BOOST_NO_STD_LOCALE +# define BOOST_NO_STRINGSTREAM +# endif +#endif + +#if (__HP_aCC <= 33300) +// member templates are sufficiently broken that we disable them for now +# define BOOST_NO_MEMBER_TEMPLATES +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +#endif + +#if (__HP_aCC <= 38000) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +#if (__HP_aCC > 50000) && (__HP_aCC < 60000) +# define BOOST_NO_UNREACHABLE_RETURN_DETECTION +# define BOOST_NO_TEMPLATE_TEMPLATES +# define BOOST_NO_SWPRINTF +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_IS_ABSTRACT +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +#endif + +// optional features rather than defects: +#if (__HP_aCC >= 33900) +# define BOOST_HAS_LONG_LONG +# define BOOST_HAS_PARTIAL_STD_ALLOCATOR +#endif + +#if (__HP_aCC >= 50000 ) && (__HP_aCC <= 53800 ) || (__HP_aCC < 31300 ) +# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD +#endif + +// This macro should not be defined when compiling in strict ansi +// mode, but, currently, we don't have the ability to determine +// what standard mode we are compiling with. Some future version +// of aCC6 compiler will provide predefined macros reflecting the +// compilation options, including the standard mode. +#if (__HP_aCC >= 60000) || ((__HP_aCC > 38000) && defined(__hpxstd98)) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +#define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC) + +// +// versions check: +// we don't support HP aCC prior to version 33000: +#if __HP_aCC < 33000 +# error "Compiler not supported or configured - please reconfigure" +#endif + +// +// Extended checks for supporting aCC on PA-RISC +#if __HP_aCC > 30000 && __HP_aCC < 50000 +# if __HP_aCC < 38000 + // versions prior to version A.03.80 not supported +# error "Compiler version not supported - version A.03.80 or higher is required" +# elif !defined(__hpxstd98) + // must compile using the option +hpxstd98 with version A.03.80 and above +# error "Compiler option '+hpxstd98' is required for proper support" +# endif //PA-RISC +#endif + +// +// last known and checked version for HP-UX/ia64 is 61300 +// last known and checked version for PA-RISC is 38000 +#if ((__HP_aCC > 61300) || ((__HP_aCC > 38000) && defined(__hpxstd98))) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/intel.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/intel.hpp new file mode 100644 index 0000000000..bc3d4e99a3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/intel.hpp @@ -0,0 +1,173 @@ +// (C) Copyright John Maddock 2001-8. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002 - 2003. +// (C) Copyright Guillaume Melquiond 2002 - 2003. +// (C) Copyright Beman Dawes 2003. +// (C) Copyright Martin Wille 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 for most recent version. + +// Intel compiler setup: + +#include "boost/config/compiler/common_edg.hpp" + +#if defined(__INTEL_COMPILER) +# define BOOST_INTEL_CXX_VERSION __INTEL_COMPILER +#elif defined(__ICL) +# define BOOST_INTEL_CXX_VERSION __ICL +#elif defined(__ICC) +# define BOOST_INTEL_CXX_VERSION __ICC +#elif defined(__ECC) +# define BOOST_INTEL_CXX_VERSION __ECC +#endif + +#define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(BOOST_INTEL_CXX_VERSION) +#define BOOST_INTEL BOOST_INTEL_CXX_VERSION + +#if defined(_WIN32) || defined(_WIN64) +# define BOOST_INTEL_WIN BOOST_INTEL +#else +# define BOOST_INTEL_LINUX BOOST_INTEL +#endif + +#if (BOOST_INTEL_CXX_VERSION <= 500) && defined(_MSC_VER) +# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +# define BOOST_NO_TEMPLATE_TEMPLATES +#endif + +#if (BOOST_INTEL_CXX_VERSION <= 600) + +# if defined(_MSC_VER) && (_MSC_VER <= 1300) // added check for <= VC 7 (Peter Dimov) + +// Boost libraries assume strong standard conformance unless otherwise +// indicated by a config macro. As configured by Intel, the EDG front-end +// requires certain compiler options be set to achieve that strong conformance. +// Particularly /Qoption,c,--arg_dep_lookup (reported by Kirk Klobe & Thomas Witt) +// and /Zc:wchar_t,forScope. See boost-root/tools/build/intel-win32-tools.jam for +// details as they apply to particular versions of the compiler. When the +// compiler does not predefine a macro indicating if an option has been set, +// this config file simply assumes the option has been set. +// Thus BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP will not be defined, even if +// the compiler option is not enabled. + +# define BOOST_NO_SWPRINTF +# endif + +// Void returns, 64 bit integrals don't work when emulating VC 6 (Peter Dimov) + +# if defined(_MSC_VER) && (_MSC_VER <= 1200) +# define BOOST_NO_VOID_RETURNS +# define BOOST_NO_INTEGRAL_INT64_T +# endif + +#endif + +#if (BOOST_INTEL_CXX_VERSION <= 710) && defined(_WIN32) +# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS +#endif + +// See http://aspn.activestate.com/ASPN/Mail/Message/boost/1614864 +#if BOOST_INTEL_CXX_VERSION < 600 +# define BOOST_NO_INTRINSIC_WCHAR_T +#else +// We should test the macro _WCHAR_T_DEFINED to check if the compiler +// supports wchar_t natively. *BUT* there is a problem here: the standard +// headers define this macro if they typedef wchar_t. Anyway, we're lucky +// because they define it without a value, while Intel C++ defines it +// to 1. So we can check its value to see if the macro was defined natively +// or not. +// Under UNIX, the situation is exactly the same, but the macro _WCHAR_T +// is used instead. +# if ((_WCHAR_T_DEFINED + 0) == 0) && ((_WCHAR_T + 0) == 0) +# define BOOST_NO_INTRINSIC_WCHAR_T +# endif +#endif + +#if defined(__GNUC__) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) +// +// Figure out when Intel is emulating this gcc bug +// (All Intel versions prior to 9.0.26, and versions +// later than that if they are set up to emulate gcc 3.2 +// or earlier): +// +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL < 900) || (__INTEL_COMPILER_BUILD_DATE < 20050912) +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +# endif +#endif +#if (defined(__GNUC__) && (__GNUC__ < 4)) || defined(_WIN32) +// GCC or VC emulation: +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif +// +// Verify that we have actually got BOOST_NO_INTRINSIC_WCHAR_T +// set correctly, if we don't do this now, we will get errors later +// in type_traits code among other things, getting this correct +// for the Intel compiler is actually remarkably fragile and tricky: +// +#if defined(BOOST_NO_INTRINSIC_WCHAR_T) +#include +template< typename T > struct assert_no_intrinsic_wchar_t; +template<> struct assert_no_intrinsic_wchar_t { typedef void type; }; +// if you see an error here then you need to unset BOOST_NO_INTRINSIC_WCHAR_T +// where it is defined above: +typedef assert_no_intrinsic_wchar_t::type assert_no_intrinsic_wchar_t_; +#else +template< typename T > struct assert_intrinsic_wchar_t; +template<> struct assert_intrinsic_wchar_t {}; +// if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line: +template<> struct assert_intrinsic_wchar_t {}; +#endif + +#if _MSC_VER+0 >= 1000 +# if _MSC_VER >= 1200 +# define BOOST_HAS_MS_INT64 +# endif +# define BOOST_NO_SWPRINTF +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#elif defined(_WIN32) +# define BOOST_DISABLE_WIN32 +#endif + +// I checked version 6.0 build 020312Z, it implements the NRVO. +// Correct this as you find out which version of the compiler +// implemented the NRVO first. (Daniel Frey) +#if (BOOST_INTEL_CXX_VERSION >= 600) +# define BOOST_HAS_NRVO +#endif + +// +// versions check: +// we don't support Intel prior to version 5.0: +#if BOOST_INTEL_CXX_VERSION < 500 +# error "Compiler not supported or configured - please reconfigure" +#endif + +// Intel on MacOS requires +#if defined(__APPLE__) && defined(__INTEL_COMPILER) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +// Intel on Altix Itanium +#if defined(__itanium__) && defined(__INTEL_COMPILER) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +// +// last known and checked version: +#if (BOOST_INTEL_CXX_VERSION > 1010) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# elif defined(_MSC_VER) +// +// We don't emit this warning any more, since we have so few +// defect macros set anyway (just the one). +// +//# pragma message("Unknown compiler version - please run the configure tests and report the results") +# endif +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/kai.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/kai.hpp new file mode 100644 index 0000000000..de16f1a675 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/kai.hpp @@ -0,0 +1,35 @@ +// (C) Copyright John Maddock 2001. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. + +// Kai C++ compiler setup: + +#include "boost/config/compiler/common_edg.hpp" + +# if (__KCC_VERSION <= 4001) || !defined(BOOST_STRICT_CONFIG) + // at least on Sun, the contents of is not in namespace std +# define BOOST_NO_STDC_NAMESPACE +# endif + +// see also common_edg.hpp which needs a special check for __KCC +# if !defined(_EXCEPTIONS) +# define BOOST_NO_EXCEPTIONS +# endif + +#define BOOST_COMPILER "Kai C++ version " BOOST_STRINGIZE(__KCC_VERSION) + +// +// last known and checked version is 4001: +#if (__KCC_VERSION > 4001) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/metrowerks.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/metrowerks.hpp new file mode 100644 index 0000000000..2b60b56f7f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/metrowerks.hpp @@ -0,0 +1,111 @@ +// (C) Copyright John Maddock 2001. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright David Abrahams 2001 - 2002. +// (C) Copyright Beman Dawes 2001 - 2003. +// (C) Copyright Stefan Slapeta 2004. +// 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 for most recent version. + +// Metrowerks C++ compiler setup: + +// locale support is disabled when linking with the dynamic runtime +# ifdef _MSL_NO_LOCALE +# define BOOST_NO_STD_LOCALE +# endif + +# if __MWERKS__ <= 0x2301 // 5.3 +# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# define BOOST_NO_POINTER_TO_MEMBER_CONST +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD +# endif + +# if __MWERKS__ <= 0x2401 // 6.2 +//# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# endif + +# if(__MWERKS__ <= 0x2407) // 7.x +# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS +# define BOOST_NO_UNREACHABLE_RETURN_DETECTION +# endif + +# if(__MWERKS__ <= 0x3003) // 8.x +# define BOOST_NO_SFINAE +# endif + +// the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last +// tested version *only*: +# if(__MWERKS__ <= 0x3206) || !defined(BOOST_STRICT_CONFIG) // 9.5 +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_IS_ABSTRACT +# endif + +#if !__option(wchar_type) +# define BOOST_NO_INTRINSIC_WCHAR_T +#endif + +#if !__option(exceptions) +# define BOOST_NO_EXCEPTIONS +#endif + +#if (__INTEL__ && _WIN32) || (__POWERPC__ && macintosh) +# if __MWERKS__ == 0x3000 +# define BOOST_COMPILER_VERSION 8.0 +# elif __MWERKS__ == 0x3001 +# define BOOST_COMPILER_VERSION 8.1 +# elif __MWERKS__ == 0x3002 +# define BOOST_COMPILER_VERSION 8.2 +# elif __MWERKS__ == 0x3003 +# define BOOST_COMPILER_VERSION 8.3 +# elif __MWERKS__ == 0x3200 +# define BOOST_COMPILER_VERSION 9.0 +# elif __MWERKS__ == 0x3201 +# define BOOST_COMPILER_VERSION 9.1 +# elif __MWERKS__ == 0x3202 +# define BOOST_COMPILER_VERSION 9.2 +# elif __MWERKS__ == 0x3204 +# define BOOST_COMPILER_VERSION 9.3 +# elif __MWERKS__ == 0x3205 +# define BOOST_COMPILER_VERSION 9.4 +# elif __MWERKS__ == 0x3206 +# define BOOST_COMPILER_VERSION 9.5 +# else +# define BOOST_COMPILER_VERSION __MWERKS__ +# endif +#else +# define BOOST_COMPILER_VERSION __MWERKS__ +#endif + +// +// C++0x features +// +#if __MWERKS__ > 0x3206 && __option(rvalue_refs) +# define BOOST_HAS_RVALUE_REFS +#endif + +#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) + +// +// versions check: +// we don't support Metrowerks prior to version 5.3: +#if __MWERKS__ < 0x2301 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version: +#if (__MWERKS__ > 0x3205) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/mpw.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/mpw.hpp new file mode 100644 index 0000000000..8ab2aacb6e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/mpw.hpp @@ -0,0 +1,51 @@ +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. + +// MPW C++ compilers setup: + +# if defined(__SC__) +# define BOOST_COMPILER "MPW SCpp version " BOOST_STRINGIZE(__SC__) +# elif defined(__MRC__) +# define BOOST_COMPILER "MPW MrCpp version " BOOST_STRINGIZE(__MRC__) +# else +# error "Using MPW compiler configuration by mistake. Please update." +# endif + +// +// MPW 8.90: +// +#if (MPW_CPLUS <= 0x890) || !defined(BOOST_STRICT_CONFIG) +# define BOOST_NO_CV_SPECIALIZATIONS +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_INTRINSIC_WCHAR_T +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# define BOOST_NO_USING_TEMPLATE + +# define BOOST_NO_CWCHAR +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + +# define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */ +#endif + +// +// versions check: +// we don't support MPW prior to version 8.9: +#if MPW_CPLUS < 0x890 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0x890: +#if (MPW_CPLUS > 0x890) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/pgi.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/pgi.hpp new file mode 100644 index 0000000000..41f29c75fd --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/pgi.hpp @@ -0,0 +1,33 @@ +// (C) Copyright Noel Belcourt 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for most recent version. + +// PGI C++ compiler setup: + +#define BOOST_COMPILER_VERSION __PGIC__##__PGIC_MINOR__ +#define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) + +// +// Threading support: +// Turn this on unconditionally here, it will get turned off again later +// if no threading API is detected. +// + +#if (__PGIC__ >= 7) + +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_SWPRINTF + +#else + +# error "Pgi compiler not configured - please reconfigure" + +#endif +// +// version check: +// probably nothing to do here? + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/sgi_mipspro.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/sgi_mipspro.hpp new file mode 100644 index 0000000000..33e97e9af3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/sgi_mipspro.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2001 - 2002. +// 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 for most recent version. + +// SGI C++ compiler setup: + +#define BOOST_COMPILER "SGI Irix compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) + +#include "boost/config/compiler/common_edg.hpp" + +// +// Threading support: +// Turn this on unconditionally here, it will get turned off again later +// if no threading API is detected. +// +#define BOOST_HAS_THREADS +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP + +#undef BOOST_NO_SWPRINTF +#undef BOOST_DEDUCED_TYPENAME +// +// version check: +// probably nothing to do here? + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/sunpro_cc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/sunpro_cc.hpp new file mode 100644 index 0000000000..f513c2dce8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/sunpro_cc.hpp @@ -0,0 +1,103 @@ +// (C) Copyright John Maddock 2001. +// (C) Copyright Jens Maurer 2001 - 2003. +// (C) Copyright Peter Dimov 2002. +// (C) Copyright Aleksey Gurtovoy 2002 - 2003. +// (C) Copyright David Abrahams 2002. +// 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 for most recent version. + +// Sun C++ compiler setup: + +# if __SUNPRO_CC <= 0x500 +# define BOOST_NO_MEMBER_TEMPLATES +# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# endif + +# if (__SUNPRO_CC <= 0x520) + // + // Sunpro 5.2 and earler: + // + // although sunpro 5.2 supports the syntax for + // inline initialization it often gets the value + // wrong, especially where the value is computed + // from other constants (J Maddock 6th May 2001) +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION + + // Although sunpro 5.2 supports the syntax for + // partial specialization, it often seems to + // bind to the wrong specialization. Better + // to disable it until suppport becomes more stable + // (J Maddock 6th May 2001). +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# endif + +# if (__SUNPRO_CC <= 0x530) + // Requesting debug info (-g) with Boost.Python results + // in an internal compiler error for "static const" + // initialized in-class. + // >> Assertion: (../links/dbg_cstabs.cc, line 611) + // while processing ../test.cpp at line 0. + // (Jens Maurer according to Gottfried Ganssauge 04 Mar 2002) +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION + + // SunPro 5.3 has better support for partial specialization, + // but breaks when compiling std::less > + // (Jens Maurer 4 Nov 2001). + + // std::less specialization fixed as reported by George + // Heintzelman; partial specialization re-enabled + // (Peter Dimov 17 Jan 2002) + +//# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // integral constant expressions with 64 bit numbers fail +# define BOOST_NO_INTEGRAL_INT64_T +# endif + +# if (__SUNPRO_CC < 0x570) +# define BOOST_NO_TEMPLATE_TEMPLATES + // see http://lists.boost.org/MailArchives/boost/msg47184.php + // and http://lists.boost.org/MailArchives/boost/msg47220.php +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_SFINAE +# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +# endif +# if (__SUNPRO_CC <= 0x580) +# define BOOST_NO_IS_ABSTRACT +# endif + +// +// Issues that effect all known versions: +// +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_ADL_BARRIER + +#if(__SUNPRO_CC >= 0x590) +# define BOOST_HAS_LONG_LONG +#endif + + +#define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) + +// +// versions check: +// we don't support sunpro prior to version 4: +#if __SUNPRO_CC < 0x400 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0x590: +#if (__SUNPRO_CC > 0x590) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/vacpp.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/vacpp.hpp new file mode 100644 index 0000000000..826939f120 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/vacpp.hpp @@ -0,0 +1,60 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Toon Knapen 2001 - 2003. +// (C) Copyright Lie-Quan Lee 2001. +// (C) Copyright Markus Schoepflin 2002 - 2003. +// (C) Copyright Beman Dawes 2002 - 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 for most recent version. + +// Visual Age (IBM) C++ compiler setup: + +#if __IBMCPP__ <= 501 +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS +#endif + +#if (__IBMCPP__ <= 502) +// Actually the compiler supports inclass member initialization but it +// requires a definition for the class member and it doesn't recognize +// it as an integral constant expression when used as a template argument. +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD +#endif + +#if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG) +# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS +#endif + +// +// On AIX thread support seems to be indicated by _THREAD_SAFE: +// +#ifdef _THREAD_SAFE +# define BOOST_HAS_THREADS +#endif + +#define BOOST_COMPILER "IBM Visual Age version " BOOST_STRINGIZE(__IBMCPP__) + +// +// versions check: +// we don't support Visual age prior to version 5: +#if __IBMCPP__ < 500 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 600: +#if (__IBMCPP__ > 600) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + +// Some versions of the compiler have issues with default arguments on partial specializations +#define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/visualc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/visualc.hpp new file mode 100644 index 0000000000..187591be9d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/compiler/visualc.hpp @@ -0,0 +1,199 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001 - 2002. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Aleksey Gurtovoy 2002. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Beman Dawes 2002 - 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 for most recent version. + +// Microsoft Visual C++ compiler setup: + +#define BOOST_MSVC _MSC_VER + +// turn off the warnings before we #include anything +#pragma warning( disable : 4503 ) // warning: decorated name length exceeded + +#if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4 +# pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_VOID_RETURNS +# define BOOST_NO_EXCEPTION_STD_NAMESPACE + // disable min/max macro defines on vc6: + // +#endif + +#if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 + +# if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# endif + +# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_PRIVATE_IN_AGGREGATE +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_DEDUCED_TYPENAME +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE + +// VC++ 6/7 has member templates but they have numerous problems including +// cases of silent failure, so for safety we define: +# define BOOST_NO_MEMBER_TEMPLATES +// For VC++ experts wishing to attempt workarounds, we define: +# define BOOST_MSVC6_MEMBER_TEMPLATES + +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# define BOOST_NO_CV_VOID_SPECIALIZATIONS +# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# define BOOST_NO_USING_TEMPLATE +# define BOOST_NO_SWPRINTF +# define BOOST_NO_TEMPLATE_TEMPLATES +# define BOOST_NO_SFINAE +# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS +# define BOOST_NO_IS_ABSTRACT +# define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS +// TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? +# if (_MSC_VER > 1200) +# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS +# endif + +#endif + +#if _MSC_VER < 1400 +// although a conforming signature for swprint exists in VC7.1 +// it appears not to actually work: +# define BOOST_NO_SWPRINTF +#endif + +#if defined(UNDER_CE) +// Windows CE does not have a conforming signature for swprintf +# define BOOST_NO_SWPRINTF +#endif + +#if _MSC_VER <= 1400 // 1400 == VC++ 8.0 +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +#endif + +#if _MSC_VER <= 1500 // 1500 == VC++ 9.0 +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +#if _MSC_VER == 1500 // 1500 == VC++ 9.0 + // A bug in VC9: +# define BOOST_NO_ADL_BARRIER +#endif + +#ifndef _NATIVE_WCHAR_T_DEFINED +# define BOOST_NO_INTRINSIC_WCHAR_T +#endif + +#if defined(_WIN32_WCE) || defined(UNDER_CE) +# define BOOST_NO_THREADEX +# define BOOST_NO_GETSYSTEMTIMEASFILETIME +# define BOOST_NO_SWPRINTF +#endif + +// +// check for exception handling support: +#ifndef _CPPUNWIND +# define BOOST_NO_EXCEPTIONS +#endif + +// +// __int64 support: +// +#if (_MSC_VER >= 1200) +# define BOOST_HAS_MS_INT64 +#endif +#if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) +# define BOOST_HAS_LONG_LONG +#endif +#if (_MSC_VER >= 1400) && !defined(_DEBUG) +# define BOOST_HAS_NRVO +#endif +// +// disable Win32 API's if compiler extentions are +// turned off: +// +#ifndef _MSC_EXTENSIONS +# define BOOST_DISABLE_WIN32 +#endif +#ifndef _CPPRTTI +# define BOOST_NO_RTTI +#endif + +// +// all versions support __declspec: +// +#define BOOST_HAS_DECLSPEC +// +// prefix and suffix headers: +// +#ifndef BOOST_ABI_PREFIX +# define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp" +#endif +#ifndef BOOST_ABI_SUFFIX +# define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" +#endif + +// TODO: +// these things are mostly bogus. 1200 means version 12.0 of the compiler. The +// artificial versions assigned to them only refer to the versions of some IDE +// these compilers have been shipped with, and even that is not all of it. Some +// were shipped with freely downloadable SDKs, others as crosscompilers in eVC. +// IOW, you can't use these 'versions' in any sensible way. Sorry. +# if defined(UNDER_CE) +# if _MSC_VER < 1200 + // Note: these are so far off, they are not really supported +# elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 +# define BOOST_COMPILER_VERSION evc4.0 +# elif _MSC_VER == 1400 +# define BOOST_COMPILER_VERSION evc8 +# else +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown EVC++ compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") +# endif +# endif +# else +# if _MSC_VER < 1200 + // Note: these are so far off, they are not really supported +# define BOOST_COMPILER_VERSION 5.0 +# elif _MSC_VER < 1300 +# define BOOST_COMPILER_VERSION 6.0 +# elif _MSC_VER == 1300 +# define BOOST_COMPILER_VERSION 7.0 +# elif _MSC_VER == 1310 +# define BOOST_COMPILER_VERSION 7.1 +# elif _MSC_VER == 1400 +# define BOOST_COMPILER_VERSION 8.0 +# elif _MSC_VER == 1500 +# define BOOST_COMPILER_VERSION 9.0 +# else +# define BOOST_COMPILER_VERSION _MSC_VER +# endif +# endif + +#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) + +// +// versions check: +// we don't support Visual C++ prior to version 6: +#if _MSC_VER < 1200 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 1500 (VC9): +#if (_MSC_VER > 1500) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown compiler version - please run the configure tests and report the results") +# endif +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/cmath.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/cmath.hpp new file mode 100644 index 0000000000..d8268d842a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/cmath.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2008. +// 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) +// +// The aim of this header is just to include but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/cmath is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_CMATH +# define BOOST_CONFIG_CMATH + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_CMATH_RECURSION +# endif + +# include + +# ifdef BOOST_CONFIG_NO_CMATH_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_CMATH_RECURSION +# endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/complex.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/complex.hpp new file mode 100644 index 0000000000..ca200922b3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/complex.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/complex is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_COMPLEX +# define BOOST_CONFIG_COMPLEX + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_COMPLEX_RECURSION +# endif + +# include + +# ifdef BOOST_CONFIG_NO_COMPLEX_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_COMPLEX_RECURSION +# endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/functional.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/functional.hpp new file mode 100644 index 0000000000..e395efc197 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/functional.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/functional is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_FUNCTIONAL +# define BOOST_CONFIG_FUNCTIONAL + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_FUNCTIONAL_RECURSION +# endif + +# include + +# ifdef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION +# endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/memory.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/memory.hpp new file mode 100644 index 0000000000..2b5d208027 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/memory.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/memory is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_MEMORY +# define BOOST_CONFIG_MEMORY + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_MEMORY_RECURSION +# endif + +# include + +# ifdef BOOST_CONFIG_NO_MEMORY_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_MEMORY_RECURSION +# endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/utility.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/utility.hpp new file mode 100644 index 0000000000..dea8f115bc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/no_tr1/utility.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/utility is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_UTILITY +# define BOOST_CONFIG_UTILITY + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_UTILITY_RECURSION +# endif + +# include + +# ifdef BOOST_CONFIG_NO_UTILITY_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_UTILITY_RECURSION +# endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/aix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/aix.hpp new file mode 100644 index 0000000000..894ef42ce9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/aix.hpp @@ -0,0 +1,33 @@ +// (C) Copyright John Maddock 2001 - 2002. +// 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 for most recent version. + +// IBM/Aix specific config options: + +#define BOOST_PLATFORM "IBM Aix" + +#define BOOST_HAS_UNISTD_H +#define BOOST_HAS_NL_TYPES_H +#define BOOST_HAS_NANOSLEEP +#define BOOST_HAS_CLOCK_GETTIME + +// This needs support in "boost/cstdint.hpp" exactly like FreeBSD. +// This platform has header named which includes all +// the things needed. +#define BOOST_HAS_STDINT_H + +// Threading API's: +#define BOOST_HAS_PTHREADS +#define BOOST_HAS_PTHREAD_DELAY_NP +#define BOOST_HAS_SCHED_YIELD +//#define BOOST_HAS_PTHREAD_YIELD + +// boilerplate code: +#include + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/amigaos.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/amigaos.hpp new file mode 100644 index 0000000000..34bcf4128b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/amigaos.hpp @@ -0,0 +1,15 @@ +// (C) Copyright John Maddock 2002. +// 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 for most recent version. + +#define BOOST_PLATFORM "AmigaOS" + +#define BOOST_DISABLE_THREADS +#define BOOST_NO_CWCHAR +#define BOOST_NO_STD_WSTRING +#define BOOST_NO_INTRINSIC_WCHAR_T + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/beos.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/beos.hpp new file mode 100644 index 0000000000..48c3d8dc5b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/beos.hpp @@ -0,0 +1,26 @@ +// (C) Copyright John Maddock 2001. +// 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 for most recent version. + +// BeOS specific config options: + +#define BOOST_PLATFORM "BeOS" + +#define BOOST_NO_CWCHAR +#define BOOST_NO_CWCTYPE +#define BOOST_HAS_UNISTD_H + +#define BOOST_HAS_BETHREADS + +#ifndef BOOST_DISABLE_THREADS +# define BOOST_HAS_THREADS +#endif + +// boilerplate code: +#include + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/bsd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/bsd.hpp new file mode 100644 index 0000000000..810d3707be --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/bsd.hpp @@ -0,0 +1,85 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Douglas Gregor 2002. +// 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 for most recent version. + +// generic BSD config options: + +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) +#error "This platform is not BSD" +#endif + +#ifdef __FreeBSD__ +#define BOOST_PLATFORM "FreeBSD " BOOST_STRINGIZE(__FreeBSD__) +#elif defined(__NetBSD__) +#define BOOST_PLATFORM "NetBSD " BOOST_STRINGIZE(__NetBSD__) +#elif defined(__OpenBSD__) +#define BOOST_PLATFORM "OpenBSD " BOOST_STRINGIZE(__OpenBSD__) +#elif defined(__DragonFly__) +#define BOOST_PLATFORM "DragonFly " BOOST_STRINGIZE(__DragonFly__) +#endif + +// +// is this the correct version check? +// FreeBSD has but does not +// advertise the fact in : +// +#if (defined(__FreeBSD__) && (__FreeBSD__ >= 3)) || defined(__DragonFly__) +# define BOOST_HAS_NL_TYPES_H +#endif + +// +// FreeBSD 3.x has pthreads support, but defines _POSIX_THREADS in +// and not in +// +#if (defined(__FreeBSD__) && (__FreeBSD__ <= 3)) || defined(__OpenBSD__) +# define BOOST_HAS_PTHREADS +#endif + +// +// No wide character support in the BSD header files: +// +#if defined(__NetBSD__) +#define __NetBSD_GCC__ (__GNUC__ * 1000000 \ + + __GNUC_MINOR__ * 1000 \ + + __GNUC_PATCHLEVEL__) +// XXX - the following is required until c++config.h +// defines _GLIBCXX_HAVE_SWPRINTF and friends +// or the preprocessor conditionals are removed +// from the cwchar header. +#define _GLIBCXX_HAVE_SWPRINTF 1 +#endif + +#if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \ + || (__NetBSD_GCC__ >= 2095003)) +# define BOOST_NO_CWCHAR +#endif +// +// The BSD has macros only, no functions: +// +#if !defined(__OpenBSD__) +# define BOOST_NO_CTYPE_FUNCTIONS +#endif + +// +// thread API's not auto detected: +// +#define BOOST_HAS_SCHED_YIELD +#define BOOST_HAS_NANOSLEEP +#define BOOST_HAS_GETTIMEOFDAY +#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +#define BOOST_HAS_SIGACTION + +// boilerplate code: +#define BOOST_HAS_UNISTD_H +#include + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/cygwin.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/cygwin.hpp new file mode 100644 index 0000000000..41fcaa10c7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/cygwin.hpp @@ -0,0 +1,51 @@ +// (C) Copyright John Maddock 2001 - 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 for most recent version. + +// cygwin specific config options: + +#define BOOST_PLATFORM "Cygwin" +#define BOOST_NO_CWCTYPE +#define BOOST_NO_CWCHAR +#define BOOST_NO_SWPRINTF +#define BOOST_HAS_DIRENT_H +#define BOOST_HAS_LOG1P +#define BOOST_HAS_EXPM1 + +// +// Threading API: +// See if we have POSIX threads, if we do use them, otherwise +// revert to native Win threads. +#define BOOST_HAS_UNISTD_H +#include +#if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) +# define BOOST_HAS_PTHREADS +# define BOOST_HAS_SCHED_YIELD +# define BOOST_HAS_GETTIMEOFDAY +# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# define BOOST_HAS_SIGACTION +#else +# if !defined(BOOST_HAS_WINTHREADS) +# define BOOST_HAS_WINTHREADS +# endif +# define BOOST_HAS_FTIME +#endif + +// +// find out if we have a stdint.h, there should be a better way to do this: +// +#include +#ifdef _STDINT_H +#define BOOST_HAS_STDINT_H +#endif + +// boilerplate code: +#include + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/hpux.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/hpux.hpp new file mode 100644 index 0000000000..19ce68e597 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/hpux.hpp @@ -0,0 +1,87 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 2003. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Toon Knapen 2003. +// (C) Copyright Boris Gubenko 2006 - 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for most recent version. + +// hpux specific config options: + +#define BOOST_PLATFORM "HP-UX" + +// In principle, HP-UX has a nice under the name +// However, it has the following problem: +// Use of UINT32_C(0) results in "0u l" for the preprocessed source +// (verifyable with gcc 2.95.3) +#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__HP_aCC) +# define BOOST_HAS_STDINT_H +#endif + +#if !(defined(__HP_aCC) || !defined(_INCLUDE__STDC_A1_SOURCE)) +# define BOOST_NO_SWPRINTF +#endif +#if defined(__HP_aCC) && !defined(_INCLUDE__STDC_A1_SOURCE) +# define BOOST_NO_CWCTYPE +#endif + +#if defined(__GNUC__) +# if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)) + // GNU C on HP-UX does not support threads (checked up to gcc 3.3) +# define BOOST_DISABLE_THREADS +# elif !defined(BOOST_DISABLE_THREADS) + // threads supported from gcc-3.3 onwards: +# define BOOST_HAS_THREADS +# define BOOST_HAS_PTHREADS +# endif +#elif defined(__HP_aCC) && !defined(BOOST_DISABLE_THREADS) +# define BOOST_HAS_PTHREADS +#endif + +// boilerplate code: +#define BOOST_HAS_UNISTD_H +#include + +// the following are always available: +#ifndef BOOST_HAS_GETTIMEOFDAY +# define BOOST_HAS_GETTIMEOFDAY +#endif +#ifndef BOOST_HAS_SCHED_YIELD +# define BOOST_HAS_SCHED_YIELD +#endif +#ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +#endif +#ifndef BOOST_HAS_NL_TYPES_H +# define BOOST_HAS_NL_TYPES_H +#endif +#ifndef BOOST_HAS_NANOSLEEP +# define BOOST_HAS_NANOSLEEP +#endif +#ifndef BOOST_HAS_GETTIMEOFDAY +# define BOOST_HAS_GETTIMEOFDAY +#endif +#ifndef BOOST_HAS_DIRENT_H +# define BOOST_HAS_DIRENT_H +#endif +#ifndef BOOST_HAS_CLOCK_GETTIME +# define BOOST_HAS_CLOCK_GETTIME +#endif +#ifndef BOOST_HAS_SIGACTION +# define BOOST_HAS_SIGACTION +#endif +#ifndef BOOST_HAS_NRVO +# ifndef __parisc +# define BOOST_HAS_NRVO +# endif +#endif +#ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +#endif +#ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/irix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/irix.hpp new file mode 100644 index 0000000000..aeae49c8b4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/irix.hpp @@ -0,0 +1,31 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 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 for most recent version. + +// SGI Irix specific config options: + +#define BOOST_PLATFORM "SGI Irix" + +#define BOOST_NO_SWPRINTF +// +// these are not auto detected by POSIX feature tests: +// +#define BOOST_HAS_GETTIMEOFDAY +#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE + +#ifdef __GNUC__ + // GNU C on IRIX does not support threads (checked up to gcc 3.3) +# define BOOST_DISABLE_THREADS +#endif + +// boilerplate code: +#define BOOST_HAS_UNISTD_H +#include + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/linux.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/linux.hpp new file mode 100644 index 0000000000..51ae13347c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/linux.hpp @@ -0,0 +1,98 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 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 for most recent version. + +// linux specific config options: + +#define BOOST_PLATFORM "linux" + +// make sure we have __GLIBC_PREREQ if available at all +#include + +// +// added to glibc 2.1.1 +// We can only test for 2.1 though: +// +#if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) + // defines int64_t unconditionally, but defines + // int64_t only if __GNUC__. Thus, assume a fully usable + // only when using GCC. +# if defined __GNUC__ +# define BOOST_HAS_STDINT_H +# endif +#endif + +#if defined(__LIBCOMO__) + // + // como on linux doesn't have std:: c functions: + // NOTE: versions of libcomo prior to beta28 have octal version numbering, + // e.g. version 25 is 21 (dec) + // +# if __LIBCOMO_VERSION__ <= 20 +# define BOOST_NO_STDC_NAMESPACE +# endif + +# if __LIBCOMO_VERSION__ <= 21 +# define BOOST_NO_SWPRINTF +# endif + +#endif + +// +// If glibc is past version 2 then we definitely have +// gettimeofday, earlier versions may or may not have it: +// +#if defined(__GLIBC__) && (__GLIBC__ >= 2) +# define BOOST_HAS_GETTIMEOFDAY +#endif + +#ifdef __USE_POSIX199309 +# define BOOST_HAS_NANOSLEEP +#endif + +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +// __GLIBC_PREREQ is available since 2.1.2 + + // swprintf is available since glibc 2.2.0 +# if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98)) +# define BOOST_NO_SWPRINTF +# endif +#else +# define BOOST_NO_SWPRINTF +#endif + +// boilerplate code: +#define BOOST_HAS_UNISTD_H +#include + +#ifndef __GNUC__ +// +// if the compiler is not gcc we still need to be able to parse +// the GNU system headers, some of which (mainly ) +// use GNU specific extensions: +// +# ifndef __extension__ +# define __extension__ +# endif +# ifndef __const__ +# define __const__ const +# endif +# ifndef __volatile__ +# define __volatile__ volatile +# endif +# ifndef __signed__ +# define __signed__ signed +# endif +# ifndef __typeof__ +# define __typeof__ typeof +# endif +# ifndef __inline__ +# define __inline__ inline +# endif +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/macos.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/macos.hpp new file mode 100644 index 0000000000..2780ef99e9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/macos.hpp @@ -0,0 +1,86 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001 - 2002. +// (C) Copyright Bill Kempf 2002. +// 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 for most recent version. + +// Mac OS specific config options: + +#define BOOST_PLATFORM "Mac OS" + +#if __MACH__ && !defined(_MSL_USING_MSL_C) + +// Using the Mac OS X system BSD-style C library. + +# ifndef BOOST_HAS_UNISTD_H +# define BOOST_HAS_UNISTD_H +# endif +// +// Begin by including our boilerplate code for POSIX +// feature detection, this is safe even when using +// the MSL as Metrowerks supply their own +// to replace the platform-native BSD one. G++ users +// should also always be able to do this on MaxOS X. +// +# include +# ifndef BOOST_HAS_STDINT_H +# define BOOST_HAS_STDINT_H +# endif + +// +// BSD runtime has pthreads, sigaction, sched_yield and gettimeofday, +// of these only pthreads are advertised in , so set the +// other options explicitly: +// +# define BOOST_HAS_SCHED_YIELD +# define BOOST_HAS_GETTIMEOFDAY +# define BOOST_HAS_SIGACTION + +# if (__GNUC__ < 3) && !defined( __APPLE_CC__) + +// GCC strange "ignore std" mode works better if you pretend everything +// is in the std namespace, for the most part. + +# define BOOST_NO_STDC_NAMESPACE +# endif + +# if (__GNUC__ == 4) + +// Both gcc and intel require these. +# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# define BOOST_HAS_NANOSLEEP + +# endif + +#else + +// Using the MSL C library. + +// We will eventually support threads in non-Carbon builds, but we do +// not support this yet. +# if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON ) + +# if !defined(BOOST_HAS_PTHREADS) +# define BOOST_HAS_MPTASKS +# elif ( __dest_os == __mac_os_x ) +// We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the +// gettimeofday and no posix. +# define BOOST_HAS_GETTIMEOFDAY +# endif + +// The MP task implementation of Boost Threads aims to replace MP-unsafe +// parts of the MSL, so we turn on threads unconditionally. +# define BOOST_HAS_THREADS + +// The remote call manager depends on this. +# define BOOST_BIND_ENABLE_PASCAL + +# endif + +#endif + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/qnxnto.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/qnxnto.hpp new file mode 100644 index 0000000000..b1377c8d2c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/qnxnto.hpp @@ -0,0 +1,31 @@ +// (C) Copyright Jim Douglas 2005. +// 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 for most recent version. + +// QNX specific config options: + +#define BOOST_PLATFORM "QNX" + +#define BOOST_HAS_UNISTD_H +#include + +// QNX claims XOpen version 5 compatibility, but doesn't have an nl_types.h +// or log1p and expm1: +#undef BOOST_HAS_NL_TYPES_H +#undef BOOST_HAS_LOG1P +#undef BOOST_HAS_EXPM1 + +#define BOOST_HAS_PTHREADS +#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE + +#define BOOST_HAS_GETTIMEOFDAY +#define BOOST_HAS_CLOCK_GETTIME +#define BOOST_HAS_NANOSLEEP + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/solaris.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/solaris.hpp new file mode 100644 index 0000000000..9f9256664b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/solaris.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 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 for most recent version. + +// sun specific config options: + +#define BOOST_PLATFORM "Sun Solaris" + +#define BOOST_HAS_GETTIMEOFDAY + +// boilerplate code: +#define BOOST_HAS_UNISTD_H +#include + +// +// pthreads don't actually work with gcc unless _PTHREADS is defined: +// +#if defined(__GNUC__) && defined(_POSIX_THREADS) && !defined(_PTHREADS) +# undef BOOST_HAS_PTHREADS +#endif + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/platform/win32.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/win32.hpp new file mode 100644 index 0000000000..9344818f87 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/platform/win32.hpp @@ -0,0 +1,58 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Bill Kempf 2001. +// (C) Copyright Aleksey Gurtovoy 2003. +// (C) Copyright Rene Rivera 2005. +// 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 for most recent version. + +// Win32 specific config options: + +#define BOOST_PLATFORM "Win32" + +// Get the information about the MinGW runtime, i.e. __MINGW32_*VERSION. +#if defined(__MINGW32__) +# include <_mingw.h> +#endif + +#if defined(__GNUC__) && !defined(BOOST_NO_SWPRINTF) +# define BOOST_NO_SWPRINTF +#endif + +#if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC) +# define BOOST_HAS_DECLSPEC +#endif + +#if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0))) +# define BOOST_HAS_STDINT_H +# define __STDC_LIMIT_MACROS +# define BOOST_HAS_DIRENT_H +# define BOOST_HAS_UNISTD_H +#endif + +// +// Win32 will normally be using native Win32 threads, +// but there is a pthread library avaliable as an option, +// we used to disable this when BOOST_DISABLE_WIN32 was +// defined but no longer - this should allow some +// files to be compiled in strict mode - while maintaining +// a consistent setting of BOOST_HAS_THREADS across +// all translation units (needed for shared_ptr etc). +// + +#ifdef _WIN32_WCE +# define BOOST_NO_ANSI_APIS +#endif + +#ifndef BOOST_HAS_PTHREADS +# define BOOST_HAS_WINTHREADS +#endif + +#ifndef BOOST_DISABLE_WIN32 +// WEK: Added +#define BOOST_HAS_FTIME +#define BOOST_WINDOWS 1 + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/posix_features.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/posix_features.hpp new file mode 100644 index 0000000000..d12954797f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/posix_features.hpp @@ -0,0 +1,95 @@ +// (C) Copyright John Maddock 2001 - 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 for most recent version. + +// All POSIX feature tests go in this file, +// Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well +// _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's +// may be present but none-functional unless _POSIX_C_SOURCE and +// _XOPEN_SOURCE have been defined to the right value (it's up +// to the user to do this *before* including any header, although +// in most cases the compiler will do this for you). + +# if defined(BOOST_HAS_UNISTD_H) +# include + + // XOpen has , but is this the correct version check? +# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3) +# define BOOST_HAS_NL_TYPES_H +# endif + + // POSIX version 6 requires +# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100) +# define BOOST_HAS_STDINT_H +# endif + + // POSIX version 2 requires +# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L) +# define BOOST_HAS_DIRENT_H +# endif + + // POSIX version 3 requires to have sigaction: +# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L) +# define BOOST_HAS_SIGACTION +# endif + // POSIX defines _POSIX_THREADS > 0 for pthread support, + // however some platforms define _POSIX_THREADS without + // a value, hence the (_POSIX_THREADS+0 >= 0) check. + // Strictly speaking this may catch platforms with a + // non-functioning stub , but such occurrences should + // occur very rarely if at all. +# if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS) +# define BOOST_HAS_PTHREADS +# endif + + // BOOST_HAS_NANOSLEEP: + // This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME: +# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \ + || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) +# define BOOST_HAS_NANOSLEEP +# endif + + // BOOST_HAS_CLOCK_GETTIME: + // This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME + // but at least one platform - linux - defines that flag without + // defining clock_gettime): +# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) +# define BOOST_HAS_CLOCK_GETTIME +# endif + + // BOOST_HAS_SCHED_YIELD: + // This is predicated on _POSIX_PRIORITY_SCHEDULING or + // on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME. +# if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\ + || (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\ + || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) +# define BOOST_HAS_SCHED_YIELD +# endif + + // BOOST_HAS_GETTIMEOFDAY: + // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: + // These are predicated on _XOPEN_VERSION, and appears to be first released + // in issue 4, version 2 (_XOPEN_VERSION > 500). + // Likewise for the functions log1p and expm1. +# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500) +# define BOOST_HAS_GETTIMEOFDAY +# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) +# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# endif +# ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +# endif +# ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +# endif +# endif + +# endif + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/requires_threads.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/requires_threads.hpp new file mode 100644 index 0000000000..cfaff23027 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/requires_threads.hpp @@ -0,0 +1,92 @@ +// (C) Copyright John Maddock 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) + + +#ifndef BOOST_CONFIG_REQUIRES_THREADS_HPP +#define BOOST_CONFIG_REQUIRES_THREADS_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_DISABLE_THREADS) + +// +// special case to handle versions of gcc which don't currently support threads: +// +#if defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC_MINOR__ <= 3) || !defined(BOOST_STRICT_CONFIG)) +// +// this is checked up to gcc 3.3: +// +#if defined(__sgi) || defined(__hpux) +# error "Multi-threaded programs are not supported by gcc on HPUX or Irix (last checked with gcc 3.3)" +#endif + +#endif + +# error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS" + +#elif !defined(BOOST_HAS_THREADS) + +# if defined __COMO__ +// Comeau C++ +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -D_MT (Windows) or -D_REENTRANT (Unix)" + +#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) +// Intel +#ifdef _WIN32 +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd" +#else +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -openmp" +#endif + +# elif defined __GNUC__ +// GNU C++: +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" + +#elif defined __sgi +// SGI MIPSpro C++ +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -D_SGI_MP_SOURCE" + +#elif defined __DECCXX +// Compaq Tru64 Unix cxx +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread" + +#elif defined __BORLANDC__ +// Borland +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -tWM" + +#elif defined __MWERKS__ +// Metrowerks CodeWarrior +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: either -runtime sm, -runtime smd, -runtime dm, or -runtime dmd" + +#elif defined __SUNPRO_CC +// Sun Workshop Compiler C++ +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -mt" + +#elif defined __HP_aCC +// HP aCC +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -mt" + +#elif defined(__IBMCPP__) +// IBM Visual Age +# error "Compiler threading support is not turned on. Please compile the code with the xlC_r compiler" + +#elif defined _MSC_VER +// Microsoft Visual C++ +// +// Must remain the last #elif since some other vendors (Metrowerks, for +// example) also #define _MSC_VER +# error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd" + +#else + +# error "Compiler threading support is not turned on. Please consult your compiler's documentation for the appropriate options to use" + +#endif // compilers + +#endif // BOOST_HAS_THREADS + +#endif // BOOST_CONFIG_REQUIRES_THREADS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/select_compiler_config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/select_compiler_config.hpp new file mode 100644 index 0000000000..9141cd6376 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/select_compiler_config.hpp @@ -0,0 +1,119 @@ +// Boost compiler configuration selection header file + +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Martin Wille 2003. +// (C) Copyright Guillaume Melquiond 2003. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/ for most recent version. + + +// one identification macro for each of the +// compilers we support: + +# define BOOST_CXX_GCCXML 0 +# define BOOST_CXX_COMO 0 +# define BOOST_CXX_DMC 0 +# define BOOST_CXX_INTEL 0 +# define BOOST_CXX_GNUC 0 +# define BOOST_CXX_KCC 0 +# define BOOST_CXX_SGI 0 +# define BOOST_CXX_TRU64 0 +# define BOOST_CXX_GHS 0 +# define BOOST_CXX_BORLAND 0 +# define BOOST_CXX_CW 0 +# define BOOST_CXX_SUNPRO 0 +# define BOOST_CXX_HPACC 0 +# define BOOST_CXX_MPW 0 +# define BOOST_CXX_IBMCPP 0 +# define BOOST_CXX_MSVC 0 +# define BOOST_CXX_PGI 0 + + +// locate which compiler we are using and define +// BOOST_COMPILER_CONFIG as needed: + +#if defined(__GCCXML__) +// GCC-XML emulates other compilers, it has to appear first here! +# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" + +#elif defined __COMO__ +// Comeau C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" + +#elif defined __DMC__ +// Digital Mars C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp" + +#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) +// Intel +# define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp" + +# elif defined __GNUC__ +// GNU C++: +# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc.hpp" + +#elif defined __KCC +// Kai C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/kai.hpp" + +#elif defined __sgi +// SGI MIPSpro C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp" + +#elif defined __DECCXX +// Compaq Tru64 Unix cxx +# define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp" + +#elif defined __ghs +// Greenhills C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp" + +#elif defined __CODEGEARC__ +// CodeGear - must be checked for before Borland +# define BOOST_COMPILER_CONFIG "boost/config/compiler/codegear.hpp" + +#elif defined __BORLANDC__ +// Borland +# define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp" + +#elif defined __MWERKS__ +// Metrowerks CodeWarrior +# define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp" + +#elif defined __SUNPRO_CC +// Sun Workshop Compiler C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp" + +#elif defined __HP_aCC +// HP aCC +# define BOOST_COMPILER_CONFIG "boost/config/compiler/hp_acc.hpp" + +#elif defined(__MRC__) || defined(__SC__) +// MPW MrCpp or SCpp +# define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp" + +#elif defined(__IBMCPP__) +// IBM Visual Age +# define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp" + +#elif defined(__PGI) +// Portland Group Inc. +# define BOOST_COMPILER_CONFIG "boost/config/compiler/pgi.hpp" + +#elif defined _MSC_VER +// Microsoft Visual C++ +// +// Must remain the last #elif since some other vendors (Metrowerks, for +// example) also #define _MSC_VER +# define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp" + +#elif defined (BOOST_ASSERT_CONFIG) +// this must come last - generate an error if we don't +// recognise the compiler: +# error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)" + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/select_platform_config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/select_platform_config.hpp new file mode 100644 index 0000000000..a4c7ad6a87 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/select_platform_config.hpp @@ -0,0 +1,90 @@ +// Boost compiler configuration selection header file + +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. + +// locate which platform we are on and define BOOST_PLATFORM_CONFIG as needed. +// Note that we define the headers to include using "header_name" not +// in order to prevent macro expansion within the header +// name (for example "linux" is a macro on linux systems). + +#if defined(linux) || defined(__linux) || defined(__linux__) +// linux: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" + +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +// BSD: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/bsd.hpp" + +#elif defined(sun) || defined(__sun) +// solaris: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/solaris.hpp" + +#elif defined(__sgi) +// SGI Irix: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/irix.hpp" + +#elif defined(__hpux) +// hp unix: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/hpux.hpp" + +#elif defined(__CYGWIN__) +// cygwin is not win32: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/cygwin.hpp" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +// win32: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/win32.hpp" + +#elif defined(__BEOS__) +// BeOS +# define BOOST_PLATFORM_CONFIG "boost/config/platform/beos.hpp" + +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +// MacOS +# define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp" + +#elif defined(__IBMCPP__) || defined(_AIX) +// IBM +# define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp" + +#elif defined(__amigaos__) +// AmigaOS +# define BOOST_PLATFORM_CONFIG "boost/config/platform/amigaos.hpp" + +#elif defined(__QNXNTO__) +// QNX: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" + +#else + +# if defined(unix) \ + || defined(__unix) \ + || defined(_XOPEN_SOURCE) \ + || defined(_POSIX_SOURCE) + + // generic unix platform: + +# ifndef BOOST_HAS_UNISTD_H +# define BOOST_HAS_UNISTD_H +# endif + +# include + +# endif + +# if defined (BOOST_ASSERT_CONFIG) + // this must come last - generate an error if we don't + // recognise the platform: +# error "Unknown platform - please configure and report the results to boost.org" +# endif + +#endif + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/select_stdlib_config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/select_stdlib_config.hpp new file mode 100644 index 0000000000..13e5e4cef0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/select_stdlib_config.hpp @@ -0,0 +1,68 @@ +// Boost compiler configuration selection header file + +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 2002. +// 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 for most recent version. + +// locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: + +// we need to include a std lib header here in order to detect which +// library is in use, use as it's about the smallest +// of the std lib headers - do not rely on this header being included - +// users can short-circuit this header if they know whose std lib +// they are using. + +#include + +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +// STLPort library; this _must_ come first, otherwise since +// STLport typically sits on top of some other library, we +// can end up detecting that first rather than STLport: +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" + +#elif defined(__LIBCOMO__) +// Comeau STL: +#define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" + +#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) +// Rogue Wave library: +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp" + +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +// GNU libstdc++ 3 +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/libstdcpp3.hpp" + +#elif defined(__STL_CONFIG_H) +// generic SGI STL +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/sgi.hpp" + +#elif defined(__MSL_CPP__) +// MSL standard lib: +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp" + +#elif defined(__IBMCPP__) +// take the default VACPP std lib +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp" + +#elif defined(MSIPL_COMPILE_H) +// Modena C++ standard library +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/modena.hpp" + +#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) +// Dinkumware Library (this has to appear after any possible replacement libraries): +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/dinkumware.hpp" + +#elif defined (BOOST_ASSERT_CONFIG) +// this must come last - generate an error if we don't +// recognise the library: +# error "Unknown standard library - please configure and report the results to boost.org" + +#endif + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/dinkumware.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/dinkumware.hpp new file mode 100644 index 0000000000..01f1238d93 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/dinkumware.hpp @@ -0,0 +1,106 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Guillaume Melquiond 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 for most recent version. + +// Dinkumware standard library config: + +#if !defined(_YVALS) && !defined(_CPPLIB_VER) +#include +#if !defined(_YVALS) && !defined(_CPPLIB_VER) +#error This is not the Dinkumware lib! +#endif +#endif + + +#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306) + // full dinkumware 3.06 and above + // fully conforming provided the compiler supports it: +# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(__BORLANDC__) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h +# define BOOST_NO_STDC_NAMESPACE +# endif +# if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) && !(defined(_MSC_VER) && (_MSC_VER > 1300)) && defined(BOOST_MSVC) +# define BOOST_NO_STD_ALLOCATOR +# endif +# define BOOST_HAS_PARTIAL_STD_ALLOCATOR +# if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) + // if this lib version is set up for vc6 then there is no std::use_facet: +# define BOOST_NO_STD_USE_FACET +# define BOOST_HAS_TWO_ARG_USE_FACET + // C lib functions aren't in namespace std either: +# define BOOST_NO_STDC_NAMESPACE + // and nor is +# define BOOST_NO_EXCEPTION_STD_NAMESPACE +# endif +// There's no numeric_limits support unless _LONGLONG is defined: +# if !defined(_LONGLONG) && (_CPPLIB_VER <= 310) +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +# endif +// 3.06 appears to have (non-sgi versions of) & , +// and no at all +#else +# define BOOST_MSVC_STD_ITERATOR 1 +# define BOOST_NO_STD_ITERATOR +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +# define BOOST_NO_STDC_NAMESPACE +# define BOOST_NO_STD_USE_FACET +# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN +# define BOOST_HAS_MACRO_USE_FACET +# ifndef _CPPLIB_VER + // Updated Dinkum library defines this, and provides + // its own min and max definitions. +# define BOOST_NO_STD_MIN_MAX +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +# endif +#endif + +// +// std extension namespace is stdext for vc7.1 and later, +// the same applies to other compilers that sit on top +// of vc7.1 (Intel and Comeau): +// +#if defined(_MSC_VER) && (_MSC_VER >= 1310) && !defined(__BORLANDC__) +# define BOOST_STD_EXTENSION_NAMESPACE stdext +#endif + + +#if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) + // if we're using a dinkum lib that's + // been configured for VC6/7 then there is + // no iterator traits (true even for icl) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +#if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310) +// Intel C++ chokes over any non-trivial use of +// this may be an overly restrictive define, but regex fails without it: +# define BOOST_NO_STD_LOCALE +#endif + +#ifdef _CPPLIB_VER +# define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER +#else +# define BOOST_DINKUMWARE_STDLIB 1 +#endif + +#ifdef _CPPLIB_VER +# define BOOST_STDLIB "Dinkumware standard library version " BOOST_STRINGIZE(_CPPLIB_VER) +#else +# define BOOST_STDLIB "Dinkumware standard library version 1.x" +#endif + + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/libcomo.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/libcomo.hpp new file mode 100644 index 0000000000..749781fece --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/libcomo.hpp @@ -0,0 +1,46 @@ +// (C) Copyright John Maddock 2002 - 2003. +// (C) Copyright Jens Maurer 2002 - 2003. +// (C) Copyright Beman Dawes 2002 - 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 for most recent version. + +// Comeau STL: + +#if !defined(__LIBCOMO__) +# include +# if !defined(__LIBCOMO__) +# error "This is not the Comeau STL!" +# endif +#endif + +// +// std::streambuf is non-standard +// NOTE: versions of libcomo prior to beta28 have octal version numbering, +// e.g. version 25 is 21 (dec) +#if __LIBCOMO_VERSION__ <= 22 +# define BOOST_NO_STD_WSTREAMBUF +#endif + +#if (__LIBCOMO_VERSION__ <= 31) && defined(_WIN32) +#define BOOST_NO_SWPRINTF +#endif + +#if __LIBCOMO_VERSION__ >= 31 +# define BOOST_HAS_HASH +# define BOOST_HAS_SLIST +#endif + +// +// Intrinsic type_traits support. +// The SGI STL has it's own __type_traits class, which +// has intrinsic compiler support with SGI's compilers. +// Whatever map SGI style type traits to boost equivalents: +// +#define BOOST_HAS_SGI_TYPE_TRAITS + +#define BOOST_STDLIB "Comeau standard library " BOOST_STRINGIZE(__LIBCOMO_VERSION__) + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/libstdcpp3.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/libstdcpp3.hpp new file mode 100644 index 0000000000..a619e3ebaa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/libstdcpp3.hpp @@ -0,0 +1,78 @@ +// (C) Copyright John Maddock 2001. +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. + +// config for libstdc++ v3 +// not much to go in here: + +#ifdef __GLIBCXX__ +#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__) +#else +#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__) +#endif + +#if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T) +# define BOOST_NO_CWCHAR +# define BOOST_NO_CWCTYPE +# define BOOST_NO_STD_WSTRING +# define BOOST_NO_STD_WSTREAMBUF +#endif + +#if defined(__osf__) && !defined(_REENTRANT) \ + && ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) ) +// GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header +// file is included, therefore for consistency we define it here as well. +# define _REENTRANT +#endif + +#ifdef __GLIBCXX__ // gcc 3.4 and greater: +# if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \ + || defined(_GLIBCXX__PTHREADS) + // + // If the std lib has thread support turned on, then turn it on in Boost + // as well. We do this because some gcc-3.4 std lib headers define _REENTANT + // while others do not... + // +# define BOOST_HAS_THREADS +# else +# define BOOST_DISABLE_THREADS +# endif +#elif defined(__GLIBCPP__) \ + && !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \ + && !defined(_GLIBCPP__PTHREADS) + // disable thread support if the std lib was built single threaded: +# define BOOST_DISABLE_THREADS +#endif + +#if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT) +// linux on arm apparently doesn't define _REENTRANT +// so just turn on threading support whenever the std lib is thread safe: +# define BOOST_HAS_THREADS +#endif + + +#if !defined(_GLIBCPP_USE_LONG_LONG) \ + && !defined(_GLIBCXX_USE_LONG_LONG)\ + && defined(BOOST_HAS_LONG_LONG) +// May have been set by compiler/*.hpp, but "long long" without library +// support is useless. +# undef BOOST_HAS_LONG_LONG +#endif + +#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0 +# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx +# define BOOST_HAS_SLIST +# define BOOST_HAS_HASH +# define BOOST_SLIST_HEADER +# if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) +# define BOOST_HASH_SET_HEADER +# define BOOST_HASH_MAP_HEADER +# else +# define BOOST_HASH_SET_HEADER +# define BOOST_HASH_MAP_HEADER +# endif +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/modena.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/modena.hpp new file mode 100644 index 0000000000..3d0f76be9f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/modena.hpp @@ -0,0 +1,30 @@ +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. + +// Modena C++ standard library (comes with KAI C++) + +#if !defined(MSIPL_COMPILE_H) +# include +# if !defined(__MSIPL_COMPILE_H) +# error "This is not the Modena C++ library!" +# endif +#endif + +#ifndef MSIPL_NL_TYPES +#define BOOST_NO_STD_MESSAGES +#endif + +#ifndef MSIPL_WCHART +#define BOOST_NO_STD_WSTRING +#endif + +#define BOOST_STDLIB "Modena C++ standard library" + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/msl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/msl.hpp new file mode 100644 index 0000000000..f8d8752bf7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/msl.hpp @@ -0,0 +1,59 @@ +// (C) Copyright John Maddock 2001. +// (C) Copyright Darin Adler 2001. +// 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 for most recent version. + +// Metrowerks standard library: + +#ifndef __MSL_CPP__ +# include +# ifndef __MSL_CPP__ +# error This is not the MSL standard library! +# endif +#endif + +#if __MSL_CPP__ >= 0x6000 // Pro 6 +# define BOOST_HAS_HASH +# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks +#endif +#define BOOST_HAS_SLIST + +#if __MSL_CPP__ < 0x6209 +# define BOOST_NO_STD_MESSAGES +#endif + +// check C lib version for +#include + +#if defined(__MSL__) && (__MSL__ >= 0x5000) +# define BOOST_HAS_STDINT_H +# if !defined(__PALMOS_TRAPS__) +# define BOOST_HAS_UNISTD_H +# endif + // boilerplate code: +# include +#endif + +#if defined(_MWMT) || _MSL_THREADSAFE +# define BOOST_HAS_THREADS +#endif + +#ifdef _MSL_NO_EXPLICIT_FUNC_TEMPLATE_ARG +# define BOOST_NO_STD_USE_FACET +# define BOOST_HAS_TWO_ARG_USE_FACET +#endif + + +#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) + + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/roguewave.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/roguewave.hpp new file mode 100644 index 0000000000..ebf4c1f8f4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/roguewave.hpp @@ -0,0 +1,153 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 2003. +// (C) Copyright Boris Gubenko 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for most recent version. + +// Rogue Wave std lib: + +#if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) +# include +# if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) +# error This is not the Rogue Wave standard library +# endif +#endif +// +// figure out a consistent version number: +// +#ifndef _RWSTD_VER +# define BOOST_RWSTD_VER 0x010000 +#elif _RWSTD_VER < 0x010000 +# define BOOST_RWSTD_VER (_RWSTD_VER << 8) +#else +# define BOOST_RWSTD_VER _RWSTD_VER +#endif + +#ifndef _RWSTD_VER +# define BOOST_STDLIB "Rogue Wave standard library version (Unknown version)" +#elif _RWSTD_VER < 0x04010200 + # define BOOST_STDLIB "Rogue Wave standard library version " BOOST_STRINGIZE(_RWSTD_VER) +#else +# ifdef _RWSTD_VER_STR +# define BOOST_STDLIB "Apache STDCXX standard library version " _RWSTD_VER_STR +# else +# define BOOST_STDLIB "Apache STDCXX standard library version " BOOST_STRINGIZE(_RWSTD_VER) +# endif +#endif + +// +// Prior to version 2.2.0 the primary template for std::numeric_limits +// does not have compile time constants, even though specializations of that +// template do: +// +#if BOOST_RWSTD_VER < 0x020200 +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#endif + +// Sun CC 5.5 patch 113817-07 adds long long specialization, but does not change the +// library version number (http://sunsolve6.sun.com/search/document.do?assetkey=1-21-113817): +#if BOOST_RWSTD_VER <= 0x020101 && (!defined(__SUNPRO_CC) || (__SUNPRO_CC < 0x550)) +# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS +# endif + +// +// Borland version of numeric_limits lacks __int64 specialisation: +// +#ifdef __BORLANDC__ +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +#endif + +// +// No std::iterator if it can't figure out default template args: +// +#if defined(_RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || defined(RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || (BOOST_RWSTD_VER < 0x020000) +# define BOOST_NO_STD_ITERATOR +#endif + +// +// No iterator traits without partial specialization: +// +#if defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) || defined(RWSTD_NO_CLASS_PARTIAL_SPEC) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +// +// Prior to version 2.0, std::auto_ptr was buggy, and there were no +// new-style iostreams, and no conformant std::allocator: +// +#if (BOOST_RWSTD_VER < 0x020000) +# define BOOST_NO_AUTO_PTR +# define BOOST_NO_STRINGSTREAM +# define BOOST_NO_STD_ALLOCATOR +# define BOOST_NO_STD_LOCALE +#endif + +// +// No template iterator constructors without member template support: +// +#if defined(RWSTD_NO_MEMBER_TEMPLATES) || defined(_RWSTD_NO_MEMBER_TEMPLATES) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +#endif + +// +// RW defines _RWSTD_ALLOCATOR if the allocator is conformant and in use +// (the or _HPACC_ part is a hack - the library seems to define _RWSTD_ALLOCATOR +// on HP aCC systems even though the allocator is in fact broken): +// +#if !defined(_RWSTD_ALLOCATOR) || (defined(__HP_aCC) && __HP_aCC <= 33100) +# define BOOST_NO_STD_ALLOCATOR +#endif + +// +// If we have a std::locale, we still may not have std::use_facet: +// +#if defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) && !defined(BOOST_NO_STD_LOCALE) +# define BOOST_NO_STD_USE_FACET +# define BOOST_HAS_TWO_ARG_USE_FACET +#endif + +// +// There's no std::distance prior to version 2, or without +// partial specialization support: +// +#if (BOOST_RWSTD_VER < 0x020000) || defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + #define BOOST_NO_STD_DISTANCE +#endif + +// +// Some versions of the rogue wave library don't have assignable +// OutputIterators: +// +#if BOOST_RWSTD_VER < 0x020100 +# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN +#endif + +// +// Disable BOOST_HAS_LONG_LONG when the library has no support for it. +// +#if !defined(_RWSTD_LONG_LONG) && defined(BOOST_HAS_LONG_LONG) +# undef BOOST_HAS_LONG_LONG +#endif + +// +// check that on HP-UX, the proper RW library is used +// +#if defined(__HP_aCC) && !defined(_HP_NAMESPACE_STD) +# error "Boost requires Standard RW library. Please compile and link with -AA" +#endif + +// +// Define macros specific to RW V2.2 on HP-UX +// +#if defined(__HP_aCC) && (BOOST_RWSTD_VER == 0x02020100) +# ifndef __HP_TC1_MAKE_PAIR +# define __HP_TC1_MAKE_PAIR +# endif +# ifndef _HP_INSTANTIATE_STD2_VL +# define _HP_INSTANTIATE_STD2_VL +# endif +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/sgi.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/sgi.hpp new file mode 100644 index 0000000000..f3fa05b260 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/sgi.hpp @@ -0,0 +1,111 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Jens Maurer 2001 - 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 for most recent version. + +// generic SGI STL: + +#if !defined(__STL_CONFIG_H) +# include +# if !defined(__STL_CONFIG_H) +# error "This is not the SGI STL!" +# endif +#endif + +// +// No std::iterator traits without partial specialisation: +// +#if !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +// +// No std::stringstream with gcc < 3 +// +#if defined(__GNUC__) && (__GNUC__ < 3) && \ + ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)) && \ + !defined(__STL_USE_NEW_IOSTREAMS) || \ + defined(__APPLE_CC__) + // Note that we only set this for GNU C++ prior to 2.95 since the + // latest patches for that release do contain a minimal + // If you are running a 2.95 release prior to 2.95.3 then this will need + // setting, but there is no way to detect that automatically (other + // than by running the configure script). + // Also, the unofficial GNU C++ 2.96 included in RedHat 7.1 doesn't + // have . +# define BOOST_NO_STRINGSTREAM +#endif + +// +// Assume no std::locale without own iostreams (this may be an +// incorrect assumption in some cases): +// +#if !defined(__SGI_STL_OWN_IOSTREAMS) && !defined(__STL_USE_NEW_IOSTREAMS) +# define BOOST_NO_STD_LOCALE +#endif + +// +// Original native SGI streams have non-standard std::messages facet: +// +#if defined(__sgi) && (_COMPILER_VERSION <= 650) && !defined(__SGI_STL_OWN_IOSTREAMS) +# define BOOST_NO_STD_LOCALE +#endif + +// +// SGI's new iostreams have missing "const" in messages<>::open +// +#if defined(__sgi) && (_COMPILER_VERSION <= 740) && defined(__STL_USE_NEW_IOSTREAMS) +# define BOOST_NO_STD_MESSAGES +#endif + +// +// No template iterator constructors, or std::allocator +// without member templates: +// +#if !defined(__STL_MEMBER_TEMPLATES) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +#endif + +// +// We always have SGI style hash_set, hash_map, and slist: +// +#define BOOST_HAS_HASH +#define BOOST_HAS_SLIST + +// +// If this is GNU libstdc++2, then no and no std::wstring: +// +#if (defined(__GNUC__) && (__GNUC__ < 3)) +# include +# if defined(__BASTRING__) +# define BOOST_NO_LIMITS +// Note: will provide compile-time constants +# undef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_NO_STD_WSTRING +# endif +#endif + +// +// There is no standard iterator unless we have namespace support: +// +#if !defined(__STL_USE_NAMESPACES) +# define BOOST_NO_STD_ITERATOR +#endif + +// +// Intrinsic type_traits support. +// The SGI STL has it's own __type_traits class, which +// has intrinsic compiler support with SGI's compilers. +// Whatever map SGI style type traits to boost equivalents: +// +#define BOOST_HAS_SGI_TYPE_TRAITS + +#define BOOST_STDLIB "SGI standard library" + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/stlport.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/stlport.hpp new file mode 100644 index 0000000000..b1dabf23f6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/stlport.hpp @@ -0,0 +1,203 @@ +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. + +// STLPort standard library config: + +#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +# include +# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +# error "This is not STLPort!" +# endif +#endif + +// +// __STL_STATIC_CONST_INIT_BUG implies BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +// for versions prior to 4.1(beta) +// +#if (defined(__STL_STATIC_CONST_INIT_BUG) || defined(_STLP_STATIC_CONST_INIT_BUG)) && (__SGI_STL_PORT <= 0x400) +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#endif + +// +// If STLport thinks that there is no partial specialisation, then there is no +// std::iterator traits: +// +#if !(defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined(__STL_CLASS_PARTIAL_SPECIALIZATION)) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +// +// No new style iostreams on GCC without STLport's iostreams enabled: +// +#if (defined(__GNUC__) && (__GNUC__ < 3)) && !(defined(__SGI_STL_OWN_IOSTREAMS) || defined(_STLP_OWN_IOSTREAMS)) +# define BOOST_NO_STRINGSTREAM +#endif + +// +// No new iostreams implies no std::locale, and no std::stringstream: +// +#if defined(__STL_NO_IOSTREAMS) || defined(__STL_NO_NEW_IOSTREAMS) || defined(_STLP_NO_IOSTREAMS) || defined(_STLP_NO_NEW_IOSTREAMS) +# define BOOST_NO_STD_LOCALE +# define BOOST_NO_STRINGSTREAM +#endif + +// +// If the streams are not native, and we have a "using ::x" compiler bug +// then the io stream facets are not available in namespace std:: +// +#ifdef _STLPORT_VERSION +# if !(_STLPORT_VERSION >= 0x500) && !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__) +# define BOOST_NO_STD_LOCALE +# endif +#else +# if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__) +# define BOOST_NO_STD_LOCALE +# endif +#endif + +// +// Without member template support enabled, their are no template +// iterate constructors, and no std::allocator: +// +#if !(defined(__STL_MEMBER_TEMPLATES) || defined(_STLP_MEMBER_TEMPLATES)) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +#endif +// +// however we always have at least a partial allocator: +// +#define BOOST_HAS_PARTIAL_STD_ALLOCATOR + +#if !defined(_STLP_MEMBER_TEMPLATE_CLASSES) || defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) +# define BOOST_NO_STD_ALLOCATOR +#endif + +#if defined(_STLP_NO_MEMBER_TEMPLATE_KEYWORD) && defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) +# define BOOST_NO_STD_ALLOCATOR +#endif + +// +// If STLport thinks there is no wchar_t at all, then we have to disable +// the support for the relevant specilazations of std:: templates. +// +#if !defined(_STLP_HAS_WCHAR_T) && !defined(_STLP_WCHAR_T_IS_USHORT) +# ifndef BOOST_NO_STD_WSTRING +# define BOOST_NO_STD_WSTRING +# endif +# ifndef BOOST_NO_STD_WSTREAMBUF +# define BOOST_NO_STD_WSTREAMBUF +# endif +#endif + +// +// We always have SGI style hash_set, hash_map, and slist: +// +#ifndef _STLP_NO_EXTENSIONS +#define BOOST_HAS_HASH +#define BOOST_HAS_SLIST +#endif + +// +// STLport does a good job of importing names into namespace std::, +// but doesn't always get them all, define BOOST_NO_STDC_NAMESPACE, since our +// workaround does not conflict with STLports: +// +// +// Harold Howe says: +// Borland switched to STLport in BCB6. Defining BOOST_NO_STDC_NAMESPACE with +// BCB6 does cause problems. If we detect C++ Builder, then don't define +// BOOST_NO_STDC_NAMESPACE +// +#if !defined(__BORLANDC__) && !defined(__DMC__) +// +// If STLport is using it's own namespace, and the real names are in +// the global namespace, then we duplicate STLport's using declarations +// (by defining BOOST_NO_STDC_NAMESPACE), we do this because STLport doesn't +// necessarily import all the names we need into namespace std:: +// +# if (defined(__STL_IMPORT_VENDOR_CSTD) \ + || defined(__STL_USE_OWN_NAMESPACE) \ + || defined(_STLP_IMPORT_VENDOR_CSTD) \ + || defined(_STLP_USE_OWN_NAMESPACE)) \ + && (defined(__STL_VENDOR_GLOBAL_CSTD) || defined (_STLP_VENDOR_GLOBAL_CSTD)) +# define BOOST_NO_STDC_NAMESPACE +# define BOOST_NO_EXCEPTION_STD_NAMESPACE +# endif +#elif defined(__BORLANDC__) && __BORLANDC__ < 0x560 +// STLport doesn't import std::abs correctly: +#include +namespace std { using ::abs; } +// and strcmp/strcpy don't get imported either ('cos they are macros) +#include +#ifdef strcpy +# undef strcpy +#endif +#ifdef strcmp +# undef strcmp +#endif +#ifdef _STLP_VENDOR_CSTD +namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; } +#endif +#endif + +// +// std::use_facet may be non-standard, uses a class instead: +// +#if defined(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) || defined(_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) +# define BOOST_NO_STD_USE_FACET +# define BOOST_HAS_STLP_USE_FACET +#endif + +// +// If STLport thinks there are no wide functions, etc. is not working; but +// only if BOOST_NO_STDC_NAMESPACE is not defined (if it is then we do the import +// into std:: ourselves). +// +#if defined(_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined(BOOST_NO_STDC_NAMESPACE) +# define BOOST_NO_CWCHAR +# define BOOST_NO_CWCTYPE +#endif + +// +// If STLport for some reason was configured so that it thinks that wchar_t +// is not an intrinsic type, then we have to disable the support for it as +// well (we would be missing required specializations otherwise). +// +#if !defined( _STLP_HAS_WCHAR_T) || defined(_STLP_WCHAR_T_IS_USHORT) +# undef BOOST_NO_INTRINSIC_WCHAR_T +# define BOOST_NO_INTRINSIC_WCHAR_T +#endif + +// +// Borland ships a version of STLport with C++ Builder 6 that lacks +// hashtables and the like: +// +#if defined(__BORLANDC__) && (__BORLANDC__ == 0x560) +# undef BOOST_HAS_HASH +#endif + +// +// gcc-2.95.3/STLPort does not like the using declarations we use to get ADL with std::min/max +// +#if defined(__GNUC__) && (__GNUC__ < 3) +# include // for std::min and std::max +# define BOOST_USING_STD_MIN() ((void)0) +# define BOOST_USING_STD_MAX() ((void)0) +namespace boost { using std::min; using std::max; } +#endif + +#define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/vacpp.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/vacpp.hpp new file mode 100644 index 0000000000..8321ee0ccf --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/stdlib/vacpp.hpp @@ -0,0 +1,18 @@ +// (C) Copyright John Maddock 2001 - 2002. +// 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 for most recent version. + +#if __IBMCPP__ <= 501 +# define BOOST_NO_STD_ALLOCATOR +#endif + +#define BOOST_HAS_MACRO_USE_FACET +#define BOOST_NO_STD_MESSAGES + +#define BOOST_STDLIB "Visual Age default standard library" + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/suffix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/suffix.hpp new file mode 100644 index 0000000000..f71c644f79 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/suffix.hpp @@ -0,0 +1,590 @@ +// Boost config.hpp configuration header file ------------------------------// + +// Copyright (c) 2001-2003 John Maddock +// Copyright (c) 2001 Darin Adler +// Copyright (c) 2001 Peter Dimov +// Copyright (c) 2002 Bill Kempf +// Copyright (c) 2002 Jens Maurer +// Copyright (c) 2002-2003 David Abrahams +// Copyright (c) 2003 Gennaro Prota +// Copyright (c) 2003 Eric Friedman +// +// 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. + +// Boost config.hpp policy and rationale documentation has been moved to +// http://www.boost.org/libs/config/ +// +// This file is intended to be stable, and relatively unchanging. +// It should contain boilerplate code only - no compiler specific +// code unless it is unavoidable - no changes unless unavoidable. + +#ifndef BOOST_CONFIG_SUFFIX_HPP +#define BOOST_CONFIG_SUFFIX_HPP + +// +// look for long long by looking for the appropriate macros in . +// Note that we use limits.h rather than climits for maximal portability, +// remember that since these just declare a bunch of macros, there should be +// no namespace issues from this. +// +#if !defined(BOOST_HAS_LONG_LONG) \ + && !defined(BOOST_MSVC) && !defined(__BORLANDC__) +# include +# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) +# define BOOST_HAS_LONG_LONG +# endif +#endif + +// GCC 3.x will clean up all of those nasty macro definitions that +// BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine +// it under GCC 3.x. +#if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS) +# undef BOOST_NO_CTYPE_FUNCTIONS +#endif + +// +// Assume any extensions are in namespace std:: unless stated otherwise: +// +# ifndef BOOST_STD_EXTENSION_NAMESPACE +# define BOOST_STD_EXTENSION_NAMESPACE std +# endif + +// +// If cv-qualified specializations are not allowed, then neither are cv-void ones: +// +# if defined(BOOST_NO_CV_SPECIALIZATIONS) \ + && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) +# define BOOST_NO_CV_VOID_SPECIALIZATIONS +# endif + +// +// If there is no numeric_limits template, then it can't have any compile time +// constants either! +// +# if defined(BOOST_NO_LIMITS) \ + && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS +# endif + +// +// if there is no long long then there is no specialisation +// for numeric_limits either: +// +#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS) +# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS +#endif + +// +// if there is no __int64 then there is no specialisation +// for numeric_limits<__int64> either: +// +#if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS) +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +#endif + +// +// if member templates are supported then so is the +// VC6 subset of member templates: +// +# if !defined(BOOST_NO_MEMBER_TEMPLATES) \ + && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) +# define BOOST_MSVC6_MEMBER_TEMPLATES +# endif + +// +// Without partial specialization, can't test for partial specialisation bugs: +// +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) +# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG +# endif + +// +// Without partial specialization, we can't have array-type partial specialisations: +// +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +# endif + +// +// Without partial specialization, std::iterator_traits can't work: +// +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_NO_STD_ITERATOR_TRAITS) +# define BOOST_NO_STD_ITERATOR_TRAITS +# endif + +// +// Without partial specialization, partial +// specialization with default args won't work either: +// +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) +# define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS +# endif + +// +// Without member template support, we can't have template constructors +// in the standard library either: +// +# if defined(BOOST_NO_MEMBER_TEMPLATES) \ + && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ + && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# endif + +// +// Without member template support, we can't have a conforming +// std::allocator template either: +// +# if defined(BOOST_NO_MEMBER_TEMPLATES) \ + && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ + && !defined(BOOST_NO_STD_ALLOCATOR) +# define BOOST_NO_STD_ALLOCATOR +# endif + +// +// without ADL support then using declarations will break ADL as well: +// +#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#endif + +// +// Without typeid support we have no dynamic RTTI either: +// +#if defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) +# define BOOST_NO_RTTI +#endif + +// +// If we have a standard allocator, then we have a partial one as well: +// +#if !defined(BOOST_NO_STD_ALLOCATOR) +# define BOOST_HAS_PARTIAL_STD_ALLOCATOR +#endif + +// +// We can't have a working std::use_facet if there is no std::locale: +// +# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET) +# define BOOST_NO_STD_USE_FACET +# endif + +// +// We can't have a std::messages facet if there is no std::locale: +// +# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES) +# define BOOST_NO_STD_MESSAGES +# endif + +// +// We can't have a working std::wstreambuf if there is no std::locale: +// +# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) +# define BOOST_NO_STD_WSTREAMBUF +# endif + +// +// We can't have a if there is no : +// +# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE) +# define BOOST_NO_CWCTYPE +# endif + +// +// We can't have a swprintf if there is no : +// +# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF) +# define BOOST_NO_SWPRINTF +# endif + +// +// If Win32 support is turned off, then we must turn off +// threading support also, unless there is some other +// thread API enabled: +// +#if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \ + && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS) +# define BOOST_DISABLE_THREADS +#endif + +// +// Turn on threading support if the compiler thinks that it's in +// multithreaded mode. We put this here because there are only a +// limited number of macros that identify this (if there's any missing +// from here then add to the appropriate compiler section): +// +#if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ + || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS) +# define BOOST_HAS_THREADS +#endif + +// +// Turn threading support off if BOOST_DISABLE_THREADS is defined: +// +#if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS) +# undef BOOST_HAS_THREADS +#endif + +// +// Turn threading support off if we don't recognise the threading API: +// +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\ + && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\ + && !defined(BOOST_HAS_MPTASKS) +# undef BOOST_HAS_THREADS +#endif + +// +// Turn threading detail macros off if we don't (want to) use threading +// +#ifndef BOOST_HAS_THREADS +# undef BOOST_HAS_PTHREADS +# undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# undef BOOST_HAS_PTHREAD_YIELD +# undef BOOST_HAS_PTHREAD_DELAY_NP +# undef BOOST_HAS_WINTHREADS +# undef BOOST_HAS_BETHREADS +# undef BOOST_HAS_MPTASKS +#endif + +// +// If the compiler claims to be C99 conformant, then it had better +// have a : +// +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) +# define BOOST_HAS_STDINT_H +# ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +# endif +# ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +# endif +# endif + +// +// Define BOOST_NO_SLIST and BOOST_NO_HASH if required. +// Note that this is for backwards compatibility only. +// +# if !defined(BOOST_HAS_SLIST) && !defined(BOOST_NO_SLIST) +# define BOOST_NO_SLIST +# endif + +# if !defined(BOOST_HAS_HASH) && !defined(BOOST_NO_HASH) +# define BOOST_NO_HASH +# endif + +// +// Set BOOST_SLIST_HEADER if not set already: +// +#if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER) +# define BOOST_SLIST_HEADER +#endif + +// +// Set BOOST_HASH_SET_HEADER if not set already: +// +#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER) +# define BOOST_HASH_SET_HEADER +#endif + +// +// Set BOOST_HASH_MAP_HEADER if not set already: +// +#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER) +# define BOOST_HASH_MAP_HEADER +#endif + +// BOOST_HAS_ABI_HEADERS +// This macro gets set if we have headers that fix the ABI, +// and prevent ODR violations when linking to external libraries: +#if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS) +# define BOOST_HAS_ABI_HEADERS +#endif + +#if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS) +# undef BOOST_HAS_ABI_HEADERS +#endif + +// BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// +// Because std::size_t usage is so common, even in boost headers which do not +// otherwise use the C library, the workaround is included here so +// that ugly workaround code need not appear in many other boost headers. +// NOTE WELL: This is a workaround for non-conforming compilers; +// must still be #included in the usual places so that inclusion +// works as expected with standard conforming compilers. The resulting +// double inclusion of is harmless. + +# ifdef BOOST_NO_STDC_NAMESPACE +# include + namespace std { using ::ptrdiff_t; using ::size_t; } +# endif + +// Workaround for the unfortunate min/max macros defined by some platform headers + +#define BOOST_PREVENT_MACRO_SUBSTITUTION + +#ifndef BOOST_USING_STD_MIN +# define BOOST_USING_STD_MIN() using std::min +#endif + +#ifndef BOOST_USING_STD_MAX +# define BOOST_USING_STD_MAX() using std::max +#endif + +// BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// + +# ifdef BOOST_NO_STD_MIN_MAX + +namespace std { + template + inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { + return __b < __a ? __b : __a; + } + template + inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { + return __a < __b ? __b : __a; + } +} + +# endif + +// BOOST_STATIC_CONSTANT workaround --------------------------------------- // +// On compilers which don't allow in-class initialization of static integral +// constant members, we must use enums as a workaround if we want the constants +// to be available at compile-time. This macro gives us a convenient way to +// declare such constants. + +# ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } +# else +# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment +# endif + +// BOOST_USE_FACET / HAS_FACET workaround ----------------------------------// +// When the standard library does not have a conforming std::use_facet there +// are various workarounds available, but they differ from library to library. +// The same problem occurs with has_facet. +// These macros provide a consistent way to access a locale's facets. +// Usage: +// replace +// std::use_facet(loc); +// with +// BOOST_USE_FACET(Type, loc); +// Note do not add a std:: prefix to the front of BOOST_USE_FACET! +// Use for BOOST_HAS_FACET is analogous. + +#if defined(BOOST_NO_STD_USE_FACET) +# ifdef BOOST_HAS_TWO_ARG_USE_FACET +# define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast(0)) +# define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast(0)) +# elif defined(BOOST_HAS_MACRO_USE_FACET) +# define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type) +# define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type) +# elif defined(BOOST_HAS_STLP_USE_FACET) +# define BOOST_USE_FACET(Type, loc) (*std::_Use_facet(loc)) +# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) +# endif +#else +# define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc) +# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) +#endif + +// BOOST_NESTED_TEMPLATE workaround ------------------------------------------// +// Member templates are supported by some compilers even though they can't use +// the A::template member syntax, as a workaround replace: +// +// typedef typename A::template rebind binder; +// +// with: +// +// typedef typename A::BOOST_NESTED_TEMPLATE rebind binder; + +#ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD +# define BOOST_NESTED_TEMPLATE template +#else +# define BOOST_NESTED_TEMPLATE +#endif + +// BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------// +// Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION +// is defined, in which case it evaluates to return x; Use when you have a return +// statement that can never be reached. + +#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION +# define BOOST_UNREACHABLE_RETURN(x) return x; +#else +# define BOOST_UNREACHABLE_RETURN(x) +#endif + +// BOOST_DEDUCED_TYPENAME workaround ------------------------------------------// +// +// Some compilers don't support the use of `typename' for dependent +// types in deduced contexts, e.g. +// +// template void f(T, typename T::type); +// ^^^^^^^^ +// Replace these declarations with: +// +// template void f(T, BOOST_DEDUCED_TYPENAME T::type); + +#ifndef BOOST_NO_DEDUCED_TYPENAME +# define BOOST_DEDUCED_TYPENAME typename +#else +# define BOOST_DEDUCED_TYPENAME +#endif + +#ifndef BOOST_NO_TYPENAME_WITH_CTOR +# define BOOST_CTOR_TYPENAME typename +#else +# define BOOST_CTOR_TYPENAME +#endif + +// long long workaround ------------------------------------------// +// On gcc (and maybe other compilers?) long long is alway supported +// but it's use may generate either warnings (with -ansi), or errors +// (with -pedantic -ansi) unless it's use is prefixed by __extension__ +// +#if defined(BOOST_HAS_LONG_LONG) +namespace boost{ +# ifdef __GNUC__ + __extension__ typedef long long long_long_type; + __extension__ typedef unsigned long long ulong_long_type; +# else + typedef long long long_long_type; + typedef unsigned long long ulong_long_type; +# endif +} +#endif + +// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// +// +// Some compilers have problems with function templates whose template +// parameters don't appear in the function parameter list (basically +// they just link one instantiation of the template in the final +// executable). These macros provide a uniform way to cope with the +// problem with no effects on the calling syntax. + +// Example: +// +// #include +// #include +// #include +// +// template +// void f() { std::cout << n << ' '; } +// +// template +// void g() { std::cout << typeid(T).name() << ' '; } +// +// int main() { +// f<1>(); +// f<2>(); +// +// g(); +// g(); +// } +// +// With VC++ 6.0 the output is: +// +// 2 2 double double +// +// To fix it, write +// +// template +// void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... } +// +// template +// void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... } +// + + +#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS + +# include "boost/type.hpp" +# include "boost/non_type.hpp" + +# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type* = 0 +# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type* +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type* = 0 +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type* + +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ + , BOOST_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ + , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ + , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ + , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + +#else + +// no workaround needed: expand to nothing + +# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + + +#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS + + +// ---------------------------------------------------------------------------// + +// +// Helper macro BOOST_STRINGIZE: +// Converts the parameter X to a string after macro replacement +// on X has been performed. +// +#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) +#define BOOST_DO_STRINGIZE(X) #X + +// +// Helper macro BOOST_JOIN: +// The following piece of macro magic joins the two +// arguments together, even when one of the arguments is +// itself a macro (see 16.3.1 in C++ standard). The key +// is that macro expansion of macro arguments does not +// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. +// +#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) +#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) +#define BOOST_DO_JOIN2( X, Y ) X##Y + +// +// Set some default values for compiler/library/platform names. +// These are for debugging config setup only: +// +# ifndef BOOST_COMPILER +# define BOOST_COMPILER "Unknown ISO C++ Compiler" +# endif +# ifndef BOOST_STDLIB +# define BOOST_STDLIB "Unknown ISO standard library" +# endif +# ifndef BOOST_PLATFORM +# if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \ + || defined(_POSIX_SOURCE) +# define BOOST_PLATFORM "Generic Unix" +# else +# define BOOST_PLATFORM "Unknown" +# endif +# endif + +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/user.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/user.hpp new file mode 100644 index 0000000000..5a4a9d4776 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/user.hpp @@ -0,0 +1,124 @@ +// boost/config/user.hpp ---------------------------------------------------// + +// (C) Copyright John Maddock 2001. +// 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) + +// Do not check in modified versions of this file, +// This file may be customized by the end user, but not by boost. + +// +// Use this file to define a site and compiler specific +// configuration policy: +// + +// define this to locate a compiler config file: +// #define BOOST_COMPILER_CONFIG + +// define this to locate a stdlib config file: +// #define BOOST_STDLIB_CONFIG + +// define this to locate a platform config file: +// #define BOOST_PLATFORM_CONFIG + +// define this to disable compiler config, +// use if your compiler config has nothing to set: +// #define BOOST_NO_COMPILER_CONFIG + +// define this to disable stdlib config, +// use if your stdlib config has nothing to set: +// #define BOOST_NO_STDLIB_CONFIG + +// define this to disable platform config, +// use if your platform config has nothing to set: +// #define BOOST_NO_PLATFORM_CONFIG + +// define this to disable all config options, +// excluding the user config. Use if your +// setup is fully ISO compliant, and has no +// useful extensions, or for autoconf generated +// setups: +// #define BOOST_NO_CONFIG + +// define this to make the config "optimistic" +// about unknown compiler versions. Normally +// unknown compiler versions are assumed to have +// all the defects of the last known version, however +// setting this flag, causes the config to assume +// that unknown compiler versions are fully conformant +// with the standard: +// #define BOOST_STRICT_CONFIG + +// define this to cause the config to halt compilation +// with an #error if it encounters anything unknown -- +// either an unknown compiler version or an unknown +// compiler/platform/library: +// #define BOOST_ASSERT_CONFIG + + +// define if you want to disable threading support, even +// when available: +// #define BOOST_DISABLE_THREADS + +// define when you want to disable Win32 specific features +// even when available: +// #define BOOST_DISABLE_WIN32 + +// BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any +// prefix/suffix headers that normally control things like struct +// packing and alignment. +// #define BOOST_DISABLE_ABI_HEADERS + +// BOOST_ABI_PREFIX: A prefix header to include in place of whatever +// boost.config would normally select, any replacement should set up +// struct packing and alignment options as required. +// #define BOOST_ABI_PREFIX my-header-name + +// BOOST_ABI_SUFFIX: A suffix header to include in place of whatever +// boost.config would normally select, any replacement should undo +// the effects of the prefix header. +// #define BOOST_ABI_SUFFIX my-header-name + +// BOOST_ALL_DYN_LINK: Forces all libraries that have separate source, +// to be linked as dll's rather than static libraries on Microsoft Windows +// (this macro is used to turn on __declspec(dllimport) modifiers, so that +// the compiler knows which symbols to look for in a dll rather than in a +// static library). Note that there may be some libraries that can only +// be statically linked (Boost.Test for example) and others which may only +// be dynamically linked (Boost.Threads for example), in these cases this +// macro has no effect. +// #define BOOST_ALL_DYN_LINK + +// BOOST_WHATEVER_DYN_LINK: Forces library "whatever" to be linked as a dll +// rather than a static library on Microsoft Windows: replace the WHATEVER +// part of the macro name with the name of the library that you want to +// dynamically link to, for example use BOOST_DATE_TIME_DYN_LINK or +// BOOST_REGEX_DYN_LINK etc (this macro is used to turn on __declspec(dllimport) +// modifiers, so that the compiler knows which symbols to look for in a dll +// rather than in a static library). +// Note that there may be some libraries that can only be statically linked +// (Boost.Test for example) and others which may only be dynamically linked +// (Boost.Threads for example), in these cases this macro is unsupported. +// #define BOOST_WHATEVER_DYN_LINK + +// BOOST_ALL_NO_LIB: Tells the config system not to automatically select +// which libraries to link against. +// Normally if a compiler supports #pragma lib, then the correct library +// build variant will be automatically selected and linked against, +// simply by the act of including one of that library's headers. +// This macro turns that feature off. +// #define BOOST_ALL_NO_LIB + +// BOOST_WHATEVER_NO_LIB: Tells the config system not to automatically +// select which library to link against for library "whatever", +// replace WHATEVER in the macro name with the name of the library; +// for example BOOST_DATE_TIME_NO_LIB or BOOST_REGEX_NO_LIB. +// Normally if a compiler supports #pragma lib, then the correct library +// build variant will be automatically selected and linked against, simply +// by the act of including one of that library's headers. This macro turns +// that feature off. +// #define BOOST_WHATEVER_NO_LIB + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/config/warning_disable.hpp b/deal.II/contrib/boost/include/boost-1.37.0/config/warning_disable.hpp new file mode 100644 index 0000000000..26ff1323c0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/config/warning_disable.hpp @@ -0,0 +1,47 @@ +// Copyright John Maddock 2008 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// This file exists to turn off some overly-pedantic warning emitted +// by certain compilers. You should include this header only in: +// +// * A test case, before any other headers, or, +// * A library source file before any other headers. +// +// IT SHOULD NOT BE INCLUDED BY ANY BOOST HEADER. +// +// YOU SHOULD NOT INCLUDE IT IF YOU CAN REASONABLY FIX THE WARNING. +// +// The only warnings disabled here are those that are: +// +// * Quite unreasonably pedantic. +// * Generally only emitted by a single compiler. +// * Can't easily be fixed: for example if the vendors own std lib +// code emits these warnings! +// +// Note that THIS HEADER MUST NOT INCLUDE ANY OTHER HEADERS: +// not even std library ones! Doing so may turn the warning +// off too late to be of any use. For example the VC++ C4996 +// warning can be omitted from if that header is included +// before or by this one :-( +// + +#ifndef BOOST_CONFIG_WARNING_DISABLE_HPP +#define BOOST_CONFIG_WARNING_DISABLE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + // Error 'function': was declared deprecated + // http://msdn2.microsoft.com/en-us/library/ttcz0bys(VS.80).aspx + // This error is emitted when you use some perfectly conforming + // std lib functions in a perfectly correct way, and also by + // some of Microsoft's own std lib code ! +# pragma warning(disable:4996) +#endif +#if defined(__INTEL_COMPILER) || defined(__ICL) + // As above: gives warning when a "deprecated" + // std library function is encountered. +# pragma warning(disable:1786) +#endif + +#endif // BOOST_CONFIG_WARNING_DISABLE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/crc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/crc.hpp new file mode 100644 index 0000000000..e70c834033 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/crc.hpp @@ -0,0 +1,1106 @@ +// Boost CRC library crc.hpp header file -----------------------------------// + +// Copyright 2001, 2004 Daryle Walker. Use, modification, and distribution are +// subject to the Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or a copy at .) + +// See for the library's home page. + +#ifndef BOOST_CRC_HPP +#define BOOST_CRC_HPP + +#include // for BOOST_STATIC_CONSTANT, etc. +#include // for boost::uint_t + +#include // for CHAR_BIT, etc. +#include // for std::size_t + +#include // for std::numeric_limits + + +// The type of CRC parameters that can go in a template should be related +// on the CRC's bit count. This macro expresses that type in a compact +// form, but also allows an alternate type for compilers that don't support +// dependent types (in template value-parameters). +#if !(defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) || (defined(BOOST_MSVC) && (BOOST_MSVC <= 1300))) +#define BOOST_CRC_PARM_TYPE typename ::boost::uint_t::fast +#else +#define BOOST_CRC_PARM_TYPE unsigned long +#endif + +// Some compilers [MS VC++ 6] cannot correctly set up several versions of a +// function template unless every template argument can be unambiguously +// deduced from the function arguments. (The bug is hidden if only one version +// is needed.) Since all of the CRC function templates have this problem, the +// workaround is to make up a dummy function argument that encodes the template +// arguments. Calls to such template functions need all their template +// arguments explicitly specified. At least one compiler that needs this +// workaround also needs the default value for the dummy argument to be +// specified in the definition. +#if defined(__GNUC__) || !defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) +#define BOOST_CRC_DUMMY_PARM_TYPE +#define BOOST_CRC_DUMMY_INIT +#define BOOST_ACRC_DUMMY_PARM_TYPE +#define BOOST_ACRC_DUMMY_INIT +#else +namespace boost { namespace detail { + template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > + struct dummy_crc_argument { }; +} } +#define BOOST_CRC_DUMMY_PARM_TYPE , detail::dummy_crc_argument *p_ +#define BOOST_CRC_DUMMY_INIT BOOST_CRC_DUMMY_PARM_TYPE = 0 +#define BOOST_ACRC_DUMMY_PARM_TYPE , detail::dummy_crc_argument *p_ +#define BOOST_ACRC_DUMMY_INIT BOOST_ACRC_DUMMY_PARM_TYPE = 0 +#endif + + +namespace boost +{ + + +// Forward declarations ----------------------------------------------------// + +template < std::size_t Bits > + class crc_basic; + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly = 0u, + BOOST_CRC_PARM_TYPE InitRem = 0u, + BOOST_CRC_PARM_TYPE FinalXor = 0u, bool ReflectIn = false, + bool ReflectRem = false > + class crc_optimal; + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > + typename uint_t::fast crc( void const *buffer, + std::size_t byte_count + BOOST_CRC_DUMMY_PARM_TYPE ); + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly > + typename uint_t::fast augmented_crc( void const *buffer, + std::size_t byte_count, typename uint_t::fast initial_remainder + BOOST_ACRC_DUMMY_PARM_TYPE ); + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly > + typename uint_t::fast augmented_crc( void const *buffer, + std::size_t byte_count + BOOST_ACRC_DUMMY_PARM_TYPE ); + +typedef crc_optimal<16, 0x8005, 0, 0, true, true> crc_16_type; +typedef crc_optimal<16, 0x1021, 0xFFFF, 0, false, false> crc_ccitt_type; +typedef crc_optimal<16, 0x8408, 0, 0, true, true> crc_xmodem_type; + +typedef crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, true> + crc_32_type; + + +// Forward declarations for implementation detail stuff --------------------// +// (Just for the stuff that will be needed for the next two sections) + +namespace detail +{ + template < std::size_t Bits > + struct mask_uint_t; + + template < > + struct mask_uint_t< std::numeric_limits::digits >; + + #if USHRT_MAX > UCHAR_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits >; + #endif + + #if UINT_MAX > USHRT_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits >; + #endif + + #if ULONG_MAX > UINT_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits >; + #endif + + template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect > + struct crc_table_t; + + template < std::size_t Bits, bool DoReflect > + class crc_helper; + + #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < std::size_t Bits > + class crc_helper< Bits, false >; + #endif + +} // namespace detail + + +// Simple cyclic redundancy code (CRC) class declaration -------------------// + +template < std::size_t Bits > +class crc_basic +{ + // Implementation type + typedef detail::mask_uint_t masking_type; + +public: + // Type + typedef typename masking_type::least value_type; + + // Constant for the template parameter + BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + + // Constructor + explicit crc_basic( value_type truncated_polynominal, + value_type initial_remainder = 0, value_type final_xor_value = 0, + bool reflect_input = false, bool reflect_remainder = false ); + + // Internal Operations + value_type get_truncated_polynominal() const; + value_type get_initial_remainder() const; + value_type get_final_xor_value() const; + bool get_reflect_input() const; + bool get_reflect_remainder() const; + + value_type get_interim_remainder() const; + void reset( value_type new_rem ); + void reset(); + + // External Operations + void process_bit( bool bit ); + void process_bits( unsigned char bits, std::size_t bit_count ); + void process_byte( unsigned char byte ); + void process_block( void const *bytes_begin, void const *bytes_end ); + void process_bytes( void const *buffer, std::size_t byte_count ); + + value_type checksum() const; + +private: + // Member data + value_type rem_; + value_type poly_, init_, final_; // non-const to allow assignability + bool rft_in_, rft_out_; // non-const to allow assignability + +}; // boost::crc_basic + + +// Optimized cyclic redundancy code (CRC) class declaration ----------------// + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +class crc_optimal +{ + // Implementation type + typedef detail::mask_uint_t masking_type; + +public: + // Type + typedef typename masking_type::fast value_type; + + // Constants for the template parameters + BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + BOOST_STATIC_CONSTANT( value_type, truncated_polynominal = TruncPoly ); + BOOST_STATIC_CONSTANT( value_type, initial_remainder = InitRem ); + BOOST_STATIC_CONSTANT( value_type, final_xor_value = FinalXor ); + BOOST_STATIC_CONSTANT( bool, reflect_input = ReflectIn ); + BOOST_STATIC_CONSTANT( bool, reflect_remainder = ReflectRem ); + + // Constructor + explicit crc_optimal( value_type init_rem = InitRem ); + + // Internal Operations + value_type get_truncated_polynominal() const; + value_type get_initial_remainder() const; + value_type get_final_xor_value() const; + bool get_reflect_input() const; + bool get_reflect_remainder() const; + + value_type get_interim_remainder() const; + void reset( value_type new_rem = InitRem ); + + // External Operations + void process_byte( unsigned char byte ); + void process_block( void const *bytes_begin, void const *bytes_end ); + void process_bytes( void const *buffer, std::size_t byte_count ); + + value_type checksum() const; + + // Operators + void operator ()( unsigned char byte ); + value_type operator ()() const; + +private: + // The implementation of output reflection depends on both reflect states. + BOOST_STATIC_CONSTANT( bool, reflect_output = (ReflectRem != ReflectIn) ); + + #ifndef __BORLANDC__ + #define BOOST_CRC_REF_OUT_VAL reflect_output + #else + typedef crc_optimal self_type; + #define BOOST_CRC_REF_OUT_VAL (self_type::reflect_output) + #endif + + // More implementation types + typedef detail::crc_table_t crc_table_type; + typedef detail::crc_helper helper_type; + typedef detail::crc_helper reflect_out_type; + + #undef BOOST_CRC_REF_OUT_VAL + + // Member data + value_type rem_; + +}; // boost::crc_optimal + + +// Implementation detail stuff ---------------------------------------------// + +namespace detail +{ + // Forward declarations for more implementation details + template < std::size_t Bits > + struct high_uint_t; + + template < std::size_t Bits > + struct reflector; + + + // Traits class for mask; given the bit number + // (1-based), get the mask for that bit by itself. + template < std::size_t Bits > + struct high_uint_t + : boost::uint_t< Bits > + { + typedef boost::uint_t base_type; + typedef typename base_type::least least; + typedef typename base_type::fast fast; + +#if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243 + static const least high_bit = 1ul << ( Bits - 1u ); + static const fast high_bit_fast = 1ul << ( Bits - 1u ); +#else + BOOST_STATIC_CONSTANT( least, high_bit = (least( 1u ) << ( Bits + - 1u )) ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = (fast( 1u ) << ( Bits + - 1u )) ); +#endif + + }; // boost::detail::high_uint_t + + + // Reflection routine class wrapper + // (since MS VC++ 6 couldn't handle the unwrapped version) + template < std::size_t Bits > + struct reflector + { + typedef typename boost::uint_t::fast value_type; + + static value_type reflect( value_type x ); + + }; // boost::detail::reflector + + // Function that reflects its argument + template < std::size_t Bits > + typename reflector::value_type + reflector::reflect + ( + typename reflector::value_type x + ) + { + value_type reflection = 0; + value_type const one = 1; + + for ( std::size_t i = 0 ; i < Bits ; ++i, x >>= 1 ) + { + if ( x & one ) + { + reflection |= ( one << (Bits - 1u - i) ); + } + } + + return reflection; + } + + + // Traits class for masks; given the bit number (1-based), + // get the mask for that bit and its lower bits. + template < std::size_t Bits > + struct mask_uint_t + : high_uint_t< Bits > + { + typedef high_uint_t base_type; + typedef typename base_type::least least; + typedef typename base_type::fast fast; + + #ifndef __BORLANDC__ + using base_type::high_bit; + using base_type::high_bit_fast; + #else + BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast ); + #endif + +#if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243 + static const least sig_bits = (~( ~( 0ul ) << Bits )) ; +#else + BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) ); +#endif +#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 + // Work around a weird bug that ICEs the compiler in build_c_cast + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = static_cast(sig_bits) ); +#else + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); +#endif + }; // boost::detail::mask_uint_t + + template < > + struct mask_uint_t< std::numeric_limits::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::digits> + base_type; + typedef base_type::least least; + typedef base_type::fast fast; + + #ifndef __BORLANDC__ + using base_type::high_bit; + using base_type::high_bit_fast; + #else + BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast ); + #endif + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + }; // boost::detail::mask_uint_t + + #if USHRT_MAX > UCHAR_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::digits> + base_type; + typedef base_type::least least; + typedef base_type::fast fast; + + #ifndef __BORLANDC__ + using base_type::high_bit; + using base_type::high_bit_fast; + #else + BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast ); + #endif + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + }; // boost::detail::mask_uint_t + #endif + + #if UINT_MAX > USHRT_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::digits> + base_type; + typedef base_type::least least; + typedef base_type::fast fast; + + #ifndef __BORLANDC__ + using base_type::high_bit; + using base_type::high_bit_fast; + #else + BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast ); + #endif + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + }; // boost::detail::mask_uint_t + #endif + + #if ULONG_MAX > UINT_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::digits> + base_type; + typedef base_type::least least; + typedef base_type::fast fast; + + #ifndef __BORLANDC__ + using base_type::high_bit; + using base_type::high_bit_fast; + #else + BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast ); + #endif + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + }; // boost::detail::mask_uint_t + #endif + + + // CRC table generator + template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect > + struct crc_table_t + { + BOOST_STATIC_CONSTANT( std::size_t, byte_combos = (1ul << CHAR_BIT) ); + + typedef mask_uint_t masking_type; + typedef typename masking_type::fast value_type; +#if defined(__BORLANDC__) && defined(_M_IX86) && (__BORLANDC__ == 0x560) + // for some reason Borland's command line compiler (version 0x560) + // chokes over this unless we do the calculation for it: + typedef value_type table_type[ 0x100 ]; +#else + typedef value_type table_type[ byte_combos ]; +#endif + + static void init_table(); + + static table_type table_; + + }; // boost::detail::crc_table_t + + // CRC table generator static data member definition + // (Some compilers [Borland C++] require the initializer to be present.) + template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect > + typename crc_table_t::table_type + crc_table_t::table_ + = { 0 }; + + // Populate CRC lookup table + template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect > + void + crc_table_t::init_table + ( + ) + { + // compute table only on the first run + static bool did_init = false; + if ( did_init ) return; + + // factor-out constants to avoid recalculation + value_type const fast_hi_bit = masking_type::high_bit_fast; + unsigned char const byte_hi_bit = 1u << (CHAR_BIT - 1u); + + // loop over every possible dividend value + unsigned char dividend = 0; + do + { + value_type remainder = 0; + + // go through all the dividend's bits + for ( unsigned char mask = byte_hi_bit ; mask ; mask >>= 1 ) + { + // check if divisor fits + if ( dividend & mask ) + { + remainder ^= fast_hi_bit; + } + + // do polynominal division + if ( remainder & fast_hi_bit ) + { + remainder <<= 1; + remainder ^= TruncPoly; + } + else + { + remainder <<= 1; + } + } + + table_[ crc_helper::reflect(dividend) ] + = crc_helper::reflect( remainder ); + } + while ( ++dividend ); + + did_init = true; + } + + #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // Align the msb of the remainder to a byte + template < std::size_t Bits, bool RightShift > + class remainder + { + public: + typedef typename uint_t::fast value_type; + + static unsigned char align_msb( value_type rem ) + { return rem >> (Bits - CHAR_BIT); } + }; + + // Specialization for the case that the remainder has less + // bits than a byte: align the remainder msb to the byte msb + template < std::size_t Bits > + class remainder< Bits, false > + { + public: + typedef typename uint_t::fast value_type; + + static unsigned char align_msb( value_type rem ) + { return rem << (CHAR_BIT - Bits); } + }; + #endif + + // CRC helper routines + template < std::size_t Bits, bool DoReflect > + class crc_helper + { + public: + // Type + typedef typename uint_t::fast value_type; + + #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // Possibly reflect a remainder + static value_type reflect( value_type x ) + { return detail::reflector::reflect( x ); } + + // Compare a byte to the remainder's highest byte + static unsigned char index( value_type rem, unsigned char x ) + { return x ^ rem; } + + // Shift out the remainder's highest byte + static value_type shift( value_type rem ) + { return rem >> CHAR_BIT; } + #else + // Possibly reflect a remainder + static value_type reflect( value_type x ) + { return DoReflect ? detail::reflector::reflect( x ) : x; } + + // Compare a byte to the remainder's highest byte + static unsigned char index( value_type rem, unsigned char x ) + { return x ^ ( DoReflect ? rem : + ((Bits>CHAR_BIT)?( rem >> (Bits - CHAR_BIT) ) : + ( rem << (CHAR_BIT - Bits) ))); } + + // Shift out the remainder's highest byte + static value_type shift( value_type rem ) + { return DoReflect ? rem >> CHAR_BIT : rem << CHAR_BIT; } + #endif + + }; // boost::detail::crc_helper + + #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < std::size_t Bits > + class crc_helper + { + public: + // Type + typedef typename uint_t::fast value_type; + + // Possibly reflect a remainder + static value_type reflect( value_type x ) + { return x; } + + // Compare a byte to the remainder's highest byte + static unsigned char index( value_type rem, unsigned char x ) + { return x ^ remainderCHAR_BIT)>::align_msb( rem ); } + + // Shift out the remainder's highest byte + static value_type shift( value_type rem ) + { return rem << CHAR_BIT; } + + }; // boost::detail::crc_helper + #endif + + +} // namespace detail + + +// Simple CRC class function definitions -----------------------------------// + +template < std::size_t Bits > +inline +crc_basic::crc_basic +( + typename crc_basic::value_type truncated_polynominal, + typename crc_basic::value_type initial_remainder, // = 0 + typename crc_basic::value_type final_xor_value, // = 0 + bool reflect_input, // = false + bool reflect_remainder // = false +) + : rem_( initial_remainder ), poly_( truncated_polynominal ) + , init_( initial_remainder ), final_( final_xor_value ) + , rft_in_( reflect_input ), rft_out_( reflect_remainder ) +{ +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::get_truncated_polynominal +( +) const +{ + return poly_; +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::get_initial_remainder +( +) const +{ + return init_; +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::get_final_xor_value +( +) const +{ + return final_; +} + +template < std::size_t Bits > +inline +bool +crc_basic::get_reflect_input +( +) const +{ + return rft_in_; +} + +template < std::size_t Bits > +inline +bool +crc_basic::get_reflect_remainder +( +) const +{ + return rft_out_; +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::get_interim_remainder +( +) const +{ + return rem_ & masking_type::sig_bits; +} + +template < std::size_t Bits > +inline +void +crc_basic::reset +( + typename crc_basic::value_type new_rem +) +{ + rem_ = new_rem; +} + +template < std::size_t Bits > +inline +void +crc_basic::reset +( +) +{ + this->reset( this->get_initial_remainder() ); +} + +template < std::size_t Bits > +inline +void +crc_basic::process_bit +( + bool bit +) +{ + value_type const high_bit_mask = masking_type::high_bit; + + // compare the new bit with the remainder's highest + rem_ ^= ( bit ? high_bit_mask : 0u ); + + // a full polynominal division step is done when the highest bit is one + bool const do_poly_div = static_cast( rem_ & high_bit_mask ); + + // shift out the highest bit + rem_ <<= 1; + + // carry out the division, if needed + if ( do_poly_div ) + { + rem_ ^= poly_; + } +} + +template < std::size_t Bits > +void +crc_basic::process_bits +( + unsigned char bits, + std::size_t bit_count +) +{ + // ignore the bits above the ones we want + bits <<= CHAR_BIT - bit_count; + + // compute the CRC for each bit, starting with the upper ones + unsigned char const high_bit_mask = 1u << ( CHAR_BIT - 1u ); + for ( std::size_t i = bit_count ; i > 0u ; --i, bits <<= 1u ) + { + process_bit( static_cast(bits & high_bit_mask) ); + } +} + +template < std::size_t Bits > +inline +void +crc_basic::process_byte +( + unsigned char byte +) +{ + process_bits( (rft_in_ ? detail::reflector::reflect(byte) + : byte), CHAR_BIT ); +} + +template < std::size_t Bits > +void +crc_basic::process_block +( + void const * bytes_begin, + void const * bytes_end +) +{ + for ( unsigned char const * p + = static_cast(bytes_begin) ; p < bytes_end ; ++p ) + { + process_byte( *p ); + } +} + +template < std::size_t Bits > +inline +void +crc_basic::process_bytes +( + void const * buffer, + std::size_t byte_count +) +{ + unsigned char const * const b = static_cast( + buffer ); + + process_block( b, b + byte_count ); +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::checksum +( +) const +{ + return ( (rft_out_ ? detail::reflector::reflect( rem_ ) : rem_) + ^ final_ ) & masking_type::sig_bits; +} + + +// Optimized CRC class function definitions --------------------------------// + +// Macro to compact code +#define BOOST_CRC_OPTIMAL_NAME crc_optimal + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +BOOST_CRC_OPTIMAL_NAME::crc_optimal +( + typename BOOST_CRC_OPTIMAL_NAME::value_type init_rem // = InitRem +) + : rem_( helper_type::reflect(init_rem) ) +{ + crc_table_type::init_table(); +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +typename BOOST_CRC_OPTIMAL_NAME::value_type +BOOST_CRC_OPTIMAL_NAME::get_truncated_polynominal +( +) const +{ + return TruncPoly; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +typename BOOST_CRC_OPTIMAL_NAME::value_type +BOOST_CRC_OPTIMAL_NAME::get_initial_remainder +( +) const +{ + return InitRem; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +typename BOOST_CRC_OPTIMAL_NAME::value_type +BOOST_CRC_OPTIMAL_NAME::get_final_xor_value +( +) const +{ + return FinalXor; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +bool +BOOST_CRC_OPTIMAL_NAME::get_reflect_input +( +) const +{ + return ReflectIn; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +bool +BOOST_CRC_OPTIMAL_NAME::get_reflect_remainder +( +) const +{ + return ReflectRem; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +typename BOOST_CRC_OPTIMAL_NAME::value_type +BOOST_CRC_OPTIMAL_NAME::get_interim_remainder +( +) const +{ + // Interim remainder should be _un_-reflected, so we have to undo it. + return helper_type::reflect( rem_ ) & masking_type::sig_bits_fast; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +void +BOOST_CRC_OPTIMAL_NAME::reset +( + typename BOOST_CRC_OPTIMAL_NAME::value_type new_rem // = InitRem +) +{ + rem_ = helper_type::reflect( new_rem ); +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +void +BOOST_CRC_OPTIMAL_NAME::process_byte +( + unsigned char byte +) +{ + process_bytes( &byte, sizeof(byte) ); +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +void +BOOST_CRC_OPTIMAL_NAME::process_block +( + void const * bytes_begin, + void const * bytes_end +) +{ + // Recompute the CRC for each byte passed + for ( unsigned char const * p + = static_cast(bytes_begin) ; p < bytes_end ; ++p ) + { + // Compare the new byte with the remainder's higher bits to + // get the new bits, shift out the remainder's current higher + // bits, and update the remainder with the polynominal division + // of the new bits. + unsigned char const byte_index = helper_type::index( rem_, *p ); + rem_ = helper_type::shift( rem_ ); + rem_ ^= crc_table_type::table_[ byte_index ]; + } +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +void +BOOST_CRC_OPTIMAL_NAME::process_bytes +( + void const * buffer, + std::size_t byte_count +) +{ + unsigned char const * const b = static_cast( + buffer ); + process_block( b, b + byte_count ); +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +typename BOOST_CRC_OPTIMAL_NAME::value_type +BOOST_CRC_OPTIMAL_NAME::checksum +( +) const +{ + return ( reflect_out_type::reflect(rem_) ^ get_final_xor_value() ) + & masking_type::sig_bits_fast; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +void +BOOST_CRC_OPTIMAL_NAME::operator () +( + unsigned char byte +) +{ + process_byte( byte ); +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +typename BOOST_CRC_OPTIMAL_NAME::value_type +BOOST_CRC_OPTIMAL_NAME::operator () +( +) const +{ + return checksum(); +} + + +// CRC computation function definition -------------------------------------// + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, + BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, + bool ReflectIn, bool ReflectRem > +inline +typename uint_t::fast +crc +( + void const * buffer, + std::size_t byte_count + BOOST_CRC_DUMMY_INIT +) +{ + BOOST_CRC_OPTIMAL_NAME computer; + computer.process_bytes( buffer, byte_count ); + return computer.checksum(); +} + + +// Augmented-message CRC computation function definitions ------------------// + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly > +typename uint_t::fast +augmented_crc +( + void const * buffer, + std::size_t byte_count, + typename uint_t::fast initial_remainder + BOOST_ACRC_DUMMY_INIT +) +{ + typedef unsigned char byte_type; + typedef detail::mask_uint_t masking_type; + typedef detail::crc_table_t crc_table_type; + + typename masking_type::fast rem = initial_remainder; + byte_type const * const b = static_cast( buffer ); + byte_type const * const e = b + byte_count; + + crc_table_type::init_table(); + for ( byte_type const * p = b ; p < e ; ++p ) + { + // Use the current top byte as the table index to the next + // "partial product." Shift out that top byte, shifting in + // the next augmented-message byte. Complete the division. + byte_type const byte_index = rem >> ( Bits - CHAR_BIT ); + rem <<= CHAR_BIT; + rem |= *p; + rem ^= crc_table_type::table_[ byte_index ]; + } + + return rem & masking_type::sig_bits_fast; +} + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly > +inline +typename uint_t::fast +augmented_crc +( + void const * buffer, + std::size_t byte_count + BOOST_ACRC_DUMMY_INIT +) +{ + // The last function argument has its type specified so the other version of + // augmented_crc will be called. If the cast wasn't in place, and the + // BOOST_ACRC_DUMMY_INIT added a third argument (for a workaround), the "0" + // would match as that third argument, leading to infinite recursion. + return augmented_crc( buffer, byte_count, + static_cast::fast>(0) ); +} + + +} // namespace boost + + +// Undo header-private macros +#undef BOOST_CRC_OPTIMAL_NAME +#undef BOOST_ACRC_DUMMY_INIT +#undef BOOST_ACRC_DUMMY_PARM_TYPE +#undef BOOST_CRC_DUMMY_INIT +#undef BOOST_CRC_DUMMY_PARM_TYPE +#undef BOOST_CRC_PARM_TYPE + + +#endif // BOOST_CRC_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/cregex.hpp b/deal.II/contrib/boost/include/boost-1.37.0/cregex.hpp new file mode 100644 index 0000000000..b7a918eb8e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/cregex.hpp @@ -0,0 +1,39 @@ +/* + * + * Copyright (c) 1998-2002 + * John Maddock + * + * 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) + * + */ + + /* + * LOCATION: see http://www.boost.org/libs/regex for most recent version. + * FILE cregex.cpp + * VERSION see + * DESCRIPTION: Declares POSIX API functions + * + boost::RegEx high level wrapper. + */ + +#ifndef BOOST_RE_CREGEX_HPP +#define BOOST_RE_CREGEX_HPP + +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +#include + +#endif /* include guard */ + + + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/cstdint.hpp b/deal.II/contrib/boost/include/boost-1.37.0/cstdint.hpp new file mode 100644 index 0000000000..31a432a886 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/cstdint.hpp @@ -0,0 +1,446 @@ +// boost cstdint.hpp header file ------------------------------------------// + +// (C) Copyright Beman Dawes 1999. +// (C) Copyright Jens Mauer 2001 +// (C) Copyright John Maddock 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/integer for documentation. + +// Revision History +// 31 Oct 01 use BOOST_HAS_LONG_LONG to check for "long long" (Jens M.) +// 16 Apr 01 check LONGLONG_MAX when looking for "long long" (Jens Maurer) +// 23 Jan 01 prefer "long" over "int" for int32_t and intmax_t (Jens Maurer) +// 12 Nov 00 Merged (Jens Maurer) +// 23 Sep 00 Added INTXX_C macro support (John Maddock). +// 22 Sep 00 Better 64-bit support (John Maddock) +// 29 Jun 00 Reimplement to avoid including stdint.h within namespace boost +// 8 Aug 99 Initial version (Beman Dawes) + + +#ifndef BOOST_CSTDINT_HPP +#define BOOST_CSTDINT_HPP + +#include + + +#ifdef BOOST_HAS_STDINT_H + +// The following #include is an implementation artifact; not part of interface. +# ifdef __hpux +// HP-UX has a vaguely nice in a non-standard location +# include +# ifdef __STDC_32_MODE__ + // this is triggered with GCC, because it defines __cplusplus < 199707L +# define BOOST_NO_INT64_T +# endif +# elif defined(__FreeBSD__) || defined(__IBMCPP__) +# include +# else +# include + +// There is a bug in Cygwin two _C macros +# if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__) +# undef INTMAX_C +# undef UINTMAX_C +# define INTMAX_C(c) c##LL +# define UINTMAX_C(c) c##ULL +# endif + +# endif + +#ifdef __QNX__ + +// QNX (Dinkumware stdlib) defines these as non-standard names. +// Reflect to the standard names. + +typedef ::intleast8_t int_least8_t; +typedef ::intfast8_t int_fast8_t; +typedef ::uintleast8_t uint_least8_t; +typedef ::uintfast8_t uint_fast8_t; + +typedef ::intleast16_t int_least16_t; +typedef ::intfast16_t int_fast16_t; +typedef ::uintleast16_t uint_least16_t; +typedef ::uintfast16_t uint_fast16_t; + +typedef ::intleast32_t int_least32_t; +typedef ::intfast32_t int_fast32_t; +typedef ::uintleast32_t uint_least32_t; +typedef ::uintfast32_t uint_fast32_t; + +# ifndef BOOST_NO_INT64_T + +typedef ::intleast64_t int_least64_t; +typedef ::intfast64_t int_fast64_t; +typedef ::uintleast64_t uint_least64_t; +typedef ::uintfast64_t uint_fast64_t; + +# endif + +#endif + +namespace boost +{ + + using ::int8_t; + using ::int_least8_t; + using ::int_fast8_t; + using ::uint8_t; + using ::uint_least8_t; + using ::uint_fast8_t; + + using ::int16_t; + using ::int_least16_t; + using ::int_fast16_t; + using ::uint16_t; + using ::uint_least16_t; + using ::uint_fast16_t; + + using ::int32_t; + using ::int_least32_t; + using ::int_fast32_t; + using ::uint32_t; + using ::uint_least32_t; + using ::uint_fast32_t; + +# ifndef BOOST_NO_INT64_T + + using ::int64_t; + using ::int_least64_t; + using ::int_fast64_t; + using ::uint64_t; + using ::uint_least64_t; + using ::uint_fast64_t; + +# endif + + using ::intmax_t; + using ::uintmax_t; + +} // namespace boost + +#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) +// FreeBSD and Tru64 have an that contains much of what we need. +# include + +namespace boost { + + using ::int8_t; + typedef int8_t int_least8_t; + typedef int8_t int_fast8_t; + using ::uint8_t; + typedef uint8_t uint_least8_t; + typedef uint8_t uint_fast8_t; + + using ::int16_t; + typedef int16_t int_least16_t; + typedef int16_t int_fast16_t; + using ::uint16_t; + typedef uint16_t uint_least16_t; + typedef uint16_t uint_fast16_t; + + using ::int32_t; + typedef int32_t int_least32_t; + typedef int32_t int_fast32_t; + using ::uint32_t; + typedef uint32_t uint_least32_t; + typedef uint32_t uint_fast32_t; + +# ifndef BOOST_NO_INT64_T + + using ::int64_t; + typedef int64_t int_least64_t; + typedef int64_t int_fast64_t; + using ::uint64_t; + typedef uint64_t uint_least64_t; + typedef uint64_t uint_fast64_t; + + typedef int64_t intmax_t; + typedef uint64_t uintmax_t; + +# else + + typedef int32_t intmax_t; + typedef uint32_t uintmax_t; + +# endif + +} // namespace boost + +#else // BOOST_HAS_STDINT_H + +# include // implementation artifact; not part of interface +# include // needed for limits macros + + +namespace boost +{ + +// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit +// platforms. For other systems, they will have to be hand tailored. +// +// Because the fast types are assumed to be the same as the undecorated types, +// it may be possible to hand tailor a more efficient implementation. Such +// an optimization may be illusionary; on the Intel x86-family 386 on, for +// example, byte arithmetic and load/stores are as fast as "int" sized ones. + +// 8-bit types ------------------------------------------------------------// + +# if UCHAR_MAX == 0xff + typedef signed char int8_t; + typedef signed char int_least8_t; + typedef signed char int_fast8_t; + typedef unsigned char uint8_t; + typedef unsigned char uint_least8_t; + typedef unsigned char uint_fast8_t; +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif + +// 16-bit types -----------------------------------------------------------// + +# if USHRT_MAX == 0xffff +# if defined(__crayx1) + // The Cray X1 has a 16-bit short, however it is not recommend + // for use in performance critical code. + typedef short int16_t; + typedef short int_least16_t; + typedef int int_fast16_t; + typedef unsigned short uint16_t; + typedef unsigned short uint_least16_t; + typedef unsigned int uint_fast16_t; +# else + typedef short int16_t; + typedef short int_least16_t; + typedef short int_fast16_t; + typedef unsigned short uint16_t; + typedef unsigned short uint_least16_t; + typedef unsigned short uint_fast16_t; +# endif +# elif (USHRT_MAX == 0xffffffff) && defined(CRAY) + // no 16-bit types on Cray: + typedef short int_least16_t; + typedef short int_fast16_t; + typedef unsigned short uint_least16_t; + typedef unsigned short uint_fast16_t; +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif + +// 32-bit types -----------------------------------------------------------// + +# if ULONG_MAX == 0xffffffff + typedef long int32_t; + typedef long int_least32_t; + typedef long int_fast32_t; + typedef unsigned long uint32_t; + typedef unsigned long uint_least32_t; + typedef unsigned long uint_fast32_t; +# elif UINT_MAX == 0xffffffff + typedef int int32_t; + typedef int int_least32_t; + typedef int int_fast32_t; + typedef unsigned int uint32_t; + typedef unsigned int uint_least32_t; + typedef unsigned int uint_fast32_t; +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif + +// 64-bit types + intmax_t and uintmax_t ----------------------------------// + +# if defined(BOOST_HAS_LONG_LONG) && \ + !defined(BOOST_MSVC) && !defined(__BORLANDC__) && \ + (!defined(__GLIBCPP__) || defined(_GLIBCPP_USE_LONG_LONG)) && \ + (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) +# if defined(__hpux) + // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions +# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) + // 2**64 - 1 +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif + + typedef ::boost::long_long_type intmax_t; + typedef ::boost::ulong_long_type uintmax_t; + typedef ::boost::long_long_type int64_t; + typedef ::boost::long_long_type int_least64_t; + typedef ::boost::long_long_type int_fast64_t; + typedef ::boost::ulong_long_type uint64_t; + typedef ::boost::ulong_long_type uint_least64_t; + typedef ::boost::ulong_long_type uint_fast64_t; + +# elif ULONG_MAX != 0xffffffff + +# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 + typedef long intmax_t; + typedef unsigned long uintmax_t; + typedef long int64_t; + typedef long int_least64_t; + typedef long int_fast64_t; + typedef unsigned long uint64_t; + typedef unsigned long uint_least64_t; + typedef unsigned long uint_fast64_t; +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif +# elif defined(__GNUC__) && defined(BOOST_HAS_LONG_LONG) + __extension__ typedef long long intmax_t; + __extension__ typedef unsigned long long uintmax_t; + __extension__ typedef long long int64_t; + __extension__ typedef long long int_least64_t; + __extension__ typedef long long int_fast64_t; + __extension__ typedef unsigned long long uint64_t; + __extension__ typedef unsigned long long uint_least64_t; + __extension__ typedef unsigned long long uint_fast64_t; +# elif defined(BOOST_HAS_MS_INT64) + // + // we have Borland/Intel/Microsoft __int64: + // + typedef __int64 intmax_t; + typedef unsigned __int64 uintmax_t; + typedef __int64 int64_t; + typedef __int64 int_least64_t; + typedef __int64 int_fast64_t; + typedef unsigned __int64 uint64_t; + typedef unsigned __int64 uint_least64_t; + typedef unsigned __int64 uint_fast64_t; +# else // assume no 64-bit integers +# define BOOST_NO_INT64_T + typedef int32_t intmax_t; + typedef uint32_t uintmax_t; +# endif + +} // namespace boost + + +#endif // BOOST_HAS_STDINT_H + +#endif // BOOST_CSTDINT_HPP + + +/**************************************************** + +Macro definition section: + +Define various INTXX_C macros only if +__STDC_CONSTANT_MACROS is defined. + +Undefine the macros if __STDC_CONSTANT_MACROS is +not defined and the macros are (cf ). + +Added 23rd September 2000 (John Maddock). +Modified 11th September 2001 to be excluded when +BOOST_HAS_STDINT_H is defined (John Maddock). + +******************************************************/ + +#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H) +# define BOOST__STDC_CONSTANT_MACROS_DEFINED +# if defined(BOOST_HAS_MS_INT64) +// +// Borland/Intel/Microsoft compilers have width specific suffixes: +// +# define INT8_C(value) value##i8 +# define INT16_C(value) value##i16 +# define INT32_C(value) value##i32 +# define INT64_C(value) value##i64 +# ifdef __BORLANDC__ + // Borland bug: appending ui8 makes the type a signed char +# define UINT8_C(value) static_cast(value##u) +# else +# define UINT8_C(value) value##ui8 +# endif +# define UINT16_C(value) value##ui16 +# define UINT32_C(value) value##ui32 +# define UINT64_C(value) value##ui64 +# define INTMAX_C(value) value##i64 +# define UINTMAX_C(value) value##ui64 + +# else +// do it the old fashioned way: + +// 8-bit types ------------------------------------------------------------// + +# if UCHAR_MAX == 0xff +# define INT8_C(value) static_cast(value) +# define UINT8_C(value) static_cast(value##u) +# endif + +// 16-bit types -----------------------------------------------------------// + +# if USHRT_MAX == 0xffff +# define INT16_C(value) static_cast(value) +# define UINT16_C(value) static_cast(value##u) +# endif + +// 32-bit types -----------------------------------------------------------// + +# if UINT_MAX == 0xffffffff +# define INT32_C(value) value +# define UINT32_C(value) value##u +# elif ULONG_MAX == 0xffffffff +# define INT32_C(value) value##L +# define UINT32_C(value) value##uL +# endif + +// 64-bit types + intmax_t and uintmax_t ----------------------------------// + +# if defined(BOOST_HAS_LONG_LONG) && \ + (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) + +# if defined(__hpux) + // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions +# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) || \ + (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) || \ + (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U) + +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif +# define INT64_C(value) value##LL +# define UINT64_C(value) value##uLL +# elif ULONG_MAX != 0xffffffff + +# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 +# define INT64_C(value) value##L +# define UINT64_C(value) value##uL +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif +# endif + +# ifdef BOOST_NO_INT64_T +# define INTMAX_C(value) INT32_C(value) +# define UINTMAX_C(value) UINT32_C(value) +# else +# define INTMAX_C(value) INT64_C(value) +# define UINTMAX_C(value) UINT64_C(value) +# endif + +# endif // Borland/Microsoft specific width suffixes + + +#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H) +// +// undef all the macros: +// +# undef INT8_C +# undef INT16_C +# undef INT32_C +# undef INT64_C +# undef UINT8_C +# undef UINT16_C +# undef UINT32_C +# undef UINT64_C +# undef INTMAX_C +# undef UINTMAX_C + +#endif // __STDC_CONSTANT_MACROS_DEFINED etc. + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/cstdlib.hpp b/deal.II/contrib/boost/include/boost-1.37.0/cstdlib.hpp new file mode 100644 index 0000000000..6322146354 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/cstdlib.hpp @@ -0,0 +1,41 @@ +// boost/cstdlib.hpp header ------------------------------------------------// + +// Copyright Beman Dawes 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/utility/cstdlib.html for documentation. + +// Revision History +// 26 Feb 01 Initial version (Beman Dawes) + +#ifndef BOOST_CSTDLIB_HPP +#define BOOST_CSTDLIB_HPP + +#include + +namespace boost +{ + // The intent is to propose the following for addition to namespace std + // in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and + // EXIT_FAILURE. As an implementation detail, this header defines the + // new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new + // standard, the constants would be implementation-defined, although it + // might be worthwhile to "suggest" (which a standard is allowed to do) + // values of 0 and 1 respectively. + + // Rationale for having multiple failure values: some environments may + // wish to distinguish between different classes of errors. + // Rationale for choice of values: programs often use values < 100 for + // their own error reporting. Values > 255 are sometimes reserved for + // system detected errors. 200/201 were suggested to minimize conflict. + + const int exit_success = EXIT_SUCCESS; // implementation-defined value + const int exit_failure = EXIT_FAILURE; // implementation-defined value + const int exit_exception_failure = 200; // otherwise uncaught exception + const int exit_test_failure = 201; // report_error or + // report_critical_error called. +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/current_function.hpp b/deal.II/contrib/boost/include/boost-1.37.0/current_function.hpp new file mode 100644 index 0000000000..aa5756e0a5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/current_function.hpp @@ -0,0 +1,67 @@ +#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED +#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/current_function.hpp - BOOST_CURRENT_FUNCTION +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// +// http://www.boost.org/libs/utility/current_function.html +// + +namespace boost +{ + +namespace detail +{ + +inline void current_function_helper() +{ + +#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) + +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ + +#elif defined(__DMC__) && (__DMC__ >= 0x810) + +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ + +#elif defined(__FUNCSIG__) + +# define BOOST_CURRENT_FUNCTION __FUNCSIG__ + +#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) + +# define BOOST_CURRENT_FUNCTION __FUNCTION__ + +#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) + +# define BOOST_CURRENT_FUNCTION __FUNC__ + +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) + +# define BOOST_CURRENT_FUNCTION __func__ + +#else + +# define BOOST_CURRENT_FUNCTION "(unknown)" + +#endif + +} + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time.hpp new file mode 100644 index 0000000000..c9666222eb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time.hpp @@ -0,0 +1,17 @@ +#ifndef BOOST_DATE_TIME_ALL_HPP___ +#define BOOST_DATE_TIME_ALL_HPP___ + +/* Copyright (c) 2006 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + // See www.boost.org/libs/date_time for documentation. + +//gregorian and posix time included by indirectly +#include "boost/date_time/local_time/local_time.hpp" + +#endif // BOOST_DATE_TIME_ALL_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/adjust_functors.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/adjust_functors.hpp new file mode 100644 index 0000000000..7854ae4b76 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/adjust_functors.hpp @@ -0,0 +1,178 @@ +#ifndef _DATE_TIME_ADJUST_FUNCTORS_HPP___ +#define _DATE_TIME_ADJUST_FUNCTORS_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/date.hpp" +#include "boost/date_time/wrapping_int.hpp" + +namespace boost { +namespace date_time { + + + //! Functor to iterate a fixed number of days + template + class day_functor + { + public: + typedef typename date_type::duration_type duration_type; + day_functor(int f) : f_(f) {} + duration_type get_offset(const date_type& d) const + { + // why is 'd' a parameter??? + // fix compiler warnings + d.year(); + return duration_type(f_); + } + duration_type get_neg_offset(const date_type& d) const + { + // fix compiler warnings + d.year(); + return duration_type(-f_); + } + private: + int f_; + }; + + + //! Provides calculation to find next nth month given a date + /*! This adjustment function provides the logic for 'month-based' + * advancement on a ymd based calendar. The policy it uses + * to handle the non existant end of month days is to back + * up to the last day of the month. Also, if the starting + * date is the last day of a month, this functor will attempt + * to adjust to the end of the month. + + */ + template + class month_functor + { + public: + typedef typename date_type::duration_type duration_type; + typedef typename date_type::calendar_type cal_type; + typedef typename cal_type::ymd_type ymd_type; + typedef typename cal_type::day_type day_type; + + month_functor(int f) : f_(f), origDayOfMonth_(0) {} + duration_type get_offset(const date_type& d) const + { + ymd_type ymd(d.year_month_day()); + if (origDayOfMonth_ == 0) { + origDayOfMonth_ = ymd.day; + day_type endOfMonthDay(cal_type::end_of_month_day(ymd.year,ymd.month)); + if (endOfMonthDay == ymd.day) { + origDayOfMonth_ = -1; //force the value to the end of month + } + } + typedef date_time::wrapping_int2 wrap_int2; + typedef typename wrap_int2::int_type int_type; + wrap_int2 wi(ymd.month); + //calc the year wrap around, add() returns 0 or 1 if wrapped + int_type year = wi.add(static_cast(f_)); + year = static_cast(year + ymd.year); //calculate resulting year +// std::cout << "trace wi: " << wi.as_int() << std::endl; +// std::cout << "trace year: " << year << std::endl; + //find the last day for the new month + day_type resultingEndOfMonthDay(cal_type::end_of_month_day(year, wi.as_int())); + //original was the end of month -- force to last day of month + if (origDayOfMonth_ == -1) { + return date_type(year, wi.as_int(), resultingEndOfMonthDay) - d; + } + day_type dayOfMonth = origDayOfMonth_; + if (dayOfMonth > resultingEndOfMonthDay) { + dayOfMonth = resultingEndOfMonthDay; + } + return date_type(year, wi.as_int(), dayOfMonth) - d; + } + //! Returns a negative duration_type + duration_type get_neg_offset(const date_type& d) const + { + ymd_type ymd(d.year_month_day()); + if (origDayOfMonth_ == 0) { + origDayOfMonth_ = ymd.day; + day_type endOfMonthDay(cal_type::end_of_month_day(ymd.year,ymd.month)); + if (endOfMonthDay == ymd.day) { + origDayOfMonth_ = -1; //force the value to the end of month + } + } + typedef date_time::wrapping_int2 wrap_int2; + typedef typename wrap_int2::int_type int_type; + wrap_int2 wi(ymd.month); + //calc the year wrap around, add() returns 0 or 1 if wrapped + int_type year = wi.subtract(static_cast(f_)); + year = static_cast(year + ymd.year); //calculate resulting year + //find the last day for the new month + day_type resultingEndOfMonthDay(cal_type::end_of_month_day(year, wi.as_int())); + //original was the end of month -- force to last day of month + if (origDayOfMonth_ == -1) { + return date_type(year, wi.as_int(), resultingEndOfMonthDay) - d; + } + day_type dayOfMonth = origDayOfMonth_; + if (dayOfMonth > resultingEndOfMonthDay) { + dayOfMonth = resultingEndOfMonthDay; + } + return date_type(year, wi.as_int(), dayOfMonth) - d; + } + private: + int f_; + mutable short origDayOfMonth_; + }; + + + //! Functor to iterate a over weeks + template + class week_functor + { + public: + typedef typename date_type::duration_type duration_type; + typedef typename date_type::calendar_type calendar_type; + week_functor(int f) : f_(f) {} + duration_type get_offset(const date_type& d) const + { + // why is 'd' a parameter??? + // fix compiler warnings + d.year(); + return duration_type(f_*calendar_type::days_in_week()); + } + duration_type get_neg_offset(const date_type& d) const + { + // fix compiler warnings + d.year(); + return duration_type(-f_*calendar_type::days_in_week()); + } + private: + int f_; + }; + + //! Functor to iterate by a year adjusting for leap years + template + class year_functor + { + public: + //typedef typename date_type::year_type year_type; + typedef typename date_type::duration_type duration_type; + year_functor(int f) : _mf(f * 12) {} + duration_type get_offset(const date_type& d) const + { + return _mf.get_offset(d); + } + duration_type get_neg_offset(const date_type& d) const + { + return _mf.get_neg_offset(d); + } + private: + month_functor _mf; + }; + + +} }//namespace date_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/c_local_time_adjustor.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/c_local_time_adjustor.hpp new file mode 100644 index 0000000000..7c03dc9825 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/c_local_time_adjustor.hpp @@ -0,0 +1,64 @@ +#ifndef DATE_TIME_C_LOCAL_TIME_ADJUSTOR_HPP__ +#define DATE_TIME_C_LOCAL_TIME_ADJUSTOR_HPP__ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file c_local_time_adjustor.hpp + Time adjustment calculations based on machine +*/ + +#include +#include "boost/date_time/c_time.hpp" + +namespace boost { +namespace date_time { + + //! Adjust to / from utc using the C API + /*! Warning!!! This class assumes that timezone settings of the + * machine are correct. This can be a very dangerous assumption. + */ + template + class c_local_adjustor { + public: + typedef typename time_type::time_duration_type time_duration_type; + typedef typename time_type::date_type date_type; + typedef typename date_type::duration_type date_duration_type; + //! Convert a utc time to local time + static time_type utc_to_local(const time_type& t) + { + date_type time_t_start_day(1970,1,1); + time_type time_t_start_time(time_t_start_day,time_duration_type(0,0,0)); + if (t < time_t_start_time) { + throw std::out_of_range("Cannot convert dates prior to Jan 1, 1970"); + } + date_duration_type dd = t.date() - time_t_start_day; + time_duration_type td = t.time_of_day(); + std::time_t t2 = dd.days()*86400 + td.hours()*3600 + td.minutes()*60 + td.seconds(); + std::tm tms, *tms_ptr; + tms_ptr = c_time::localtime(&t2, &tms); + //tms_ptr = std::localtime(&t2); + date_type d(static_cast(tms_ptr->tm_year + 1900), + static_cast(tms_ptr->tm_mon + 1), + static_cast(tms_ptr->tm_mday)); + time_duration_type td2(tms_ptr->tm_hour, + tms_ptr->tm_min, + tms_ptr->tm_sec, + t.time_of_day().fractional_seconds()); + + return time_type(d,td2); + } + }; + + + +} } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/c_time.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/c_time.hpp new file mode 100644 index 0000000000..6ce5340a49 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/c_time.hpp @@ -0,0 +1,91 @@ +#ifndef DATE_TIME_C_TIME_HPP___ +#define DATE_TIME_C_TIME_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +/*! @file c_time.hpp + Provide workarounds related to the ctime header +*/ + +#include "boost/date_time/compiler_config.hpp" +#include +//Work around libraries that don't put time_t and time in namespace std + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::time_t; using ::time; using ::localtime; + using ::tm; using ::gmtime; } +#endif // BOOST_NO_STDC_NAMESPACE + +//The following is used to support high precision time clocks +#ifdef BOOST_HAS_GETTIMEOFDAY +#include +#endif + +#ifdef BOOST_HAS_FTIME +#include +#endif + +namespace boost { +namespace date_time { + //! Provides a uniform interface to some 'ctime' functions + /*! Provides a uniform interface to some ctime functions and + * their '_r' counterparts. The '_r' functions require a pointer to a + * user created std::tm struct whereas the regular functions use a + * staticly created struct and return a pointer to that. These wrapper + * functions require the user to create a std::tm struct and send in a + * pointer to it. A pointer to the user created struct will be returned. */ + struct c_time { + public: +#if defined(BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS) + //! requires a pointer to a user created std::tm struct + inline + static std::tm* localtime(const std::time_t* t, std::tm* result) + { + // localtime_r() not in namespace std??? + result = localtime_r(t, result); + return result; + } + //! requires a pointer to a user created std::tm struct + inline + static std::tm* gmtime(const std::time_t* t, std::tm* result) + { + // gmtime_r() not in namespace std??? + result = gmtime_r(t, result); + return result; + } +#else // BOOST_HAS_THREADS + +#if (defined(_MSC_VER) && (_MSC_VER >= 1400)) +#pragma warning(push) // preserve warning settings +#pragma warning(disable : 4996) // disable depricated localtime/gmtime warning on vc8 +#endif // _MSC_VER >= 1400 + //! requires a pointer to a user created std::tm struct + inline + static std::tm* localtime(const std::time_t* t, std::tm* result) + { + result = std::localtime(t); + return result; + } + //! requires a pointer to a user created std::tm struct + inline + static std::tm* gmtime(const std::time_t* t, std::tm* result) + { + result = std::gmtime(t); + return result; + } +#if (defined(_MSC_VER) && (_MSC_VER >= 1400)) +#pragma warning(pop) // restore warnings to previous state +#endif // _MSC_VER >= 1400 + +#endif // BOOST_HAS_THREADS + }; +}} // namespaces + +#endif // DATE_TIME_C_TIME_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/compiler_config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/compiler_config.hpp new file mode 100644 index 0000000000..137888e649 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/compiler_config.hpp @@ -0,0 +1,149 @@ +#ifndef DATE_TIME_COMPILER_CONFIG_HPP___ +#define DATE_TIME_COMPILER_CONFIG_HPP___ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + #include "boost/detail/workaround.hpp" + +// With boost release 1.33, date_time will be using a different, +// more flexible, IO system. This new system is not compatible with +// old compilers. The original date_time IO system remains for those +// compilers. They must define this macro to use the legacy IO. +// (defined(__BORLANDC__) && (__BORLANDC__ <= 0x0581) ) ) && + #if( BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) \ + || BOOST_WORKAROUND( __GNUC__, < 3) \ + || (BOOST_WORKAROUND( _MSC_VER, <= 1300) ) \ + ) \ + && !defined(USE_DATE_TIME_PRE_1_33_FACET_IO) +# define USE_DATE_TIME_PRE_1_33_FACET_IO +#endif + + +// This file performs some local compiler configurations + +#include "boost/date_time/locale_config.hpp" //set up locale configurations + +//Set up a configuration parameter for platforms that have +//GetTimeOfDay +#if defined(BOOST_HAS_GETTIMEOFDAY) || defined(BOOST_HAS_FTIME) +#define BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK +#endif + +// To Force no default constructors for date & ptime, un-comment following +//#define DATE_TIME_NO_DEFAULT_CONSTRUCTOR + +// Include extensions to date_duration - comment out to remove this feature +#define BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES +// these extensions are known to cause problems with gcc295 +#if defined(__GNUC__) && (__GNUC__ < 3) +#undef BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES +#endif + +#if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) ) +#define BOOST_DATE_TIME_NO_MEMBER_INIT +#endif + +// include these types before we try to re-define them +#include "boost/cstdint.hpp" + +//Define INT64_C for compilers that don't have it +#if (!defined(INT64_C)) +#define INT64_C(value) int64_t(value) +#endif + + +/* Workaround for Borland iterator error. Error was "Cannot convert 'istream *' to 'wistream *' in function istream_iterator<>::istream_iterator() */ +#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_RW_LIB) +#define BOOST_DATE_TIME_NO_WISTREAM_ITERATOR +#endif + + +// Borland v5.64 does not have the following in std namespace; v5.5.1 does +#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_STLPORT) +#include +namespace std { + using stlport::tolower; + using stlport::ctype; + using stlport::use_facet; +} +#endif + +// workaround for errors associated with output for date classes +// modifications and input streaming for time classes. +// Compilers affected are: +// gcc295, msvc (neither with STLPort), any borland +// +#if (((defined(__GNUC__) && (__GNUC__ < 3)) || \ + (defined(_MSC_VER) && (_MSC_VER < 1300)) ) && \ + !defined(_STLP_OWN_IOSTREAMS) ) || \ + BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) +#define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS +#endif + +/* The following handles the definition of the necessary macros + * for dll building on Win32 platforms. + * + * For code that will be placed in the date_time .dll, + * it must be properly prefixed with BOOST_DATE_TIME_DECL. + * The corresponding .cpp file must have BOOST_DATE_TIME_SOURCES + * defined before including its header. For examples see: + * greg_month.hpp & greg_month.cpp + * + */ + +#ifdef BOOST_HAS_DECLSPEC // defined in config system + // we need to import/export our code only if the user has specifically + // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost + // libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK + // if they want just this one to be dynamically liked: +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) + // export if this is our own source, otherwise import: +# ifdef BOOST_DATE_TIME_SOURCE +# define BOOST_DATE_TIME_DECL __declspec(dllexport) +# else +# define BOOST_DATE_TIME_DECL __declspec(dllimport) +# endif // BOOST_DATE_TIME_SOURCE +# endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC +// +// if BOOST_WHATEVER_DECL isn't defined yet define it now: +#ifndef BOOST_DATE_TIME_DECL +# define BOOST_DATE_TIME_DECL +#endif + +// +// Automatically link to the correct build variant where possible. +// +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_DATE_TIME_NO_LIB) && !defined(BOOST_DATE_TIME_SOURCE) +// +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_date_time +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include +#endif // auto-linking disabled + +#if defined(BOOST_HAS_THREADS) +# if defined(_MSC_VER) || defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__) + //no reentrant posix functions (eg: localtime_r) +# elif (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT))) +# define BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS +# endif +#endif + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/constrained_value.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/constrained_value.hpp new file mode 100644 index 0000000000..c010b40dcf --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/constrained_value.hpp @@ -0,0 +1,98 @@ +#ifndef CONSTRAINED_VALUE_HPP___ +#define CONSTRAINED_VALUE_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include + +namespace boost { + +//! Namespace containing constrained_value template and types +namespace CV { + //! Represent a min or max violation type + enum violation_enum {min_violation, max_violation}; + + //! A template to specify a constrained basic value type + /*! This template provides a quick way to generate + * an integer type with a constrained range. The type + * provides for the ability to specify the min, max, and + * and error handling policy. + * + * value policies + * A class that provides the range limits via the min and + * max functions as well as a function on_error that + * determines how errors are handled. A common strategy + * would be to assert or throw and exception. The on_error + * is passed both the current value and the new value that + * is in error. + * + */ + template + class constrained_value { + public: + typedef typename value_policies::value_type value_type; + // typedef except_type exception_type; + constrained_value(value_type value) + { + assign(value); + }; + constrained_value& operator=(value_type v) + { + assign(v); + return *this; + } + //! Return the max allowed value (traits method) + static value_type max BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::max)();}; + //! Return the min allowed value (traits method) + static value_type min BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::min)();}; + //! Coerce into the representation type + operator value_type() const {return value_;}; + protected: + value_type value_; + private: + void assign(value_type value) + { + //adding 1 below gets rid of a compiler warning which occurs when the + //min_value is 0 and the type is unsigned.... + if (value+1 < (min)()+1) { + value_policies::on_error(value_, value, min_violation); + return; + } + if (value > (max)()) { + value_policies::on_error(value_, value, max_violation); + return; + } + value_ = value; + + } +}; + + //! Template to shortcut the constrained_value policy creation process + template + class simple_exception_policy + { + public: + typedef rep_type value_type; + static rep_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return min_value; }; + static rep_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return max_value;}; + static void on_error(rep_type, rep_type, violation_enum) + { + throw exception_type(); + } + }; + + + +} } //namespace CV + + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date.hpp new file mode 100644 index 0000000000..beab047700 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date.hpp @@ -0,0 +1,197 @@ +#ifndef DATE_TIME_DATE_HPP___ +#define DATE_TIME_DATE_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/year_month_day.hpp" +#include "boost/date_time/special_defs.hpp" +#include "boost/operators.hpp" + +namespace boost { +namespace date_time { + + //!Representation of timepoint at the one day level resolution. + /*! + The date template represents an interface shell for a date class + that is based on a year-month-day system such as the gregorian + or iso systems. It provides basic operations to enable calculation + and comparisons. + + Theory + + This date representation fundamentally departs from the C tm struct + approach. The goal for this type is to provide efficient date + operations (add, subtract) and storage (minimize space to represent) + in a concrete class. Thus, the date uses a count internally to + represent a particular date. The calendar parameter defines + the policies for converting the the year-month-day and internal + counted form here. Applications that need to perform heavy + formatting of the same date repeatedly will perform better + by using the year-month-day representation. + + Internally the date uses a day number to represent the date. + This is a monotonic time representation. This representation + allows for fast comparison as well as simplifying + the creation of writing numeric operations. Essentially, the + internal day number is like adjusted julian day. The adjustment + is determined by the Epoch date which is represented as day 1 of + the calendar. Day 0 is reserved for negative infinity so that + any actual date is automatically greater than negative infinity. + When a date is constructed from a date or formatted for output, + the appropriate conversions are applied to create the year, month, + day representations. + */ + + + template + class date : private + boost::less_than_comparable > + { + public: + typedef T date_type; + typedef calendar calendar_type; + typedef typename calendar::date_traits_type traits_type; + typedef duration_type_ duration_type; + typedef typename calendar::year_type year_type; + typedef typename calendar::month_type month_type; + typedef typename calendar::day_type day_type; + typedef typename calendar::ymd_type ymd_type; + typedef typename calendar::date_rep_type date_rep_type; + typedef typename calendar::date_int_type date_int_type; + typedef typename calendar::day_of_week_type day_of_week_type; + date(year_type y, month_type m, day_type d) + : days_(calendar::day_number(ymd_type(y, m, d))) + {} + date(const ymd_type& ymd) + : days_(calendar::day_number(ymd)) + {} + //let the compiler write copy, assignment, and destructor + year_type year() const + { + ymd_type ymd = calendar::from_day_number(days_); + return ymd.year; + } + month_type month() const + { + ymd_type ymd = calendar::from_day_number(days_); + return ymd.month; + } + day_type day() const + { + ymd_type ymd = calendar::from_day_number(days_); + return ymd.day; + } + day_of_week_type day_of_week() const + { + ymd_type ymd = calendar::from_day_number(days_); + return calendar::day_of_week(ymd); + } + ymd_type year_month_day() const + { + return calendar::from_day_number(days_); + } + bool operator<(const date_type& rhs) const + { + return days_ < rhs.days_; + } + bool operator==(const date_type& rhs) const + { + return days_ == rhs.days_; + } + //! check to see if date is a special value + bool is_special()const + { + return(is_not_a_date() || is_infinity()); + } + //! check to see if date is not a value + bool is_not_a_date() const + { + return traits_type::is_not_a_number(days_); + } + //! check to see if date is one of the infinity values + bool is_infinity() const + { + return traits_type::is_inf(days_); + } + //! check to see if date is greater than all possible dates + bool is_pos_infinity() const + { + return traits_type::is_pos_inf(days_); + } + //! check to see if date is greater than all possible dates + bool is_neg_infinity() const + { + return traits_type::is_neg_inf(days_); + } + //! return as a special value or a not_special if a normal date + special_values as_special() const + { + return traits_type::to_special(days_); + } + duration_type operator-(const date_type& d) const + { + date_rep_type val = date_rep_type(days_) - date_rep_type(d.days_); + return duration_type(val.as_number()); + } + + date_type operator-(const duration_type& dd) const + { + if(dd.is_special()) + { + return date_type(date_rep_type(days_) - dd.get_rep()); + } + return date_type(date_rep_type(days_) - dd.days()); + } + date_type operator-=(const duration_type& dd) + { + *this = *this - dd; + return date_type(days_); + } + date_rep_type day_count() const + { + return days_; + }; + //allow internal access from operators + date_type operator+(const duration_type& dd) const + { + if(dd.is_special()) + { + return date_type(date_rep_type(days_) + dd.get_rep()); + } + return date_type(date_rep_type(days_) + dd.days()); + } + date_type operator+=(const duration_type& dd) + { + *this = *this + dd; + return date_type(days_); + } + + //see reference + protected: + /*! This is a private constructor which allows for the creation of new + dates. It is not exposed to users since that would require class + users to understand the inner workings of the date class. + */ + explicit date(date_int_type days) : days_(days) {}; + explicit date(date_rep_type days) : days_(days.as_number()) {}; + date_int_type days_; + + }; + + + + +} } // namespace date_time + + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_clock_device.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_clock_device.hpp new file mode 100644 index 0000000000..6ccb26e254 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_clock_device.hpp @@ -0,0 +1,77 @@ +#ifndef DATE_CLOCK_DEVICE_HPP___ +#define DATE_CLOCK_DEVICE_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/c_time.hpp" + + +namespace boost { +namespace date_time { + + //! A clock providing day level services based on C time_t capabilities + /*! This clock uses Posix interfaces as its implementation and hence + * uses the timezone settings of the operating system. Incorrect + * user settings will result in incorrect results for the calls + * to local_day. + */ + template + class day_clock + { + public: + typedef typename date_type::ymd_type ymd_type; + //! Get the local day as a date type + static date_type local_day() + { + return date_type(local_day_ymd()); + } + //! Get the local day as a ymd_type + static typename date_type::ymd_type local_day_ymd() + { + ::std::tm result; + ::std::tm* curr = get_local_time(result); + return ymd_type(curr->tm_year + 1900, + curr->tm_mon + 1, + curr->tm_mday); + } + //! Get the current day in universal date as a ymd_type + static typename date_type::ymd_type universal_day_ymd() + { + ::std::tm result; + ::std::tm* curr = get_universal_time(result); + return ymd_type(curr->tm_year + 1900, + curr->tm_mon + 1, + curr->tm_mday); + } + //! Get the UTC day as a date type + static date_type universal_day() + { + return date_type(universal_day_ymd()); + } + + private: + static ::std::tm* get_local_time(std::tm& result) + { + ::std::time_t t; + ::std::time(&t); + return c_time::localtime(&t, &result); + } + static ::std::tm* get_universal_time(std::tm& result) + { + ::std::time_t t; + ::std::time(&t); + return c_time::gmtime(&t, &result); + } + + }; + +} } //namespace date_time + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_defs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_defs.hpp new file mode 100644 index 0000000000..bc25b56c0d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_defs.hpp @@ -0,0 +1,26 @@ +#ifndef DATE_TIME_DATE_DEFS_HPP +#define DATE_TIME_DATE_DEFS_HPP + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +namespace boost { +namespace date_time { + + //! An enumeration of weekday names + enum weekdays {Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday}; + + //! Simple enum to allow for nice programming with Jan, Feb, etc + enum months_of_year {Jan=1,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,NotAMonth,NumMonths}; + +} } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_duration.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_duration.hpp new file mode 100644 index 0000000000..366fb9c6c5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_duration.hpp @@ -0,0 +1,147 @@ +#ifndef DATE_TIME_DATE_DURATION__ +#define DATE_TIME_DATE_DURATION__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include + +namespace boost { +namespace date_time { + + + //! Duration type with date level resolution + template + class date_duration : private + boost::less_than_comparable + , boost::equality_comparable< date_duration< duration_rep_traits> + , boost::addable< date_duration< duration_rep_traits> + , boost::subtractable< date_duration< duration_rep_traits> + > > > > + { + public: + typedef typename duration_rep_traits::int_type duration_rep_type; + typedef typename duration_rep_traits::impl_type duration_rep; + + //! Construct from a day count + explicit date_duration(duration_rep day_count) : days_(day_count) {}; + + /*! construct from special_values - only works when + * instantiated with duration_traits_adapted */ + date_duration(special_values sv) : + days_(duration_rep::from_special(sv)) + {} + + // copy constructor required for addable<> & subtractable<> + //! Construct from another date_duration (Copy Constructor) + date_duration(const date_duration& other) : + days_(other.days_) + {} + + //! returns days_ as it's instantiated type - used for streaming + duration_rep get_rep()const + { + return days_; + } + bool is_special()const + { + return days_.is_special(); + } + //! returns days as value, not object. + duration_rep_type days() const + { + return duration_rep_traits::as_number(days_); + } + //! Returns the smallest duration -- used by to calculate 'end' + static date_duration unit() + { + return date_duration(1); + } + //! Equality + bool operator==(const date_duration& rhs) const + { + return days_ == rhs.days_; + } + //! Less + bool operator<(const date_duration& rhs) const + { + return days_ < rhs.days_; + } + + /* For shortcut operators (+=, -=, etc) simply using + * "days_ += days_" may not work. If instantiated with + * an int_adapter, shortcut operators are not present, + * so this will not compile */ + + //! Subtract another duration -- result is signed + date_duration operator-=(const date_duration& rhs) + { + //days_ -= rhs.days_; + days_ = days_ - rhs.days_; + return *this; + } + //! Add a duration -- result is signed + date_duration operator+=(const date_duration& rhs) + { + days_ = days_ + rhs.days_; + return *this; + } + + //! unary- Allows for dd = -date_duration(2); -> dd == -2 + date_duration operator-()const + { + return date_duration(get_rep() * (-1)); + } + //! Division operations on a duration with an integer. + date_duration operator/=(int divisor) + { + days_ = days_ / divisor; + return *this; + } + date_duration operator/(int divisor) + { + return date_duration(days_ / divisor); + } + + //! return sign information + bool is_negative() const + { + return days_ < 0; + } + private: + duration_rep days_; + }; + + + /*! Struct for instantiating date_duration with NO special values + * functionality. Allows for transparent implementation of either + * date_duration or date_duration > */ + struct duration_traits_long + { + typedef long int_type; + typedef long impl_type; + static int_type as_number(impl_type i) { return i; }; + }; + + /*! Struct for instantiating date_duration WITH special values + * functionality. Allows for transparent implementation of either + * date_duration or date_duration > */ + struct duration_traits_adapted + { + typedef long int_type; + typedef boost::date_time::int_adapter impl_type; + static int_type as_number(impl_type i) { return i.as_number(); }; + }; + + +} } //namspace date_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_duration_types.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_duration_types.hpp new file mode 100644 index 0000000000..1512c0ef20 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_duration_types.hpp @@ -0,0 +1,269 @@ +#ifndef DATE_DURATION_TYPES_HPP___ +#define DATE_DURATION_TYPES_HPP___ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or + * http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include +#include + +namespace boost { +namespace date_time { + + + //! Additional duration type that represents a number of n*7 days + template + class weeks_duration : public date_duration { + public: + weeks_duration(typename duration_config::impl_type w) + : date_duration(w * 7) {} + weeks_duration(special_values sv) + : date_duration(sv) {} + }; + + // predeclare + template + class years_duration; + + //! additional duration type that represents a logical month + /*! A logical month enables things like: "date(2002,Mar,2) + months(2) -> + * 2002-May2". If the date is a last day-of-the-month, the result will + * also be a last-day-of-the-month. + */ + template + class months_duration + { + private: + typedef typename base_config::int_rep int_rep; + typedef typename int_rep::int_type int_type; + typedef typename base_config::date_type date_type; + typedef typename date_type::duration_type duration_type; + typedef typename base_config::month_adjustor_type month_adjustor_type; + typedef months_duration months_type; + typedef years_duration years_type; + public: + months_duration(int_rep num) : _m(num) {} + months_duration(special_values sv) : _m(sv) + { + _m = int_rep::from_special(sv); + } + int_rep number_of_months() const { return _m; } + //! returns a negative duration + duration_type get_neg_offset(const date_type& d) const + { + month_adjustor_type m_adj(_m.as_number()); + return duration_type(m_adj.get_neg_offset(d)); + } + duration_type get_offset(const date_type& d) const + { + month_adjustor_type m_adj(_m.as_number()); + return duration_type(m_adj.get_offset(d)); + } + bool operator==(const months_type& rhs) const + { + return(_m == rhs._m); + } + bool operator!=(const months_type& rhs) const + { + return(_m != rhs._m); + } + months_type operator+(const months_type& rhs)const + { + return months_type(_m + rhs._m); + } + months_type& operator+=(const months_type& rhs) + { + _m = _m + rhs._m; + return *this; + } + months_type operator-(const months_type& rhs)const + { + return months_type(_m - rhs._m); + } + months_type& operator-=(const months_type& rhs) + { + _m = _m - rhs._m; + return *this; + } + months_type operator*(const int_type rhs)const + { + return months_type(_m * rhs); + } + months_type& operator*=(const int_type rhs) + { + _m = _m * rhs; + return *this; + } + months_type operator/(const int_type rhs)const + { + return months_type(_m / rhs); + } + months_type& operator/=(const int_type rhs) + { + _m = _m / rhs; + return *this; + } + months_type operator+(const years_type& y)const + { + return months_type(y.number_of_years() * 12 + _m); + } + months_type& operator+=(const years_type& y) + { + _m = y.number_of_years() * 12 + _m; + return *this; + } + months_type operator-(const years_type& y) const + { + return months_type(_m - y.number_of_years() * 12); + } + months_type& operator-=(const years_type& y) + { + _m = _m - y.number_of_years() * 12; + return *this; + } + + // + friend date_type operator+(const date_type& d, const months_type& m) + { + return d + m.get_offset(d); + } + friend date_type operator+=(date_type& d, const months_type& m) + { + return d += m.get_offset(d); + } + friend date_type operator-(const date_type& d, const months_type& m) + { + // get_neg_offset returns a negative duration, so we add + return d + m.get_neg_offset(d); + } + friend date_type operator-=(date_type& d, const months_type& m) + { + // get_neg_offset returns a negative duration, so we add + return d += m.get_neg_offset(d); + } + + private: + int_rep _m; + }; + + //! additional duration type that represents a logical year + /*! A logical year enables things like: "date(2002,Mar,2) + years(2) -> + * 2004-Mar-2". If the date is a last day-of-the-month, the result will + * also be a last-day-of-the-month (ie date(2001-Feb-28) + years(3) -> + * 2004-Feb-29). + */ + template + class years_duration + { + private: + typedef typename base_config::int_rep int_rep; + typedef typename int_rep::int_type int_type; + typedef typename base_config::date_type date_type; + typedef typename date_type::duration_type duration_type; + typedef typename base_config::month_adjustor_type month_adjustor_type; + typedef years_duration years_type; + typedef months_duration months_type; + public: + years_duration(int_rep num) : _y(num) {} + years_duration(special_values sv) : _y(sv) + { + _y = int_rep::from_special(sv); + } + int_rep number_of_years() const { return _y; } + //! returns a negative duration + duration_type get_neg_offset(const date_type& d) const + { + month_adjustor_type m_adj(_y.as_number() * 12); + return duration_type(m_adj.get_neg_offset(d)); + } + duration_type get_offset(const date_type& d) const + { + month_adjustor_type m_adj(_y.as_number() * 12); + return duration_type(m_adj.get_offset(d)); + } + bool operator==(const years_type& rhs) const + { + return(_y == rhs._y); + } + bool operator!=(const years_type& rhs) const + { + return(_y != rhs._y); + } + years_type operator+(const years_type& rhs)const + { + return years_type(_y + rhs._y); + } + years_type& operator+=(const years_type& rhs) + { + _y = _y + rhs._y; + return *this; + } + years_type operator-(const years_type& rhs)const + { + return years_type(_y - rhs._y); + } + years_type& operator-=(const years_type& rhs) + { + _y = _y - rhs._y; + return *this; + } + years_type operator*(const int_type rhs)const + { + return years_type(_y * rhs); + } + years_type& operator*=(const int_type rhs) + { + _y = _y * rhs; + return *this; + } + years_type operator/(const int_type rhs)const + { + return years_type(_y / rhs); + } + years_type& operator/=(const int_type rhs) + { + _y = _y / rhs; + return *this; + } + months_type operator+(const months_type& m) const + { + return(months_type(_y * 12 + m.number_of_months())); + } + months_type operator-(const months_type& m) const + { + return(months_type(_y * 12 - m.number_of_months())); + } + + // + friend date_type operator+(const date_type& d, const years_type& y) + { + return d + y.get_offset(d); + } + friend date_type operator+=(date_type& d, const years_type& y) + { + return d += y.get_offset(d); + } + friend date_type operator-(const date_type& d, const years_type& y) + { + // get_neg_offset returns a negative duration, so we add + return d + y.get_neg_offset(d); + } + friend date_type operator-=(date_type& d, const years_type& y) + { + // get_neg_offset returns a negative duration, so we add + return d += y.get_neg_offset(d); + } + + private: + int_rep _y; + }; + +}} // namespace boost::date_time + +#endif // DATE_DURATION_TYPES_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_facet.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_facet.hpp new file mode 100644 index 0000000000..bd61695935 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_facet.hpp @@ -0,0 +1,775 @@ +#ifndef _DATE_TIME_DATE_FACET__HPP___ +#define _DATE_TIME_DATE_FACET__HPP___ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Martin Andrian, Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/algorithm/string/replace.hpp" +#include "boost/date_time/period.hpp" +#include "boost/date_time/special_values_formatter.hpp" +#include "boost/date_time/period_formatter.hpp" +#include "boost/date_time/period_parser.hpp" +#include "boost/date_time/date_generator_formatter.hpp" +#include "boost/date_time/date_generator_parser.hpp" +#include "boost/date_time/format_date_parser.hpp" +#include +#include + +namespace boost { namespace date_time { + + + /*! Class that provides format based I/O facet for date types. + * + * This class allows the formatting of dates by using format string. + * Format strings are: + * + * - %A => long_weekday_format - Full name Ex: Tuesday + * - %a => short_weekday_format - Three letter abbreviation Ex: Tue + * - %B => long_month_format - Full name Ex: October + * - %b => short_month_format - Three letter abbreviation Ex: Oct + * - %x => standard_format_specifier - defined by the locale + * - %Y-%b-%d => default_date_format - YYYY-Mon-dd + * + * Default month format == %b + * Default weekday format == %a + */ + template > > + class date_facet : public std::locale::facet { + public: + typedef typename date_type::duration_type duration_type; + // greg_weekday is gregorian_calendar::day_of_week_type + typedef typename date_type::day_of_week_type day_of_week_type; + typedef typename date_type::day_type day_type; + typedef typename date_type::month_type month_type; + typedef boost::date_time::period period_type; + typedef std::basic_string string_type; + typedef CharT char_type; + typedef boost::date_time::period_formatter period_formatter_type; + typedef boost::date_time::special_values_formatter special_values_formatter_type; + typedef std::vector > input_collection_type; + // used for the output of the date_generators + typedef date_generator_formatter date_gen_formatter_type; + typedef partial_date partial_date_type; + typedef nth_kday_of_month nth_kday_type; + typedef first_kday_of_month first_kday_type; + typedef last_kday_of_month last_kday_type; + typedef first_kday_after kday_after_type; + typedef first_kday_before kday_before_type; + static const char_type long_weekday_format[3]; + static const char_type short_weekday_format[3]; + static const char_type long_month_format[3]; + static const char_type short_month_format[3]; + static const char_type default_period_separator[4]; + static const char_type standard_format_specifier[3]; + static const char_type iso_format_specifier[7]; + static const char_type iso_format_extended_specifier[9]; + static const char_type default_date_format[9]; // YYYY-Mon-DD + static std::locale::id id; + +#if defined (__SUNPRO_CC) && defined (_RWSTD_VER) + std::locale::id& __get_id (void) const { return id; } +#endif + + explicit date_facet(::size_t a_ref = 0) + : std::locale::facet(a_ref), + //m_format(standard_format_specifier) + m_format(default_date_format), + m_month_format(short_month_format), + m_weekday_format(short_weekday_format) + {} + + explicit date_facet(const char_type* format_str, + const input_collection_type& short_names, + ::size_t ref_count = 0) + : std::locale::facet(ref_count), + m_format(format_str), + m_month_format(short_month_format), + m_weekday_format(short_weekday_format), + m_month_short_names(short_names) + {} + + + explicit date_facet(const char_type* format_str, + period_formatter_type per_formatter = period_formatter_type(), + special_values_formatter_type sv_formatter = special_values_formatter_type(), + date_gen_formatter_type dg_formatter = date_gen_formatter_type(), + ::size_t ref_count = 0) + : std::locale::facet(ref_count), + m_format(format_str), + m_month_format(short_month_format), + m_weekday_format(short_weekday_format), + m_period_formatter(per_formatter), + m_date_gen_formatter(dg_formatter), + m_special_values_formatter(sv_formatter) + {} + void format(const char_type* const format_str) { + m_format = format_str; + } + virtual void set_iso_format() + { + m_format = iso_format_specifier; + } + virtual void set_iso_extended_format() + { + m_format = iso_format_extended_specifier; + } + void month_format(const char_type* const format_str) { + m_month_format = format_str; + } + void weekday_format(const char_type* const format_str) { + m_weekday_format = format_str; + } + + void period_formatter(period_formatter_type per_formatter) { + m_period_formatter= per_formatter; + } + void special_values_formatter(const special_values_formatter_type& svf) + { + m_special_values_formatter = svf; + } + void short_weekday_names(const input_collection_type& short_names) + { + m_weekday_short_names = short_names; + } + void long_weekday_names(const input_collection_type& long_names) + { + m_weekday_long_names = long_names; + } + + void short_month_names(const input_collection_type& short_names) + { + m_month_short_names = short_names; + } + + void long_month_names(const input_collection_type& long_names) + { + m_month_long_names = long_names; + } + + void date_gen_phrase_strings(const input_collection_type& new_strings, + typename date_gen_formatter_type::phrase_elements beg_pos=date_gen_formatter_type::first) + { + m_date_gen_formatter.elements(new_strings, beg_pos); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const date_type& d) const + { + if (d.is_special()) { + return do_put_special(next, a_ios, fill_char, d.as_special()); + } + //The following line of code required the date to support a to_tm function + return do_put_tm(next, a_ios, fill_char, to_tm(d), m_format); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const duration_type& dd) const + { + if (dd.is_special()) { + return do_put_special(next, a_ios, fill_char, dd.get_rep().as_special()); + } + + typedef std::num_put num_put; + if (std::has_facet(a_ios.getloc())) { + return std::use_facet(a_ios.getloc()).put(next, a_ios, fill_char, dd.get_rep().as_number()); + } + else { + num_put* f = new num_put(); + std::locale l = std::locale(a_ios.getloc(), f); + a_ios.imbue(l); + return f->put(next, a_ios, fill_char, dd.get_rep().as_number()); + } + + } + + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const month_type& m) const + { + //if (d.is_special()) { + // return do_put_special(next, a_ios, fill_char, d.as_special()); + //} + //The following line of code required the date to support a to_tm function + tm dtm; + init_tm(dtm); + dtm.tm_mon = m -1; + return do_put_tm(next, a_ios, fill_char, dtm, m_month_format); + } + + //! puts the day of month + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const day_type& day) const + { + tm dtm; + init_tm(dtm); + dtm.tm_mday = day.as_number(); + char_type tmp[3] = {'%','d'}; + string_type temp_format(tmp); + return do_put_tm(next, a_ios, fill_char, dtm, temp_format); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const day_of_week_type& dow) const + { + //if (d.is_special()) { + // return do_put_special(next, a_ios, fill_char, d.as_special()); + //} + //The following line of code required the date to support a to_tm function + tm dtm; + init_tm(dtm); + dtm.tm_wday = dow; + return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format); + } + + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const period_type& p) const + { + return m_period_formatter.put_period(next, a_ios, fill_char, p, *this); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const partial_date_type& pd) const + { + return m_date_gen_formatter.put_partial_date(next, a_ios, fill_char, pd, *this); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const nth_kday_type& nkd) const + { + return m_date_gen_formatter.put_nth_kday(next, a_ios, fill_char, nkd, *this); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const first_kday_type& fkd) const + { + return m_date_gen_formatter.put_first_kday(next, a_ios, fill_char, fkd, *this); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const last_kday_type& lkd) const + { + return m_date_gen_formatter.put_last_kday(next, a_ios, fill_char, lkd, *this); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const kday_before_type& fkb) const + { + return m_date_gen_formatter.put_kday_before(next, a_ios, fill_char, fkb, *this); + } + + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const kday_after_type& fka) const + { + return m_date_gen_formatter.put_kday_after(next, a_ios, fill_char, fka, *this); + } + + protected: + //! Helper function to initialize all fields in a tm struct + tm init_tm(tm& tm_value) const + { + tm_value.tm_sec = 0; /* seconds */ + tm_value.tm_min = 0; /* minutes */ + tm_value.tm_hour = 0; /* hours */ + tm_value.tm_mday = 0; /* day of the month */ + tm_value.tm_mon = 0; /* month */ + tm_value.tm_year = 0; /* year */ + tm_value.tm_wday = 0; /* day of the week */ + tm_value.tm_yday = 0; /* day in the year */ + tm_value.tm_isdst = 0; /* daylight saving time */ + return tm_value; + } + virtual OutItrT do_put_special(OutItrT next, + std::ios_base& /*a_ios*/, + char_type /*fill_char*/, + const boost::date_time::special_values sv) const + { + m_special_values_formatter.put_special(next, sv); + return next; + } + virtual OutItrT do_put_tm(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const tm& tm_value, + string_type a_format) const + { + // update format string with custom names + if (m_weekday_long_names.size()) { + boost::algorithm::replace_all(a_format, + long_weekday_format, + m_weekday_long_names[tm_value.tm_wday]); + } + if (m_weekday_short_names.size()) { + boost::algorithm::replace_all(a_format, + short_weekday_format, + m_weekday_short_names[tm_value.tm_wday]); + + } + if (m_month_long_names.size()) { + boost::algorithm::replace_all(a_format, + long_month_format, + m_month_long_names[tm_value.tm_mon]); + } + if (m_month_short_names.size()) { + boost::algorithm::replace_all(a_format, + short_month_format, + m_month_short_names[tm_value.tm_mon]); + } + // use time_put facet to create final string + return std::use_facet >(a_ios.getloc()).put(next, a_ios, + fill_char, + &tm_value, + &*a_format.begin(), + &*a_format.begin()+a_format.size()); + } + protected: + string_type m_format; + string_type m_month_format; + string_type m_weekday_format; + period_formatter_type m_period_formatter; + date_gen_formatter_type m_date_gen_formatter; + special_values_formatter_type m_special_values_formatter; + input_collection_type m_month_short_names; + input_collection_type m_month_long_names; + input_collection_type m_weekday_short_names; + input_collection_type m_weekday_long_names; + private: + }; + + template + std::locale::id date_facet::id; + + template + const typename date_facet::char_type + date_facet::long_weekday_format[3] = {'%','A'}; + + template + const typename date_facet::char_type + date_facet::short_weekday_format[3] = {'%','a'}; + + template + const typename date_facet::char_type + date_facet::long_month_format[3] = {'%','B'}; + + template + const typename date_facet::char_type + date_facet::short_month_format[3] = {'%','b'}; + + template + const typename date_facet::char_type + date_facet::default_period_separator[4] = { ' ', '/', ' '}; + + template + const typename date_facet::char_type + date_facet::standard_format_specifier[3] = + {'%', 'x' }; + + template + const typename date_facet::char_type + date_facet::iso_format_specifier[7] = + {'%', 'Y', '%', 'm', '%', 'd' }; + + template + const typename date_facet::char_type + date_facet::iso_format_extended_specifier[9] = + {'%', 'Y', '-', '%', 'm', '-', '%', 'd' }; + + template + const typename date_facet::char_type + date_facet::default_date_format[9] = + {'%','Y','-','%','b','-','%','d'}; + + + + //! Input facet + template > > + class date_input_facet : public std::locale::facet { + public: + typedef typename date_type::duration_type duration_type; + // greg_weekday is gregorian_calendar::day_of_week_type + typedef typename date_type::day_of_week_type day_of_week_type; + typedef typename date_type::day_type day_type; + typedef typename date_type::month_type month_type; + typedef typename date_type::year_type year_type; + typedef boost::date_time::period period_type; + typedef std::basic_string string_type; + typedef CharT char_type; + typedef boost::date_time::period_parser period_parser_type; + typedef boost::date_time::special_values_parser special_values_parser_type; + typedef std::vector > input_collection_type; + typedef format_date_parser format_date_parser_type; + // date_generators stuff goes here + typedef date_generator_parser date_gen_parser_type; + typedef partial_date partial_date_type; + typedef nth_kday_of_month nth_kday_type; + typedef first_kday_of_month first_kday_type; + typedef last_kday_of_month last_kday_type; + typedef first_kday_after kday_after_type; + typedef first_kday_before kday_before_type; + + static const char_type long_weekday_format[3]; + static const char_type short_weekday_format[3]; + static const char_type long_month_format[3]; + static const char_type short_month_format[3]; + static const char_type four_digit_year_format[3]; + static const char_type two_digit_year_format[3]; + static const char_type default_period_separator[4]; + static const char_type standard_format_specifier[3]; + static const char_type iso_format_specifier[7]; + static const char_type iso_format_extended_specifier[9]; + static const char_type default_date_format[9]; // YYYY-Mon-DD + static std::locale::id id; + + explicit date_input_facet(::size_t a_ref = 0) + : std::locale::facet(a_ref), + m_format(default_date_format), + m_month_format(short_month_format), + m_weekday_format(short_weekday_format), + m_year_format(four_digit_year_format), + m_parser(m_format, std::locale::classic()) + // default period_parser & special_values_parser used + {} + + explicit date_input_facet(const string_type& format_str, + ::size_t a_ref = 0) + : std::locale::facet(a_ref), + m_format(format_str), + m_month_format(short_month_format), + m_weekday_format(short_weekday_format), + m_year_format(four_digit_year_format), + m_parser(m_format, std::locale::classic()) + // default period_parser & special_values_parser used + {} + + explicit date_input_facet(const string_type& format_str, + const format_date_parser_type& date_parser, + const special_values_parser_type& sv_parser, + const period_parser_type& per_parser, + const date_gen_parser_type& date_gen_parser, + ::size_t ref_count = 0) + : std::locale::facet(ref_count), + m_format(format_str), + m_month_format(short_month_format), + m_weekday_format(short_weekday_format), + m_year_format(four_digit_year_format), + m_parser(date_parser), + m_date_gen_parser(date_gen_parser), + m_period_parser(per_parser), + m_sv_parser(sv_parser) + {} + + + void format(const char_type* const format_str) { + m_format = format_str; + } + virtual void set_iso_format() + { + m_format = iso_format_specifier; + } + virtual void set_iso_extended_format() + { + m_format = iso_format_extended_specifier; + } + void month_format(const char_type* const format_str) { + m_month_format = format_str; + } + void weekday_format(const char_type* const format_str) { + m_weekday_format = format_str; + } + void year_format(const char_type* const format_str) { + m_year_format = format_str; + } + + void period_parser(period_parser_type per_parser) { + m_period_parser = per_parser; + } + void short_weekday_names(const input_collection_type& weekday_names) + { + m_parser.short_weekday_names(weekday_names); + } + void long_weekday_names(const input_collection_type& weekday_names) + { + m_parser.long_weekday_names(weekday_names); + } + + void short_month_names(const input_collection_type& month_names) + { + m_parser.short_month_names(month_names); + } + + void long_month_names(const input_collection_type& month_names) + { + m_parser.long_month_names(month_names); + } + + void date_gen_element_strings(const input_collection_type& col) + { + m_date_gen_parser.element_strings(col); + } + void date_gen_element_strings(const string_type& first, + const string_type& second, + const string_type& third, + const string_type& fourth, + const string_type& fifth, + const string_type& last, + const string_type& before, + const string_type& after, + const string_type& of) + + { + m_date_gen_parser.element_strings(first,second,third,fourth,fifth,last,before,after,of); + } + + void special_values_parser(special_values_parser_type sv_parser) + { + m_sv_parser = sv_parser; + } + + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, + date_type& d) const + { + d = m_parser.parse_date(from, to, m_format, m_sv_parser); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, + month_type& m) const + { + m = m_parser.parse_month(from, to, m_month_format); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, + day_of_week_type& wd) const + { + wd = m_parser.parse_weekday(from, to, m_weekday_format); + return from; + } + //! Expects 1 or 2 digit day range: 1-31 + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, + day_type& d) const + { + d = m_parser.parse_var_day_of_month(from, to); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& /*a_ios*/, + year_type& y) const + { + y = m_parser.parse_year(from, to, m_year_format); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + duration_type& dd) const + { + // skip leading whitespace + while(std::isspace(*from) && from != to) { ++from; } + + /* num_get.get() will always consume the first character if it + * is a sign indicator (+/-). Special value strings may begin + * with one of these signs so we'll need a copy of it + * in case num_get.get() fails. */ + char_type c = '\0'; + // TODO Are these characters somewhere in the locale? + if(*from == '-' || *from == '+') { + c = *from; + } + typedef std::num_get num_get; + typename duration_type::duration_rep_type val = 0; + std::ios_base::iostate err = std::ios_base::goodbit; + + if (std::has_facet(a_ios.getloc())) { + from = std::use_facet(a_ios.getloc()).get(from, to, a_ios, err, val); + } + else { + num_get* ng = new num_get(); + std::locale l = std::locale(a_ios.getloc(), ng); + a_ios.imbue(l); + from = ng->get(from, to, a_ios, err, val); + } + if(err & std::ios_base::failbit){ + typedef typename special_values_parser_type::match_results match_results; + match_results mr; + if(c == '-' || c == '+') { // was the first character consumed? + mr.cache += c; + } + m_sv_parser.match(from, to, mr); + if(mr.current_match == match_results::PARSE_ERROR) { + throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"); + } + dd = duration_type(static_cast(mr.current_match)); + } + else { + dd = duration_type(val); + } + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + period_type& p) const + { + p = m_period_parser.get_period(from, to, a_ios, p, duration_type::unit(), *this); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + nth_kday_type& nkd) const + { + nkd = m_date_gen_parser.get_nth_kday_type(from, to, a_ios, *this); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + partial_date_type& pd) const + { + + pd = m_date_gen_parser.get_partial_date_type(from, to, a_ios, *this); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + first_kday_type& fkd) const + { + fkd = m_date_gen_parser.get_first_kday_type(from, to, a_ios, *this); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + last_kday_type& lkd) const + { + lkd = m_date_gen_parser.get_last_kday_type(from, to, a_ios, *this); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + kday_before_type& fkb) const + { + fkb = m_date_gen_parser.get_kday_before_type(from, to, a_ios, *this); + return from; + } + InItrT get(InItrT& from, + InItrT& to, + std::ios_base& a_ios, + kday_after_type& fka) const + { + fka = m_date_gen_parser.get_kday_after_type(from, to, a_ios, *this); + return from; + } + + protected: + string_type m_format; + string_type m_month_format; + string_type m_weekday_format; + string_type m_year_format; + format_date_parser_type m_parser; + date_gen_parser_type m_date_gen_parser; + period_parser_type m_period_parser; + special_values_parser_type m_sv_parser; + private: + }; + + + template + std::locale::id date_input_facet::id; + + template + const typename date_input_facet::char_type + date_input_facet::long_weekday_format[3] = {'%','A'}; + + template + const typename date_input_facet::char_type + date_input_facet::short_weekday_format[3] = {'%','a'}; + + template + const typename date_input_facet::char_type + date_input_facet::long_month_format[3] = {'%','B'}; + + template + const typename date_input_facet::char_type + date_input_facet::short_month_format[3] = {'%','b'}; + + template + const typename date_input_facet::char_type + date_input_facet::four_digit_year_format[3] = {'%','Y'}; + + template + const typename date_input_facet::char_type + date_input_facet::two_digit_year_format[3] = {'%','y'}; + + template + const typename date_input_facet::char_type + date_input_facet::default_period_separator[4] = { ' ', '/', ' '}; + + template + const typename date_input_facet::char_type + date_input_facet::standard_format_specifier[3] = + {'%', 'x' }; + + template + const typename date_input_facet::char_type + date_input_facet::iso_format_specifier[7] = + {'%', 'Y', '%', 'm', '%', 'd' }; + + template + const typename date_input_facet::char_type + date_input_facet::iso_format_extended_specifier[9] = + {'%', 'Y', '-', '%', 'm', '-', '%', 'd' }; + + template + const typename date_input_facet::char_type + date_input_facet::default_date_format[9] = + {'%','Y','-','%','b','-','%','d'}; + +} } // namespaces + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_format_simple.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_format_simple.hpp new file mode 100644 index 0000000000..be21ce4a57 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_format_simple.hpp @@ -0,0 +1,159 @@ +#ifndef DATE_TIME_SIMPLE_FORMAT_HPP___ +#define DATE_TIME_SIMPLE_FORMAT_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/parse_format_base.hpp" + +namespace boost { +namespace date_time { + +//! Class to provide simple basic formatting rules +template +class simple_format { +public: + + //! String used printed is date is invalid + static const charT* not_a_date() + { + return "not-a-date-time"; + } + //! String used to for positive infinity value + static const charT* pos_infinity() + { + return "+infinity"; + } + //! String used to for positive infinity value + static const charT* neg_infinity() + { + return "-infinity"; + } + //! Describe month format + static month_format_spec month_format() + { + return month_as_short_string; + } + static ymd_order_spec date_order() + { + return ymd_order_iso; //YYYY-MM-DD + } + //! This format uses '-' to separate date elements + static bool has_date_sep_chars() + { + return true; + } + //! Char to sep? + static charT year_sep_char() + { + return '-'; + } + //! char between year-month + static charT month_sep_char() + { + return '-'; + } + //! Char to separate month-day + static charT day_sep_char() + { + return '-'; + } + //! char between date-hours + static charT hour_sep_char() + { + return ' '; + } + //! char between hour and minute + static charT minute_sep_char() + { + return ':'; + } + //! char for second + static charT second_sep_char() + { + return ':'; + } + +}; + +#ifndef BOOST_NO_STD_WSTRING + +//! Specialization of formmating rules for wchar_t +template<> +class simple_format { +public: + + //! String used printed is date is invalid + static const wchar_t* not_a_date() + { + return L"not-a-date-time"; + } + //! String used to for positive infinity value + static const wchar_t* pos_infinity() + { + return L"+infinity"; + } + //! String used to for positive infinity value + static const wchar_t* neg_infinity() + { + return L"-infinity"; + } + //! Describe month format + static month_format_spec month_format() + { + return month_as_short_string; + } + static ymd_order_spec date_order() + { + return ymd_order_iso; //YYYY-MM-DD + } + //! This format uses '-' to separate date elements + static bool has_date_sep_chars() + { + return true; + } + //! Char to sep? + static wchar_t year_sep_char() + { + return '-'; + } + //! char between year-month + static wchar_t month_sep_char() + { + return '-'; + } + //! Char to separate month-day + static wchar_t day_sep_char() + { + return '-'; + } + //! char between date-hours + static wchar_t hour_sep_char() + { + return ' '; + } + //! char between hour and minute + static wchar_t minute_sep_char() + { + return ':'; + } + //! char for second + static wchar_t second_sep_char() + { + return ':'; + } + +}; + +#endif // BOOST_NO_STD_WSTRING +} } //namespace date_time + + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting.hpp new file mode 100644 index 0000000000..abe547a5f7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting.hpp @@ -0,0 +1,127 @@ +#ifndef DATE_TIME_DATE_FORMATTING_HPP___ +#define DATE_TIME_DATE_FORMATTING_HPP___ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/iso_format.hpp" +#include "boost/date_time/compiler_config.hpp" +#include +#include +#include + +/* NOTE: "formatter" code for older compilers, ones that define + * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in + * date_formatting_limited.hpp + */ + +namespace boost { +namespace date_time { + + //! Formats a month as as string into an ostream + template + class month_formatter + { + typedef std::basic_ostream ostream_type; + public: + //! Formats a month as as string into an ostream + /*! This function demands that month_type provide + * functions for converting to short and long strings + * if that capability is used. + */ + static ostream_type& format_month(const month_type& month, + ostream_type &os) + { + switch (format_type::month_format()) + { + case month_as_short_string: + { + os << month.as_short_string(); + break; + } + case month_as_long_string: + { + os << month.as_long_string(); + break; + } + case month_as_integer: + { + os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number(); + break; + } + + } + return os; + } // format_month + }; + + + //! Convert ymd to a standard string formatting policies + template + class ymd_formatter + { + public: + //! Convert ymd to a standard string formatting policies + /*! This is standard code for handling date formatting with + * year-month-day based date information. This function + * uses the format_type to control whether the string will + * contain separator characters, and if so what the character + * will be. In addtion, it can format the month as either + * an integer or a string as controled by the formatting + * policy + */ + static std::basic_string ymd_to_string(ymd_type ymd) + { + typedef typename ymd_type::month_type month_type; + std::basic_ostringstream ss; + ss << ymd.year; + if (format_type::has_date_sep_chars()) { + ss << format_type::month_sep_char(); + } + //this name is a bit ugly, oh well.... + month_formatter::format_month(ymd.month, ss); + if (format_type::has_date_sep_chars()) { + ss << format_type::day_sep_char(); + } + ss << std::setw(2) << std::setfill(ss.widen('0')) + << ymd.day; + return ss.str(); + } + }; + + + //! Convert a date to string using format policies + template + class date_formatter + { + public: + typedef std::basic_string string_type; + //! Convert to a date to standard string using format policies + static string_type date_to_string(date_type d) + { + typedef typename date_type::ymd_type ymd_type; + if (d.is_not_a_date()) { + return string_type(format_type::not_a_date()); + } + if (d.is_neg_infinity()) { + return string_type(format_type::neg_infinity()); + } + if (d.is_pos_infinity()) { + return string_type(format_type::pos_infinity()); + } + ymd_type ymd = d.year_month_day(); + return ymd_formatter::ymd_to_string(ymd); + } + }; + + +} } //namespace date_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting_limited.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting_limited.hpp new file mode 100644 index 0000000000..38fee07b91 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting_limited.hpp @@ -0,0 +1,121 @@ +#ifndef DATE_TIME_DATE_FORMATTING_LIMITED_HPP___ +#define DATE_TIME_DATE_FORMATTING_LIMITED_HPP___ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/iso_format.hpp" +#include "boost/date_time/compiler_config.hpp" +#include +#include +#include + + +namespace boost { +namespace date_time { + + //! Formats a month as as string into an ostream + template + class month_formatter + { + public: + //! Formats a month as as string into an ostream + /*! This function demands that month_type provide + * functions for converting to short and long strings + * if that capability is used. + */ + static std::ostream& format_month(const month_type& month, + std::ostream& os) + { + switch (format_type::month_format()) + { + case month_as_short_string: + { + os << month.as_short_string(); + break; + } + case month_as_long_string: + { + os << month.as_long_string(); + break; + } + case month_as_integer: + { + os << std::setw(2) << std::setfill('0') << month.as_number(); + break; + } + + } + return os; + } // format_month + }; + + + //! Convert ymd to a standard string formatting policies + template + class ymd_formatter + { + public: + //! Convert ymd to a standard string formatting policies + /*! This is standard code for handling date formatting with + * year-month-day based date information. This function + * uses the format_type to control whether the string will + * contain separator characters, and if so what the character + * will be. In addtion, it can format the month as either + * an integer or a string as controled by the formatting + * policy + */ + static std::string ymd_to_string(ymd_type ymd) + { + typedef typename ymd_type::month_type month_type; + std::ostringstream ss; + ss << ymd.year; + if (format_type::has_date_sep_chars()) { + ss << format_type::month_sep_char(); + } + //this name is a bit ugly, oh well.... + month_formatter::format_month(ymd.month, ss); + if (format_type::has_date_sep_chars()) { + ss << format_type::day_sep_char(); + } + ss << std::setw(2) << std::setfill('0') + << ymd.day; + return ss.str(); + } + }; + + + //! Convert a date to string using format policies + template + class date_formatter + { + public: + //! Convert to a date to standard string using format policies + static std::string date_to_string(date_type d) + { + typedef typename date_type::ymd_type ymd_type; + if (d.is_not_a_date()) { + return format_type::not_a_date(); + } + if (d.is_neg_infinity()) { + return format_type::neg_infinity(); + } + if (d.is_pos_infinity()) { + return format_type::pos_infinity(); + } + ymd_type ymd = d.year_month_day(); + return ymd_formatter::ymd_to_string(ymd); + } + }; + + +} } //namespace date_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting_locales.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting_locales.hpp new file mode 100644 index 0000000000..4ac9c4e401 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_formatting_locales.hpp @@ -0,0 +1,233 @@ +#ifndef DATE_TIME_DATE_FORMATTING_LOCALES_HPP___ +#define DATE_TIME_DATE_FORMATTING_LOCALES_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/locale_config.hpp" // set BOOST_DATE_TIME_NO_LOCALE + +#ifndef BOOST_DATE_TIME_NO_LOCALE + +#include "boost/date_time/iso_format.hpp" +#include "boost/date_time/date_names_put.hpp" +#include "boost/date_time/parse_format_base.hpp" +//#include +#include +#include + + +namespace boost { +namespace date_time { + + //! Formats a month as as string into an ostream + template + class ostream_month_formatter + { + public: + typedef typename facet_type::month_type month_type; + typedef std::basic_ostream ostream_type; + + //! Formats a month as as string into an output iterator + static void format_month(const month_type& month, + ostream_type& os, + const facet_type& f) + { + + switch (f.month_format()) + { + case month_as_short_string: + { + std::ostreambuf_iterator oitr(os); + f.put_month_short(oitr, month.as_enum()); + break; + } + case month_as_long_string: + { + std::ostreambuf_iterator oitr(os); + f.put_month_long(oitr, month.as_enum()); + break; + } + case month_as_integer: + { + charT fill_char = '0'; + os << std::setw(2) << std::setfill(fill_char) << month.as_number(); + break; + } + + } + } // format_month + + }; + + + //! Formats a weekday + template + class ostream_weekday_formatter + { + public: + typedef typename facet_type::month_type month_type; + typedef std::basic_ostream ostream_type; + + //! Formats a month as as string into an output iterator + static void format_weekday(const weekday_type& wd, + ostream_type& os, + const facet_type& f, + bool as_long_string) + { + + std::ostreambuf_iterator oitr(os); + if (as_long_string) { + f.put_weekday_long(oitr, wd.as_enum()); + } + else { + f.put_weekday_short(oitr, wd.as_enum()); + } + + } // format_weekday + + }; + + + //! Convert ymd to a standard string formatting policies + template + class ostream_ymd_formatter + { + public: + typedef typename ymd_type::month_type month_type; + typedef ostream_month_formatter month_formatter_type; + typedef std::basic_ostream ostream_type; + typedef std::basic_string foo_type; + + //! Convert ymd to a standard string formatting policies + /*! This is standard code for handling date formatting with + * year-month-day based date information. This function + * uses the format_type to control whether the string will + * contain separator characters, and if so what the character + * will be. In addtion, it can format the month as either + * an integer or a string as controled by the formatting + * policy + */ + // static string_type ymd_to_string(ymd_type ymd) +// { +// std::ostringstream ss; +// facet_type dnp; +// ymd_put(ymd, ss, dnp); +// return ss.str(); +// } + + + // Put ymd to ostream -- part of ostream refactor + static void ymd_put(ymd_type ymd, + ostream_type& os, + const facet_type& f) + { + std::ostreambuf_iterator oitr(os); + charT fill_char = '0'; + switch (f.date_order()) { + case ymd_order_iso: { + os << ymd.year; + if (f.has_date_sep_chars()) { + f.month_sep_char(oitr); + } + month_formatter_type::format_month(ymd.month, os, f); + if (f.has_date_sep_chars()) { + f.day_sep_char(oitr); + } + os << std::setw(2) << std::setfill(fill_char) + << ymd.day; + break; + } + case ymd_order_us: { + month_formatter_type::format_month(ymd.month, os, f); + if (f.has_date_sep_chars()) { + f.day_sep_char(oitr); + } + os << std::setw(2) << std::setfill(fill_char) + << ymd.day; + if (f.has_date_sep_chars()) { + f.month_sep_char(oitr); + } + os << ymd.year; + break; + } + case ymd_order_dmy: { + os << std::setw(2) << std::setfill(fill_char) + << ymd.day; + if (f.has_date_sep_chars()) { + f.day_sep_char(oitr); + } + month_formatter_type::format_month(ymd.month, os, f); + if (f.has_date_sep_chars()) { + f.month_sep_char(oitr); + } + os << ymd.year; + break; + } + } + } + }; + + + //! Convert a date to string using format policies + template + class ostream_date_formatter + { + public: + typedef std::basic_ostream ostream_type; + typedef typename date_type::ymd_type ymd_type; + + //! Put date into an ostream + static void date_put(const date_type& d, + ostream_type& os, + const facet_type& f) + { + special_values sv = d.as_special(); + if (sv == not_special) { + ymd_type ymd = d.year_month_day(); + ostream_ymd_formatter::ymd_put(ymd, os, f); + } + else { // output a special value + std::ostreambuf_iterator coi(os); + f.put_special_value(coi, sv); + } + } + + + //! Put date into an ostream + static void date_put(const date_type& d, + ostream_type& os) + { + //retrieve the local from the ostream + std::locale locale = os.getloc(); + if (std::has_facet(locale)) { + const facet_type& f = std::use_facet(locale); + date_put(d, os, f); + } + else { + //default to something sensible if no facet installed + facet_type default_facet; + date_put(d, os, default_facet); + } + } // date_to_ostream + }; //class date_formatter + + +} } //namespace date_time + +#endif + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generator_formatter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generator_formatter.hpp new file mode 100644 index 0000000000..919cc0b338 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generator_formatter.hpp @@ -0,0 +1,263 @@ +#ifndef _DATE_TIME_DATE_GENERATOR_FORMATTER__HPP___ +#define _DATE_TIME_DATE_GENERATOR_FORMATTER__HPP___ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include +#include +#include +#include "boost/date_time/date_generators.hpp" + +namespace boost { +namespace date_time { + + //! Formats date_generators for output + /*! Formatting of date_generators follows specific orders for the + * various types of date_generators. + * - partial_date => "dd Month" + * - nth_day_of_the_week_in_month => "nth weekday of month" + * - first_day_of_the_week_in_month => "first weekday of month" + * - last_day_of_the_week_in_month => "last weekday of month" + * - first_day_of_the_week_after => "weekday after" + * - first_day_of_the_week_before => "weekday before" + * While the order of the elements in these phrases cannot be changed, + * the elements themselves can be. Weekday and Month get their formats + * and names from the date_facet. The remaining elements are stored in + * the date_generator_formatter and can be customized upon construction + * or via a member function. The default elements are those shown in the + * examples above. + */ + template > > + class date_generator_formatter { + public: + typedef partial_date partial_date_type; + typedef nth_kday_of_month nth_kday_type; + typedef first_kday_of_month first_kday_type; + typedef last_kday_of_month last_kday_type; + typedef first_kday_after kday_after_type; + typedef first_kday_before kday_before_type; + + typedef CharT char_type; + typedef std::basic_string string_type; + typedef std::vector collection_type; + static const char_type first_string[6]; + static const char_type second_string[7]; + static const char_type third_string[6]; + static const char_type fourth_string[7]; + static const char_type fifth_string[6]; + static const char_type last_string[5]; + static const char_type before_string[8]; + static const char_type after_string[6]; + static const char_type of_string[3]; + + enum phrase_elements {first=0, second, third, fourth, fifth, last, + before, after, of, number_of_phrase_elements}; + + //! Default format elements used + date_generator_formatter() + { + phrase_strings.push_back(string_type(first_string)); + phrase_strings.push_back(string_type(second_string)); + phrase_strings.push_back(string_type(third_string)); + phrase_strings.push_back(string_type(fourth_string)); + phrase_strings.push_back(string_type(fifth_string)); + phrase_strings.push_back(string_type(last_string)); + phrase_strings.push_back(string_type(before_string)); + phrase_strings.push_back(string_type(after_string)); + phrase_strings.push_back(string_type(of_string)); + } + + //! Constructor that allows for a custom set of phrase elements + date_generator_formatter(const string_type& first, + const string_type& second, + const string_type& third, + const string_type& fourth, + const string_type& fifth, + const string_type& last, + const string_type& before, + const string_type& after, + const string_type& of) + { + phrase_strings.push_back(string_type(first_string)); + phrase_strings.push_back(string_type(second_string)); + phrase_strings.push_back(string_type(third_string)); + phrase_strings.push_back(string_type(fourth_string)); + phrase_strings.push_back(string_type(fifth_string)); + phrase_strings.push_back(string_type(last_string)); + phrase_strings.push_back(string_type(before_string)); + phrase_strings.push_back(string_type(after_string)); + phrase_strings.push_back(string_type(of_string)); + } + + //! Replace the set of phrase elements with those contained in new_strings + /*! The order of the strings in the given collection is important. + * They must follow: + * - first, second, third, fourth, fifth, last, before, after, of. + * + * It is not necessary to send in a complete set if only a few + * elements are to be replaced as long as the correct beg_pos is used. + * + * Ex: To keep the default first through fifth elements, but replace + * the rest with a collection of: + * - "final", "prior", "following", "in". + * The beg_pos of date_generator_formatter::last would be used. + */ + void elements(const collection_type& new_strings, + phrase_elements beg_pos=first) + { + if(beg_pos < number_of_phrase_elements) { + typename collection_type::iterator itr = phrase_strings.begin(); + itr += beg_pos; + std::copy(new_strings.begin(), new_strings.end(), + itr); + //phrase_strings.begin()); + } + } + + //!Put a partial_date => "dd Month" + template + OutItrT put_partial_date(OutItrT next, std::ios_base& a_ios, + CharT a_fill, const partial_date_type& pd, + const facet_type& facet) const + { + facet.put(next, a_ios, a_fill, pd.day()); + next = a_fill; //TODO change this ??? + facet.put(next, a_ios, a_fill, pd.month()); + return next; + } + + //! Put an nth_day_of_the_week_in_month => "nth weekday of month" + template + OutItrT put_nth_kday(OutItrT next, std::ios_base& a_ios, + CharT a_fill, const nth_kday_type& nkd, + const facet_type& facet) const + { + put_string(next, phrase_strings[nkd.nth_week() -1]); + next = a_fill; //TODO change this ??? + facet.put(next, a_ios, a_fill, nkd.day_of_week()); + next = a_fill; //TODO change this ??? + put_string(next, string_type(of_string)); + next = a_fill; //TODO change this ??? + facet.put(next, a_ios, a_fill, nkd.month()); + return next; + } + + //! Put a first_day_of_the_week_in_month => "first weekday of month" + template + OutItrT put_first_kday(OutItrT next, std::ios_base& a_ios, + CharT a_fill, const first_kday_type& fkd, + const facet_type& facet) const + { + put_string(next, phrase_strings[first]); + next = a_fill; //TODO change this ??? + facet.put(next, a_ios, a_fill, fkd.day_of_week()); + next = a_fill; //TODO change this ??? + put_string(next, string_type(of_string)); + next = a_fill; //TODO change this ??? + facet.put(next, a_ios, a_fill, fkd.month()); + return next; + } + + //! Put a last_day_of_the_week_in_month => "last weekday of month" + template + OutItrT put_last_kday(OutItrT next, std::ios_base& a_ios, + CharT a_fill, const last_kday_type& lkd, + const facet_type& facet) const + { + put_string(next, phrase_strings[last]); + next = a_fill; //TODO change this ??? + facet.put(next, a_ios, a_fill, lkd.day_of_week()); + next = a_fill; //TODO change this ??? + put_string(next, string_type(of_string)); + next = a_fill; //TODO change this ??? + facet.put(next, a_ios, a_fill, lkd.month()); + return next; + } + + //! Put a first_day_of_the_week_before => "weekday before" + template + OutItrT put_kday_before(OutItrT next, std::ios_base& a_ios, + CharT a_fill, const kday_before_type& fkb, + const facet_type& facet) const + { + facet.put(next, a_ios, a_fill, fkb.day_of_week()); + next = a_fill; //TODO change this ??? + put_string(next, phrase_strings[before]); + return next; + } + + //! Put a first_day_of_the_week_after => "weekday after" + template + OutItrT put_kday_after(OutItrT next, std::ios_base& a_ios, + CharT a_fill, const kday_after_type& fka, + const facet_type& facet) const + { + facet.put(next, a_ios, a_fill, fka.day_of_week()); + next = a_fill; //TODO change this ??? + put_string(next, phrase_strings[after]); + return next; + } + + + private: + collection_type phrase_strings; + + //! helper function to put the various member string into stream + OutItrT put_string(OutItrT next, const string_type& str) const + { + typename string_type::const_iterator itr = str.begin(); + while(itr != str.end()) { + *next = *itr; + ++itr; + ++next; + } + return next; + } + }; + + template + const typename date_generator_formatter::char_type + date_generator_formatter::first_string[6] = + {'f','i','r','s','t'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::second_string[7] = + {'s','e','c','o','n','d'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::third_string[6] = + {'t','h','i','r','d'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::fourth_string[7] = + {'f','o','u','r','t','h'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::fifth_string[6] = + {'f','i','f','t','h'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::last_string[5] = + {'l','a','s','t'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::before_string[8] = + {'b','e','f','o','r','e'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::after_string[6] = + {'a','f','t','e','r'}; + template + const typename date_generator_formatter::char_type + date_generator_formatter::of_string[3] = + {'o','f'}; +} } // namespaces + +#endif // _DATE_TIME_DATE_GENERATOR_FORMATTER__HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generator_parser.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generator_parser.hpp new file mode 100644 index 0000000000..fd662e44c7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generator_parser.hpp @@ -0,0 +1,329 @@ + +#ifndef DATE_TIME_DATE_GENERATOR_PARSER_HPP__ +#define DATE_TIME_DATE_GENERATOR_PARSER_HPP__ + +/* Copyright (c) 2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/string_parse_tree.hpp" +#include "boost/date_time/date_generators.hpp" +#include "boost/date_time/format_date_parser.hpp" +#include +#include + +namespace boost { namespace date_time { + + //! Class for date_generator parsing + /*! The elements of a date_generator "phrase" are parsed from the input stream in a + * particular order. All elements are required and the order in which they appear + * cannot change, however, the elements themselves can be changed. The default + * elements and their order are as follows: + * + * - partial_date => "dd Month" + * - nth_day_of_the_week_in_month => "nth weekday of month" + * - first_day_of_the_week_in_month => "first weekday of month" + * - last_day_of_the_week_in_month => "last weekday of month" + * - first_day_of_the_week_after => "weekday after" + * - first_day_of_the_week_before => "weekday before" + * + * Weekday and Month names and formats are handled via the date_input_facet. + * + */ + template + class date_generator_parser + { + public: + typedef std::basic_string string_type; + typedef std::istreambuf_iterator stream_itr_type; + + typedef typename date_type::month_type month_type; + typedef typename date_type::day_of_week_type day_of_week_type; + typedef typename date_type::day_type day_type; + + typedef string_parse_tree parse_tree_type; + typedef typename parse_tree_type::parse_match_result_type match_results; + typedef std::vector > collection_type; + + typedef partial_date partial_date_type; + typedef nth_kday_of_month nth_kday_type; + typedef first_kday_of_month first_kday_type; + typedef last_kday_of_month last_kday_type; + typedef first_kday_after kday_after_type; + typedef first_kday_before kday_before_type; + + typedef charT char_type; + static const char_type first_string[6]; + static const char_type second_string[7]; + static const char_type third_string[6]; + static const char_type fourth_string[7]; + static const char_type fifth_string[6]; + static const char_type last_string[5]; + static const char_type before_string[8]; + static const char_type after_string[6]; + static const char_type of_string[3]; + + enum phrase_elements {first=0, second, third, fourth, fifth, last, + before, after, of, number_of_phrase_elements}; + + //! Creates a date_generator_parser with the default set of "element_strings" + date_generator_parser() + { + element_strings(string_type(first_string), + string_type(second_string), + string_type(third_string), + string_type(fourth_string), + string_type(fifth_string), + string_type(last_string), + string_type(before_string), + string_type(after_string), + string_type(of_string)); + } + + //! Creates a date_generator_parser using a user defined set of element strings + date_generator_parser(const string_type& first_str, + const string_type& second_str, + const string_type& third_str, + const string_type& fourth_str, + const string_type& fifth_str, + const string_type& last_str, + const string_type& before_str, + const string_type& after_str, + const string_type& of_str) + { + element_strings(first_str, second_str, third_str, fourth_str, fifth_str, + last_str, before_str, after_str, of_str); + } + + //! Replace strings that determine nth week for generator + void element_strings(const string_type& first_str, + const string_type& second_str, + const string_type& third_str, + const string_type& fourth_str, + const string_type& fifth_str, + const string_type& last_str, + const string_type& before_str, + const string_type& after_str, + const string_type& of_str) + { + collection_type phrases; + phrases.push_back(first_str); + phrases.push_back(second_str); + phrases.push_back(third_str); + phrases.push_back(fourth_str); + phrases.push_back(fifth_str); + phrases.push_back(last_str); + phrases.push_back(before_str); + phrases.push_back(after_str); + phrases.push_back(of_str); + m_element_strings = parse_tree_type(phrases, this->first); // enum first + } + + void element_strings(const collection_type& col) + { + m_element_strings = parse_tree_type(col, this->first); // enum first + } + + + //! returns partial_date parsed from stream + template + partial_date_type + get_partial_date_type(stream_itr_type& sitr, + stream_itr_type& stream_end, + std::ios_base& a_ios, + const facet_type& facet) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + day_type d(1); + month_type m(1); + facet.get(sitr, stream_end, a_ios, d); + facet.get(sitr, stream_end, a_ios, m); + + return partial_date_type(d,m); + } + + //! returns nth_kday_of_week parsed from stream + template + nth_kday_type + get_nth_kday_type(stream_itr_type& sitr, + stream_itr_type& stream_end, + std::ios_base& a_ios, + const facet_type& facet) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + typename nth_kday_type::week_num wn; + day_of_week_type wd(0); // no default constructor + month_type m(1); // no default constructor + + match_results mr = m_element_strings.match(sitr, stream_end); + switch(mr.current_match) { + case first : { wn = nth_kday_type::first; break; } + case second : { wn = nth_kday_type::second; break; } + case third : { wn = nth_kday_type::third; break; } + case fourth : { wn = nth_kday_type::fourth; break; } + case fifth : { wn = nth_kday_type::fifth; break; } + default: + { + throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"); + break; + } + } // week num + facet.get(sitr, stream_end, a_ios, wd); // day_of_week + extract_element(sitr, stream_end, of); // "of" element + facet.get(sitr, stream_end, a_ios, m); // month + + return nth_kday_type(wn, wd, m); + } + + //! returns first_kday_of_week parsed from stream + template + first_kday_type + get_first_kday_type(stream_itr_type& sitr, + stream_itr_type& stream_end, + std::ios_base& a_ios, + const facet_type& facet) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + day_of_week_type wd(0); // no default constructor + month_type m(1); // no default constructor + + extract_element(sitr, stream_end, first); // "first" element + facet.get(sitr, stream_end, a_ios, wd); // day_of_week + extract_element(sitr, stream_end, of); // "of" element + facet.get(sitr, stream_end, a_ios, m); // month + + + return first_kday_type(wd, m); + } + + //! returns last_kday_of_week parsed from stream + template + last_kday_type + get_last_kday_type(stream_itr_type& sitr, + stream_itr_type& stream_end, + std::ios_base& a_ios, + const facet_type& facet) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + day_of_week_type wd(0); // no default constructor + month_type m(1); // no default constructor + + extract_element(sitr, stream_end, last); // "last" element + facet.get(sitr, stream_end, a_ios, wd); // day_of_week + extract_element(sitr, stream_end, of); // "of" element + facet.get(sitr, stream_end, a_ios, m); // month + + + return last_kday_type(wd, m); + } + + //! returns first_kday_of_week parsed from stream + template + kday_before_type + get_kday_before_type(stream_itr_type& sitr, + stream_itr_type& stream_end, + std::ios_base& a_ios, + const facet_type& facet) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + day_of_week_type wd(0); // no default constructor + + facet.get(sitr, stream_end, a_ios, wd); // day_of_week + extract_element(sitr, stream_end, before);// "before" element + + return kday_before_type(wd); + } + + //! returns first_kday_of_week parsed from stream + template + kday_after_type + get_kday_after_type(stream_itr_type& sitr, + stream_itr_type& stream_end, + std::ios_base& a_ios, + const facet_type& facet) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + day_of_week_type wd(0); // no default constructor + + facet.get(sitr, stream_end, a_ios, wd); // day_of_week + extract_element(sitr, stream_end, after); // "after" element + + return kday_after_type(wd); + } + + private: + parse_tree_type m_element_strings; + + //! Extracts phrase element from input. Throws ios_base::failure on error. + void extract_element(stream_itr_type& sitr, + stream_itr_type& stream_end, + typename date_generator_parser::phrase_elements ele) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + match_results mr = m_element_strings.match(sitr, stream_end); + if(mr.current_match != ele) { + throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"); + } + } + + }; + + template + const typename date_generator_parser::char_type + date_generator_parser::first_string[6] = + {'f','i','r','s','t'}; + template + const typename date_generator_parser::char_type + date_generator_parser::second_string[7] = + {'s','e','c','o','n','d'}; + template + const typename date_generator_parser::char_type + date_generator_parser::third_string[6] = + {'t','h','i','r','d'}; + template + const typename date_generator_parser::char_type + date_generator_parser::fourth_string[7] = + {'f','o','u','r','t','h'}; + template + const typename date_generator_parser::char_type + date_generator_parser::fifth_string[6] = + {'f','i','f','t','h'}; + template + const typename date_generator_parser::char_type + date_generator_parser::last_string[5] = + {'l','a','s','t'}; + template + const typename date_generator_parser::char_type + date_generator_parser::before_string[8] = + {'b','e','f','o','r','e'}; + template + const typename date_generator_parser::char_type + date_generator_parser::after_string[6] = + {'a','f','t','e','r'}; + template + const typename date_generator_parser::char_type + date_generator_parser::of_string[3] = + {'o','f'}; + +} } //namespace + +#endif // DATE_TIME_DATE_GENERATOR_PARSER_HPP__ + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generators.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generators.hpp new file mode 100644 index 0000000000..96cdeead43 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_generators.hpp @@ -0,0 +1,509 @@ +#ifndef DATE_TIME_DATE_GENERATORS_HPP__ +#define DATE_TIME_DATE_GENERATORS_HPP__ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file date_generators.hpp + Definition and implementation of date algorithm templates +*/ +#include +#include +#include "boost/date_time/date.hpp" +#include "boost/date_time/compiler_config.hpp" + +namespace boost { +namespace date_time { + + //! Base class for all generators that take a year and produce a date. + /*! This class is a base class for polymorphic function objects that take + a year and produce a concrete date. + @param date_type The type representing a date. This type must + export a calender_type which defines a year_type. + */ + template + class year_based_generator + { + public: + typedef typename date_type::calendar_type calendar_type; + typedef typename calendar_type::year_type year_type; + year_based_generator() {}; + virtual ~year_based_generator() {}; + virtual date_type get_date(year_type y) const = 0; + //! Returns a string for use in a POSIX time_zone string + virtual std::string to_string() const =0; + }; + + //! Generates a date by applying the year to the given month and day. + /*! + Example usage: + @code + partial_date pd(1, Jan); + partial_date pd2(70); + date d = pd.get_date(2002); //2002-Jan-01 + date d2 = pd2.get_date(2002); //2002-Mar-10 + @endcode + \ingroup date_alg + */ + template + class partial_date : public year_based_generator + { + public: + typedef typename date_type::calendar_type calendar_type; + typedef typename calendar_type::day_type day_type; + typedef typename calendar_type::month_type month_type; + typedef typename calendar_type::year_type year_type; + typedef typename date_type::duration_type duration_type; + typedef typename duration_type::duration_rep duration_rep; + partial_date(day_type d, month_type m) : + day_(d), + month_(m) + {} + //! Partial date created from number of days into year. Range 1-366 + /*! Allowable values range from 1 to 366. 1=Jan1, 366=Dec31. If argument + * exceeds range, partial_date will be created with closest in-range value. + * 60 will always be Feb29, if get_date() is called with a non-leap year + * an exception will be thrown */ + partial_date(duration_rep days) : + day_(1), // default values + month_(1) + { + date_type d1(2000,1,1); + if(days > 1) { + if(days > 366) // prevents wrapping + { + days = 366; + } + days = days - 1; + duration_type dd(days); + d1 = d1 + dd; + } + day_ = d1.day(); + month_ = d1.month(); + } + //! Return a concrete date when provided with a year specific year. + /*! Will throw an 'invalid_argument' exception if a partial_date object, + * instantiated with Feb-29, has get_date called with a non-leap year. + * Example: + * @code + * partial_date pd(29, Feb); + * pd.get_date(2003); // throws invalid_argument exception + * pg.get_date(2000); // returns 2000-2-29 + * @endcode + */ + date_type get_date(year_type y) const + { + if((day_ == 29) && (month_ == 2) && !(calendar_type::is_leap_year(y))) { + std::stringstream ss(""); + ss << "No Feb 29th in given year of " << y << "."; + throw std::invalid_argument(ss.str()); + //return date_type(1,1,1); // should never reach + } else { + return date_type(y, month_, day_); + } + } + date_type operator()(year_type y) const + { + return get_date(y); + //return date_type(y, month_, day_); + } + bool operator==(const partial_date& rhs) const + { + return (month_ == rhs.month_) && (day_ == rhs.day_); + } + bool operator<(const partial_date& rhs) const + { + if (month_ < rhs.month_) return true; + if (month_ > rhs.month_) return false; + //months are equal + return (day_ < rhs.day_); + } + + // added for streaming purposes + month_type month() const + { + return month_; + } + day_type day() const + { + return day_; + } + + //! Returns string suitable for use in POSIX time zone string + /*! Returns string formatted with up to 3 digits: + * Jan-01 == "0" + * Feb-29 == "58" + * Dec-31 == "365" */ + virtual std::string to_string() const + { + std::stringstream ss; + date_type d(2004, month_, day_); + unsigned short c = d.day_of_year(); + c--; // numbered 0-365 while day_of_year is 1 based... + ss << c; + return ss.str(); + } + private: + day_type day_; + month_type month_; + }; + + + //! Useful generator functor for finding holidays + /*! Based on the idea in Cal. Calc. for finding holidays that are + * the 'first Monday of September'. When instantiated with + * 'fifth' kday of month, the result will be the last kday of month + * which can be the fourth or fifth depending on the structure of + * the month. + * + * The algorithm here basically guesses for the first + * day of the month. Then finds the first day of the correct + * type. That is, if the first of the month is a Tuesday + * and it needs Wenesday then we simply increment by a day + * and then we can add the length of a week until we get + * to the 'nth kday'. There are probably more efficient + * algorithms based on using a mod 7, but this one works + * reasonably well for basic applications. + * \ingroup date_alg + */ + template + class nth_kday_of_month : public year_based_generator + { + public: + typedef typename date_type::calendar_type calendar_type; + typedef typename calendar_type::day_of_week_type day_of_week_type; + typedef typename calendar_type::month_type month_type; + typedef typename calendar_type::year_type year_type; + typedef typename date_type::duration_type duration_type; + enum week_num {first=1, second, third, fourth, fifth}; + nth_kday_of_month(week_num week_no, + day_of_week_type dow, + month_type m) : + month_(m), + wn_(week_no), + dow_(dow) + {} + //! Return a concrete date when provided with a year specific year. + date_type get_date(year_type y) const + { + date_type d(y, month_, 1); //first day of month + duration_type one_day(1); + duration_type one_week(7); + while (dow_ != d.day_of_week()) { + d = d + one_day; + } + int week = 1; + while (week < wn_) { + d = d + one_week; + week++; + } + // remove wrapping to next month behavior + if(d.month() != month_) { + d = d - one_week; + } + return d; + } + // added for streaming + month_type month() const + { + return month_; + } + week_num nth_week() const + { + return wn_; + } + day_of_week_type day_of_week() const + { + return dow_; + } + const char* nth_week_as_str() const + { + return nth_as_str(wn_); + } + //! Returns string suitable for use in POSIX time zone string + /*! Returns a string formatted as "M4.3.0" ==> 3rd Sunday in April. */ + virtual std::string to_string() const + { + std::stringstream ss; + ss << 'M' + << static_cast(month_) << '.' + << static_cast(wn_) << '.' + << static_cast(dow_); + return ss.str(); + } + private: + month_type month_; + week_num wn_; + day_of_week_type dow_; + }; + + //! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5. + BOOST_DATE_TIME_DECL const char* nth_as_str(int n); + + //! Useful generator functor for finding holidays and daylight savings + /*! Similar to nth_kday_of_month, but requires less paramters + * \ingroup date_alg + */ + template + class first_kday_of_month : public year_based_generator + { + public: + typedef typename date_type::calendar_type calendar_type; + typedef typename calendar_type::day_of_week_type day_of_week_type; + typedef typename calendar_type::month_type month_type; + typedef typename calendar_type::year_type year_type; + typedef typename date_type::duration_type duration_type; + //!Specify the first 'Sunday' in 'April' spec + /*!@param dow The day of week, eg: Sunday, Monday, etc + * @param m The month of the year, eg: Jan, Feb, Mar, etc + */ + first_kday_of_month(day_of_week_type dow, month_type m) : + month_(m), + dow_(dow) + {} + //! Return a concrete date when provided with a year specific year. + date_type get_date(year_type year) const + { + date_type d(year, month_,1); + duration_type one_day(1); + while (dow_ != d.day_of_week()) { + d = d + one_day; + } + return d; + } + // added for streaming + month_type month() const + { + return month_; + } + day_of_week_type day_of_week() const + { + return dow_; + } + //! Returns string suitable for use in POSIX time zone string + /*! Returns a string formatted as "M4.1.0" ==> 1st Sunday in April. */ + virtual std::string to_string() const + { + std::stringstream ss; + ss << 'M' + << static_cast(month_) << '.' + << 1 << '.' + << static_cast(dow_); + return ss.str(); + } + private: + month_type month_; + day_of_week_type dow_; + }; + + + + //! Calculate something like Last Sunday of January + /*! Useful generator functor for finding holidays and daylight savings + * Get the last day of the month and then calculate the difference + * to the last previous day. + * @param date_type A date class that exports day_of_week, month_type, etc. + * \ingroup date_alg + */ + template + class last_kday_of_month : public year_based_generator + { + public: + typedef typename date_type::calendar_type calendar_type; + typedef typename calendar_type::day_of_week_type day_of_week_type; + typedef typename calendar_type::month_type month_type; + typedef typename calendar_type::year_type year_type; + typedef typename date_type::duration_type duration_type; + //!Specify the date spec like last 'Sunday' in 'April' spec + /*!@param dow The day of week, eg: Sunday, Monday, etc + * @param m The month of the year, eg: Jan, Feb, Mar, etc + */ + last_kday_of_month(day_of_week_type dow, month_type m) : + month_(m), + dow_(dow) + {} + //! Return a concrete date when provided with a year specific year. + date_type get_date(year_type year) const + { + date_type d(year, month_, calendar_type::end_of_month_day(year,month_)); + duration_type one_day(1); + while (dow_ != d.day_of_week()) { + d = d - one_day; + } + return d; + } + // added for streaming + month_type month() const + { + return month_; + } + day_of_week_type day_of_week() const + { + return dow_; + } + //! Returns string suitable for use in POSIX time zone string + /*! Returns a string formatted as "M4.5.0" ==> last Sunday in April. */ + virtual std::string to_string() const + { + std::stringstream ss; + ss << 'M' + << static_cast(month_) << '.' + << 5 << '.' + << static_cast(dow_); + return ss.str(); + } + private: + month_type month_; + day_of_week_type dow_; + }; + + + //! Calculate something like "First Sunday after Jan 1,2002 + /*! Date generator that takes a date and finds kday after + *@code + typedef boost::date_time::first_kday_after firstkdayafter; + firstkdayafter fkaf(Monday); + fkaf.get_date(date(2002,Feb,1)); + @endcode + * \ingroup date_alg + */ + template + class first_kday_after + { + public: + typedef typename date_type::calendar_type calendar_type; + typedef typename calendar_type::day_of_week_type day_of_week_type; + typedef typename date_type::duration_type duration_type; + first_kday_after(day_of_week_type dow) : + dow_(dow) + {} + //! Return next kday given. + date_type get_date(date_type start_day) const + { + duration_type one_day(1); + date_type d = start_day + one_day; + while (dow_ != d.day_of_week()) { + d = d + one_day; + } + return d; + } + // added for streaming + day_of_week_type day_of_week() const + { + return dow_; + } + private: + day_of_week_type dow_; + }; + + //! Calculate something like "First Sunday before Jan 1,2002 + /*! Date generator that takes a date and finds kday after + *@code + typedef boost::date_time::first_kday_before firstkdaybefore; + firstkdaybefore fkbf(Monday); + fkbf.get_date(date(2002,Feb,1)); + @endcode + * \ingroup date_alg + */ + template + class first_kday_before + { + public: + typedef typename date_type::calendar_type calendar_type; + typedef typename calendar_type::day_of_week_type day_of_week_type; + typedef typename date_type::duration_type duration_type; + first_kday_before(day_of_week_type dow) : + dow_(dow) + {} + //! Return next kday given. + date_type get_date(date_type start_day) const + { + duration_type one_day(1); + date_type d = start_day - one_day; + while (dow_ != d.day_of_week()) { + d = d - one_day; + } + return d; + } + // added for streaming + day_of_week_type day_of_week() const + { + return dow_; + } + private: + day_of_week_type dow_; + }; + + //! Calculates the number of days until the next weekday + /*! Calculates the number of days until the next weekday. + * If the date given falls on a Sunday and the given weekday + * is Tuesday the result will be 2 days */ + template + inline + typename date_type::duration_type days_until_weekday(const date_type& d, const weekday_type& wd) + { + typedef typename date_type::duration_type duration_type; + duration_type wks(0); + duration_type dd(wd.as_number() - d.day_of_week().as_number()); + if(dd.is_negative()){ + wks = duration_type(7); + } + return dd + wks; + } + + //! Calculates the number of days since the previous weekday + /*! Calculates the number of days since the previous weekday + * If the date given falls on a Sunday and the given weekday + * is Tuesday the result will be 5 days. The answer will be a positive + * number because Tuesday is 5 days before Sunday, not -5 days before. */ + template + inline + typename date_type::duration_type days_before_weekday(const date_type& d, const weekday_type& wd) + { + typedef typename date_type::duration_type duration_type; + duration_type wks(0); + duration_type dd(wd.as_number() - d.day_of_week().as_number()); + if(dd.days() > 0){ + wks = duration_type(7); + } + // we want a number of days, not an offset. The value returned must + // be zero or larger. + return (-dd + wks); + } + + //! Generates a date object representing the date of the following weekday from the given date + /*! Generates a date object representing the date of the following + * weekday from the given date. If the date given is 2004-May-9 + * (a Sunday) and the given weekday is Tuesday then the resulting date + * will be 2004-May-11. */ + template + inline + date_type next_weekday(const date_type& d, const weekday_type& wd) + { + return d + days_until_weekday(d, wd); + } + + //! Generates a date object representing the date of the previous weekday from the given date + /*! Generates a date object representing the date of the previous + * weekday from the given date. If the date given is 2004-May-9 + * (a Sunday) and the given weekday is Tuesday then the resulting date + * will be 2004-May-4. */ + template + inline + date_type previous_weekday(const date_type& d, const weekday_type& wd) + { + return d - days_before_weekday(d, wd); + } + +} } //namespace date_time + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_iterator.hpp new file mode 100644 index 0000000000..284dc749d0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_iterator.hpp @@ -0,0 +1,101 @@ +#ifndef DATE_ITERATOR_HPP___ +#define DATE_ITERATOR_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include + +namespace boost { +namespace date_time { + //! An iterator over dates with varying resolution (day, week, month, year, etc) + enum date_resolutions {day, week, months, year, decade, century, NumDateResolutions}; + + //! Base date iterator type + /*! This class provides the skeleton for the creation of iterators. + * New and interesting interators can be created by plugging in a new + * function that derives the next value from the current state. + * generation of various types of -based information. + * + * Template Parameters + * + * date_type + * + * The date_type is a concrete date_type. The date_type must + * define a duration_type and a calendar_type. + */ + template + class date_itr_base { + // works, but benefit unclear at the moment + // class date_itr_base : public std::iterator{ + public: + typedef typename date_type::duration_type duration_type; + typedef date_type value_type; + typedef std::input_iterator_tag iterator_category; + + date_itr_base(date_type d) : current_(d) {} + virtual ~date_itr_base() {}; + date_itr_base& operator++() + { + current_ = current_ + get_offset(current_); + return *this; + } + date_itr_base& operator--() + { + current_ = current_ + get_neg_offset(current_); + return *this; + } + virtual duration_type get_offset(const date_type& current) const=0; + virtual duration_type get_neg_offset(const date_type& current) const=0; + date_type operator*() {return current_;}; + date_type* operator->() {return ¤t_;}; + bool operator< (const date_type& d) {return current_ < d;} + bool operator<= (const date_type& d) {return current_ <= d;} + bool operator> (const date_type& d) {return current_ > d;} + bool operator>= (const date_type& d) {return current_ >= d;} + bool operator== (const date_type& d) {return current_ == d;} + bool operator!= (const date_type& d) {return current_ != d;} + private: + date_type current_; + }; + + //! Overrides the base date iterator providing hook for functors + /* + * offset_functor + * + * The offset functor must define a get_offset function that takes the + * current point in time and calculates and offset. + * + */ + template + class date_itr : public date_itr_base { + public: + typedef typename date_type::duration_type duration_type; + date_itr(date_type d, int factor=1) : + date_itr_base(d), + of_(factor) + {} + private: + virtual duration_type get_offset(const date_type& current) const + { + return of_.get_offset(current); + } + virtual duration_type get_neg_offset(const date_type& current) const + { + return of_.get_neg_offset(current); + } + offset_functor of_; + }; + + + +} } //namespace date_time + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_names_put.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_names_put.hpp new file mode 100644 index 0000000000..c6f0ce2a6f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_names_put.hpp @@ -0,0 +1,320 @@ +#ifndef DATE_TIME_DATE_NAMES_PUT_HPP___ +#define DATE_TIME_DATE_NAMES_PUT_HPP___ + +/* Copyright (c) 2002-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/locale_config.hpp" // set BOOST_DATE_TIME_NO_LOCALE + +#ifndef BOOST_DATE_TIME_NO_LOCALE + +#include "boost/date_time/special_defs.hpp" +#include "boost/date_time/date_defs.hpp" +#include "boost/date_time/parse_format_base.hpp" +#include "boost/lexical_cast.hpp" +#include + + +namespace boost { +namespace date_time { + + //! Output facet base class for gregorian dates. + /*! This class is a base class for date facets used to localize the + * names of months and the names of days in the week. + * + * Requirements of Config + * - define an enumeration month_enum that enumerates the months. + * The enumeration should be '1' based eg: Jan==1 + * - define as_short_string and as_long_string + * + * (see langer & kreft p334). + * + */ + template > + class date_names_put : public std::locale::facet + { + public: + date_names_put() {}; + typedef OutputIterator iter_type; + typedef typename Config::month_type month_type; + typedef typename Config::month_enum month_enum; + typedef typename Config::weekday_enum weekday_enum; + typedef typename Config::special_value_enum special_value_enum; + //typedef typename Config::format_type format_type; + typedef std::basic_string string_type; + typedef charT char_type; + static const char_type default_special_value_names[3][17]; + static const char_type separator[2]; + + static std::locale::id id; + +#if defined (__SUNPRO_CC) && defined (_RWSTD_VER) + std::locale::id& __get_id (void) const { return id; } +#endif + + void put_special_value(iter_type& oitr, special_value_enum sv) const + { + do_put_special_value(oitr, sv); + } + void put_month_short(iter_type& oitr, month_enum moy) const + { + do_put_month_short(oitr, moy); + } + void put_month_long(iter_type& oitr, month_enum moy) const + { + do_put_month_long(oitr, moy); + } + void put_weekday_short(iter_type& oitr, weekday_enum wd) const + { + do_put_weekday_short(oitr, wd); + } + void put_weekday_long(iter_type& oitr, weekday_enum wd) const + { + do_put_weekday_long(oitr, wd); + } + bool has_date_sep_chars() const + { + return do_has_date_sep_chars(); + } + void year_sep_char(iter_type& oitr) const + { + do_year_sep_char(oitr); + } + //! char between year-month + void month_sep_char(iter_type& oitr) const + { + do_month_sep_char(oitr); + } + //! Char to separate month-day + void day_sep_char(iter_type& oitr) const + { + do_day_sep_char(oitr); + } + //! Determines the order to put the date elements + ymd_order_spec date_order() const + { + return do_date_order(); + } + //! Determines if month is displayed as integer, short or long string + month_format_spec month_format() const + { + return do_month_format(); + } + + protected: + //! Default facet implementation uses month_type defaults + virtual void do_put_month_short(iter_type& oitr, month_enum moy) const + { + month_type gm(moy); + charT c = '\0'; + put_string(oitr, gm.as_short_string(c)); + } + //! Default facet implementation uses month_type defaults + virtual void do_put_month_long(iter_type& oitr, + month_enum moy) const + { + month_type gm(moy); + charT c = '\0'; + put_string(oitr, gm.as_long_string(c)); + } + //! Default facet implementation for special value types + virtual void do_put_special_value(iter_type& oitr, special_value_enum sv) const + { + if(sv <= 2) { // only output not_a_date_time, neg_infin, or pos_infin + string_type s(default_special_value_names[sv]); + put_string(oitr, s); + } + } + virtual void do_put_weekday_short(iter_type&, weekday_enum) const + { + } + virtual void do_put_weekday_long(iter_type&, weekday_enum) const + { + } + virtual bool do_has_date_sep_chars() const + { + return true; + } + virtual void do_year_sep_char(iter_type& oitr) const + { + string_type s(separator); + put_string(oitr, s); + } + //! char between year-month + virtual void do_month_sep_char(iter_type& oitr) const + { + string_type s(separator); + put_string(oitr, s); + } + //! Char to separate month-day + virtual void do_day_sep_char(iter_type& oitr) const + { + string_type s(separator); //put in '-' + put_string(oitr, s); + } + //! Default for date order + virtual ymd_order_spec do_date_order() const + { + return ymd_order_iso; + } + //! Default month format + virtual month_format_spec do_month_format() const + { + return month_as_short_string; + } + void put_string(iter_type& oi, const charT* const s) const + { + string_type s1(boost::lexical_cast(s)); + typename string_type::iterator si,end; + for (si=s1.begin(), end=s1.end(); si!=end; si++, oi++) { + *oi = *si; + } + } + void put_string(iter_type& oi, const string_type& s1) const + { + typename string_type::const_iterator si,end; + for (si=s1.begin(), end=s1.end(); si!=end; si++, oi++) { + *oi = *si; + } + } + }; + + template + const typename date_names_put::char_type + date_names_put::default_special_value_names[3][17] = { + {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'}, + {'-','i','n','f','i','n','i','t','y'}, + {'+','i','n','f','i','n','i','t','y'} }; + + template + const typename date_names_put::char_type + date_names_put::separator[2] = + {'-', '\0'} ; + + + //! Generate storage location for a std::locale::id + template + std::locale::id date_names_put::id; + + //! A date name output facet that takes an array of char* to define strings + template > + class all_date_names_put : public date_names_put + { + public: + all_date_names_put(const charT* const month_short_names[], + const charT* const month_long_names[], + const charT* const special_value_names[], + const charT* const weekday_short_names[], + const charT* const weekday_long_names[], + charT separator_char = '-', + ymd_order_spec order_spec = ymd_order_iso, + month_format_spec month_format = month_as_short_string) : + month_short_names_(month_short_names), + month_long_names_(month_long_names), + special_value_names_(special_value_names), + weekday_short_names_(weekday_short_names), + weekday_long_names_(weekday_long_names), + order_spec_(order_spec), + month_format_spec_(month_format) + { + separator_char_[0] = separator_char; + separator_char_[1] = '\0'; + + }; + typedef OutputIterator iter_type; + typedef typename Config::month_enum month_enum; + typedef typename Config::weekday_enum weekday_enum; + typedef typename Config::special_value_enum special_value_enum; + + const charT* const* get_short_month_names() const + { + return month_short_names_; + } + const charT* const* get_long_month_names() const + { + return month_long_names_; + } + const charT* const* get_special_value_names() const + { + return special_value_names_; + } + const charT* const* get_short_weekday_names()const + { + return weekday_short_names_; + } + const charT* const* get_long_weekday_names()const + { + return weekday_long_names_; + } + + protected: + //! Generic facet that takes array of chars + virtual void do_put_month_short(iter_type& oitr, month_enum moy) const + { + this->put_string(oitr, month_short_names_[moy-1]); + } + //! Long month names + virtual void do_put_month_long(iter_type& oitr, month_enum moy) const + { + this->put_string(oitr, month_long_names_[moy-1]); + } + //! Special values names + virtual void do_put_special_value(iter_type& oitr, special_value_enum sv) const + { + this->put_string(oitr, special_value_names_[sv]); + } + virtual void do_put_weekday_short(iter_type& oitr, weekday_enum wd) const + { + this->put_string(oitr, weekday_short_names_[wd]); + } + virtual void do_put_weekday_long(iter_type& oitr, weekday_enum wd) const + { + this->put_string(oitr, weekday_long_names_[wd]); + } + //! char between year-month + virtual void do_month_sep_char(iter_type& oitr) const + { + this->put_string(oitr, separator_char_); + } + //! Char to separate month-day + virtual void do_day_sep_char(iter_type& oitr) const + { + this->put_string(oitr, separator_char_); + } + //! Set the date ordering + virtual ymd_order_spec do_date_order() const + { + return order_spec_; + } + //! Set the date ordering + virtual month_format_spec do_month_format() const + { + return month_format_spec_; + } + + private: + const charT* const* month_short_names_; + const charT* const* month_long_names_; + const charT* const* special_value_names_; + const charT* const* weekday_short_names_; + const charT* const* weekday_long_names_; + charT separator_char_[2]; + ymd_order_spec order_spec_; + month_format_spec month_format_spec_; + }; + +} } //namespace boost::date_time + +#endif //BOOST_NO_STD_LOCALE + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_parsing.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_parsing.hpp new file mode 100644 index 0000000000..ae09158967 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/date_parsing.hpp @@ -0,0 +1,299 @@ +#ifndef _DATE_TIME_DATE_PARSING_HPP___ +#define _DATE_TIME_DATE_PARSING_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/tokenizer.hpp" +#include "boost/lexical_cast.hpp" +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/parse_format_base.hpp" +#include +#include +#include + +#if defined(BOOST_NO_STD_LOCALE) +#include // ::tolower(int) +#else +#include // std::tolower(char, locale) +#endif + +namespace boost { +namespace date_time { + + //! A function to replace the std::transform( , , ,tolower) construct + /*! This function simply takes a string, and changes all the characters + * in that string to lowercase (according to the default system locale). + * In the event that a compiler does not support locales, the old + * C style tolower() is used. + */ + inline + std::string + convert_to_lower(const std::string& inp) { + std::string tmp; + unsigned i = 0; +#if defined(BOOST_NO_STD_LOCALE) + while(i < inp.length()) { + tmp += static_cast(std::tolower(inp.at(i++))); +#else + static const std::locale loc(std::locale::classic()); + while(i < inp.length()) { + // tolower and others were brought in to std for borland >= v564 + // in compiler_config.hpp + std::string::value_type c(inp.at(i++)); + tmp += std::tolower(c, loc); +#endif + + } + return tmp; + } + + //! Helper function for parse_date. + /* Used by-value parameter because we change the string and may + * want to preserve the original argument */ + template + unsigned short + month_str_to_ushort(std::string s) { + if((s.at(0) >= '0') && (s.at(0) <= '9')) { + return boost::lexical_cast(s); + } + else { + s = convert_to_lower(s); + typename month_type::month_map_ptr_type ptr = month_type::get_month_map_ptr(); + typename month_type::month_map_type::iterator iter = ptr->find(s); + if(iter != ptr->end()) { // required for STLport + return iter->second; + } + } + return 13; // intentionally out of range - name not found + } + + //! Find index of a string in either of 2 arrays + /*! find_match searches both arrays for a match to 's'. Indexing of the + * arrays is from 0 to 'limit'. The index of the match is returned. + * Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2. + * 'limit' can be sent in with: greg_month::max(), + * greg_weekday::max() or date_time::NumSpecialValues */ + template + short find_match(const charT* const* short_names, + const charT* const* long_names, + short limit, + const std::basic_string& s) { + for(short i = 0; i <= limit; ++i){ + if(short_names[i] == s || long_names[i] == s){ + return i; + } + } + return static_cast(limit + 1); // not-found, return a value out of range + } + + //! Generic function to parse a delimited date (eg: 2002-02-10) + /*! Accepted formats are: "2003-02-10" or " 2003-Feb-10" or + * "2003-Feburary-10" + * The order in which the Month, Day, & Year appear in the argument + * string can be accomodated by passing in the appropriate ymd_order_spec + */ + template + date_type + parse_date(const std::string& s, int order_spec = ymd_order_iso) { + std::string spec_str(""); + if(order_spec == ymd_order_iso) { + spec_str = "ymd"; + } + else if(order_spec == ymd_order_dmy) { + spec_str = "dmy"; + } + else { // (order_spec == ymd_order_us) + spec_str = "mdy"; + } + + typedef typename date_type::year_type year_type; + typedef typename date_type::month_type month_type; + unsigned pos = 0; + unsigned short year(0), month(0), day(0); + typedef typename std::basic_string::traits_type traits_type; + typedef boost::char_separator char_separator_type; + typedef boost::tokenizer::const_iterator, + std::basic_string > tokenizer; + typedef boost::tokenizer::const_iterator, + std::basic_string >::iterator tokenizer_iterator; + // may need more delimiters, these work for the regression tests + const char sep_char[] = {',','-','.',' ','/','\0'}; + char_separator_type sep(sep_char); + tokenizer tok(s,sep); + for(tokenizer_iterator beg=tok.begin(); + beg!=tok.end() && pos < spec_str.size(); + ++beg, ++pos) { + switch(spec_str.at(pos)) { + case 'y': + { + year = boost::lexical_cast(*beg); + break; + } + case 'm': + { + month = month_str_to_ushort(*beg); + break; + } + case 'd': + { + day = boost::lexical_cast(*beg); + break; + } + } //switch + } + return date_type(year, month, day); + } + + //! Generic function to parse undelimited date (eg: 20020201) + template + date_type + parse_undelimited_date(const std::string& s) { + int offsets[] = {4,2,2}; + int pos = 0; + typedef typename date_type::year_type year_type; + //typename date_type::ymd_type ymd((year_type::min)(),1,1); + unsigned short y = 0, m = 0, d = 0; + + /* The two bool arguments state that parsing will not wrap + * (only the first 8 characters will be parsed) and partial + * strings will not be parsed. + * Ex: + * "2005121" will parse 2005 & 12, but not the "1" */ + boost::offset_separator osf(offsets, offsets+3, false, false); + + typedef typename boost::tokenizer::const_iterator, + std::basic_string > tokenizer_type; + tokenizer_type tok(s, osf); + for(typename tokenizer_type::iterator ti=tok.begin(); ti!=tok.end();++ti) { + unsigned short i = boost::lexical_cast(*ti); + switch(pos) { + case 0: y = i; break; + case 1: m = i; break; + case 2: d = i; break; + } + pos++; + } + return date_type(y,m,d); + } + + //! Helper function for 'date gregorian::from_stream()' + /*! Creates a string from the iterators that reference the + * begining & end of a char[] or string. All elements are + * used in output string */ + template + inline + date_type + from_stream_type(iterator_type& beg, + iterator_type& end, + char) + { + std::stringstream ss(""); + while(beg != end) { + ss << *beg++; + } + return parse_date(ss.str()); + } + + //! Helper function for 'date gregorian::from_stream()' + /*! Returns the first string found in the stream referenced by the + * begining & end iterators */ + template + inline + date_type + from_stream_type(iterator_type& beg, + iterator_type& end, + std::string) + { + return parse_date(*beg); + } + + /* I believe the wchar stuff would be best elsewhere, perhaps in + * parse_date<>()? In the mean time this gets us started... */ + //! Helper function for 'date gregorian::from_stream()' + /*! Creates a string from the iterators that reference the + * begining & end of a wstring. All elements are + * used in output string */ + template + inline + date_type from_stream_type(iterator_type& beg, + iterator_type& end, + wchar_t) + { + std::stringstream ss(""); + while(beg != end) { +#if !defined(BOOST_DATE_TIME_NO_LOCALE) + ss << std::use_facet >(std::locale()).narrow(*beg++, 'X'); // 'X' will cause exception to be thrown +#else + ss << ss.narrow(*beg++, 'X'); +#endif + } + return parse_date(ss.str()); + } +#ifndef BOOST_NO_STD_WSTRING + //! Helper function for 'date gregorian::from_stream()' + /*! Creates a string from the first wstring found in the stream + * referenced by the begining & end iterators */ + template + inline + date_type + from_stream_type(iterator_type& beg, + iterator_type& end, + std::wstring) { + std::wstring ws = *beg; + std::stringstream ss(""); + std::wstring::iterator wsb = ws.begin(), wse = ws.end(); + while(wsb != wse) { +#if !defined(BOOST_DATE_TIME_NO_LOCALE) + ss << std::use_facet >(std::locale()).narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown +#else + ss << ss.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown +#endif + } + return parse_date(ss.str()); + } +#endif // BOOST_NO_STD_WSTRING +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + // This function cannot be compiled with MSVC 6.0 due to internal compiler shorcomings +#else + //! function called by wrapper functions: date_period_from_(w)string() + template + period + from_simple_string_type(const std::basic_string& s){ + typedef typename std::basic_string::traits_type traits_type; + typedef typename boost::char_separator char_separator; + typedef typename boost::tokenizer::const_iterator, + std::basic_string > tokenizer; + const charT sep_list[4] = {'[','/',']','\0'}; + char_separator sep(sep_list); + tokenizer tokens(s, sep); + typename tokenizer::iterator tok_it = tokens.begin(); + std::basic_string date_string = *tok_it; + // get 2 string iterators and generate a date from them + typename std::basic_string::iterator date_string_start = date_string.begin(), + date_string_end = date_string.end(); + typedef typename std::iterator_traits::iterator>::value_type value_type; + date_type d1 = from_stream_type(date_string_start, date_string_end, value_type()); + date_string = *(++tok_it); // next token + date_string_start = date_string.begin(), date_string_end = date_string.end(); + date_type d2 = from_stream_type(date_string_start, date_string_end, value_type()); + return period(d1, d2); + } +#endif + +} } //namespace date_time + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/dst_rules.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/dst_rules.hpp new file mode 100644 index 0000000000..20cb40b676 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/dst_rules.hpp @@ -0,0 +1,391 @@ +#ifndef DATE_TIME_DST_RULES_HPP__ +#define DATE_TIME_DST_RULES_HPP__ + +/* Copyright (c) 2002,2003, 2007 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file dst_rules.hpp + Contains template class to provide static dst rule calculations +*/ + +#include "boost/date_time/date_generators.hpp" +#include "boost/date_time/period.hpp" +#include "boost/date_time/date_defs.hpp" +#include + +namespace boost { + namespace date_time { + + enum time_is_dst_result {is_not_in_dst, is_in_dst, + ambiguous, invalid_time_label}; + + + //! Dynamic class used to caluclate dst transition information + template + class dst_calculator + { + public: + typedef time_duration_type_ time_duration_type; + typedef date_type_ date_type; + + //! Check the local time offset when on dst start day + /*! On this dst transition, the time label between + * the transition boundary and the boudary + the offset + * are invalid times. If before the boundary then still + * not in dst. + *@param time_of_day Time offset in the day for the local time + *@param dst_start_offset_minutes Local day offset for start of dst + *@param dst_length_minutes Number of minutes to adjust clock forward + *@retval status of time label w.r.t. dst + */ + static time_is_dst_result + process_local_dst_start_day(const time_duration_type& time_of_day, + unsigned int dst_start_offset_minutes, + long dst_length_minutes) + { + //std::cout << "here" << std::endl; + if (time_of_day < time_duration_type(0,dst_start_offset_minutes,0)) { + return is_not_in_dst; + } + long offset = dst_start_offset_minutes + dst_length_minutes; + if (time_of_day >= time_duration_type(0,offset,0)) { + return is_in_dst; + } + return invalid_time_label; + } + + //! Check the local time offset when on the last day of dst + /*! This is the calculation for the DST end day. On that day times + * prior to the conversion time - dst_length (1 am in US) are still + * in dst. Times between the above and the switch time are + * ambiguous. Times after the start_offset are not in dst. + *@param time_of_day Time offset in the day for the local time + *@param dst_end_offset_minutes Local time of day for end of dst + *@retval status of time label w.r.t. dst + */ + static time_is_dst_result + process_local_dst_end_day(const time_duration_type& time_of_day, + unsigned int dst_end_offset_minutes, + long dst_length_minutes) + { + //in US this will be 60 so offset in day is 1,0,0 + int offset = dst_end_offset_minutes-dst_length_minutes; + if (time_of_day < time_duration_type(0,offset,0)) { + return is_in_dst; + } + if (time_of_day >= time_duration_type(0,dst_end_offset_minutes,0)) { + return is_not_in_dst; + } + return ambiguous; + } + + //! Calculates if the given local time is dst or not + /*! Determines if the time is really in DST or not. Also checks for + * invalid and ambiguous. + * @param current_day The day to check for dst + * @param time_of_day Time offset within the day to check + * @param dst_start_day Starting day of dst for the given locality + * @param dst_start_offset Time offset within day for dst boundary + * @param dst_end_day Ending day of dst for the given locality + * @param dst_end_offset Time offset within day given in dst for dst boundary + * @param dst_length lenght of dst adjusment + * @retval The time is either ambiguous, invalid, in dst, or not in dst + */ + static time_is_dst_result + local_is_dst(const date_type& current_day, + const time_duration_type& time_of_day, + const date_type& dst_start_day, + const time_duration_type& dst_start_offset, + const date_type& dst_end_day, + const time_duration_type& dst_end_offset, + const time_duration_type& dst_length_minutes) + { + unsigned int start_minutes = + dst_start_offset.hours() * 60 + dst_start_offset.minutes(); + unsigned int end_minutes = + dst_end_offset.hours() * 60 + dst_end_offset.minutes(); + long length_minutes = + dst_length_minutes.hours() * 60 + dst_length_minutes.minutes(); + + return local_is_dst(current_day, time_of_day, + dst_start_day, start_minutes, + dst_end_day, end_minutes, + length_minutes); + } + + //! Calculates if the given local time is dst or not + /*! Determines if the time is really in DST or not. Also checks for + * invalid and ambiguous. + * @param current_day The day to check for dst + * @param time_of_day Time offset within the day to check + * @param dst_start_day Starting day of dst for the given locality + * @param dst_start_offset_minutes Offset within day for dst + * boundary (eg 120 for US which is 02:00:00) + * @param dst_end_day Ending day of dst for the given locality + * @param dst_end_offset_minutes Offset within day given in dst for dst + * boundary (eg 120 for US which is 02:00:00) + * @param dst_length_minutes Length of dst adjusment (eg: 60 for US) + * @retval The time is either ambiguous, invalid, in dst, or not in dst + */ + static time_is_dst_result + local_is_dst(const date_type& current_day, + const time_duration_type& time_of_day, + const date_type& dst_start_day, + unsigned int dst_start_offset_minutes, + const date_type& dst_end_day, + unsigned int dst_end_offset_minutes, + long dst_length_minutes) + { + //in northern hemisphere dst is in the middle of the year + if (dst_start_day < dst_end_day) { + if ((current_day > dst_start_day) && (current_day < dst_end_day)) { + return is_in_dst; + } + if ((current_day < dst_start_day) || (current_day > dst_end_day)) { + return is_not_in_dst; + } + } + else {//southern hemisphere dst is at begining /end of year + if ((current_day < dst_start_day) && (current_day > dst_end_day)) { + return is_not_in_dst; + } + if ((current_day > dst_start_day) || (current_day < dst_end_day)) { + return is_in_dst; + } + } + + if (current_day == dst_start_day) { + return process_local_dst_start_day(time_of_day, + dst_start_offset_minutes, + dst_length_minutes); + } + + if (current_day == dst_end_day) { + return process_local_dst_end_day(time_of_day, + dst_end_offset_minutes, + dst_length_minutes); + } + //you should never reach this statement + return invalid_time_label; + } + + }; + + + //! Compile-time configurable daylight savings time calculation engine + /* This template provides the ability to configure a daylight savings + * calculation at compile time covering all the cases. Unfortunately + * because of the number of dimensions related to daylight savings + * calculation the number of parameters is high. In addition, the + * start and end transition rules are complex types that specify + * an algorithm for calculation of the starting day and ending + * day of daylight savings time including the month and day + * specifications (eg: last sunday in October). + * + * @param date_type A type that represents dates, typically gregorian::date + * @param time_duration_type Used for the offset in the day calculations + * @param dst_traits A set of traits that define the rules of dst + * calculation. The dst_trait must include the following: + * start_rule_functor - Rule to calculate the starting date of a + * dst transition (eg: last_kday_of_month). + * start_day - static function that returns month of dst start for + * start_rule_functor + * start_month -static function that returns day or day of week for + * dst start of dst + * end_rule_functor - Rule to calculate the end of dst day. + * end_day - static fucntion that returns end day for end_rule_functor + * end_month - static function that returns end month for end_rule_functor + * dst_start_offset_minutes - number of minutes from start of day to transition to dst -- 120 (or 2:00 am) is typical for the U.S. and E.U. + * dst_start_offset_minutes - number of minutes from start of day to transition off of dst -- 180 (or 3:00 am) is typical for E.U. + * dst_length_minutes - number of minutes that dst shifts clock + */ + template + class dst_calc_engine + { + public: + typedef typename date_type::year_type year_type; + typedef typename date_type::calendar_type calendar_type; + typedef dst_calculator dstcalc; + + //! Calculates if the given local time is dst or not + /*! Determines if the time is really in DST or not. Also checks for + * invalid and ambiguous. + * @retval The time is either ambiguous, invalid, in dst, or not in dst + */ + static time_is_dst_result local_is_dst(const date_type& d, + const time_duration_type& td) + { + + year_type y = d.year(); + date_type dst_start = local_dst_start_day(y); + date_type dst_end = local_dst_end_day(y); + return dstcalc::local_is_dst(d,td, + dst_start, + dst_traits::dst_start_offset_minutes(), + dst_end, + dst_traits::dst_end_offset_minutes(), + dst_traits::dst_shift_length_minutes()); + + } + + static bool is_dst_boundary_day(date_type d) + { + year_type y = d.year(); + return ((d == local_dst_start_day(y)) || + (d == local_dst_end_day(y))); + } + + //! The time of day for the dst transition (eg: typically 01:00:00 or 02:00:00) + static time_duration_type dst_offset() + { + return time_duration_type(0,dst_traits::dst_shift_length_minutes(),0); + } + + static date_type local_dst_start_day(year_type year) + { + return dst_traits::local_dst_start_day(year); + } + + static date_type local_dst_end_day(year_type year) + { + return dst_traits::local_dst_end_day(year); + } + + + }; + + //! Depricated: Class to calculate dst boundaries for US time zones + /* Use dst_calc_engine instead. + * In 2007 US/Canada DST rules changed + * (http://en.wikipedia.org/wiki/Energy_Policy_Act_of_2005#Change_to_daylight_saving_time). + */ + template //1 hour == 60 min in US + class us_dst_rules + { + public: + typedef time_duration_type_ time_duration_type; + typedef date_type_ date_type; + typedef typename date_type::year_type year_type; + typedef typename date_type::calendar_type calendar_type; + typedef date_time::last_kday_of_month lkday; + typedef date_time::first_kday_of_month fkday; + typedef date_time::nth_kday_of_month nkday; + typedef dst_calculator dstcalc; + + //! Calculates if the given local time is dst or not + /*! Determines if the time is really in DST or not. Also checks for + * invalid and ambiguous. + * @retval The time is either ambiguous, invalid, in dst, or not in dst + */ + static time_is_dst_result local_is_dst(const date_type& d, + const time_duration_type& td) + { + + year_type y = d.year(); + date_type dst_start = local_dst_start_day(y); + date_type dst_end = local_dst_end_day(y); + return dstcalc::local_is_dst(d,td, + dst_start,dst_start_offset_minutes, + dst_end, dst_start_offset_minutes, + dst_length_minutes); + + } + + + static bool is_dst_boundary_day(date_type d) + { + year_type y = d.year(); + return ((d == local_dst_start_day(y)) || + (d == local_dst_end_day(y))); + } + + static date_type local_dst_start_day(year_type year) + { + if (year >= year_type(2007)) { + //second sunday in march + nkday ssim(nkday::second, Sunday, gregorian::Mar); + return ssim.get_date(year); + } else { + //first sunday in april + fkday fsia(Sunday, gregorian::Apr); + return fsia.get_date(year); + } + } + + static date_type local_dst_end_day(year_type year) + { + if (year >= year_type(2007)) { + //first sunday in november + fkday fsin(Sunday, gregorian::Nov); + return fsin.get_date(year); + } else { + //last sunday in october + lkday lsio(Sunday, gregorian::Oct); + return lsio.get_date(year); + } + } + + static time_duration_type dst_offset() + { + return time_duration_type(0,dst_length_minutes,0); + } + + private: + + + }; + + //! Used for local time adjustments in places that don't use dst + template + class null_dst_rules + { + public: + typedef time_duration_type_ time_duration_type; + typedef date_type_ date_type; + + + //! Calculates if the given local time is dst or not + /*! @retval Always is_not_in_dst since this is for zones without dst + */ + static time_is_dst_result local_is_dst(const date_type&, + const time_duration_type&) + { + return is_not_in_dst; + } + + //! Calculates if the given utc time is in dst + static time_is_dst_result utc_is_dst(const date_type&, + const time_duration_type&) + { + return is_not_in_dst; + } + + static bool is_dst_boundary_day(date_type d) + { + return false; + } + + static time_duration_type dst_offset() + { + return time_duration_type(0,0,0); + } + + }; + + + } } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/dst_transition_generators.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/dst_transition_generators.hpp new file mode 100644 index 0000000000..6c4da1c3c9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/dst_transition_generators.hpp @@ -0,0 +1,75 @@ +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + */ +#ifndef DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__ +#define DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__ + + + +namespace boost { +namespace date_time { + + //! Defines base interface for calculating start and end date of daylight savings + template + class dst_day_calc_rule + { + public: + typedef typename date_type::year_type year_type; + virtual ~dst_day_calc_rule() {}; + virtual date_type start_day(year_type y) const=0; + virtual std::string start_rule_as_string() const=0; + virtual date_type end_day(year_type y) const=0; + virtual std::string end_rule_as_string() const=0; + + }; + + //! Canonical form for a class that provides day rule calculation + /*! This class is used to generate specific sets of dst rules + * + *@param spec Provides a specifiction of the function object types used + * to generate start and end days of daylight savings as well + * as the date type. + */ + template + class day_calc_dst_rule : public dst_day_calc_rule + { + public: + typedef typename spec::date_type date_type; + typedef typename date_type::year_type year_type; + typedef typename spec::start_rule start_rule; + typedef typename spec::end_rule end_rule; + day_calc_dst_rule(start_rule dst_start, + end_rule dst_end) : + dst_start_(dst_start), + dst_end_(dst_end) + {} + virtual date_type start_day(year_type y) const + { + return dst_start_.get_date(y); + } + virtual std::string start_rule_as_string() const + { + return dst_start_.to_string(); + } + virtual date_type end_day(year_type y) const + { + return dst_end_.get_date(y); + } + virtual std::string end_rule_as_string() const + { + return dst_end_.to_string(); + } + private: + start_rule dst_start_; + end_rule dst_end_; + }; + + +} }//namespace + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/filetime_functions.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/filetime_functions.hpp new file mode 100644 index 0000000000..415bbff7fe --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/filetime_functions.hpp @@ -0,0 +1,78 @@ +#ifndef DATE_TIME_FILETIME_FUNCTIONS_HPP__ +#define DATE_TIME_FILETIME_FUNCTIONS_HPP__ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file filetime_functions.hpp + * Function(s) for converting between a FILETIME structure and a + * time object. This file is only available on systems that have + * BOOST_HAS_FTIME defined. + */ + +#include +#if defined(BOOST_HAS_FTIME) // skip this file if no FILETIME +#include +#include +#include + + +namespace boost { +namespace date_time { + + + //! Create a time object from an initialized FILETIME struct. + /*! Create a time object from an initialized FILETIME struct. + * A FILETIME struct holds 100-nanosecond units (0.0000001). When + * built with microsecond resolution the FILETIME's sub second value + * will be truncated. Nanosecond resolution has no truncation. */ + template + inline + time_type time_from_ftime(const FILETIME& ft){ + typedef typename time_type::date_type date_type; + typedef typename time_type::date_duration_type date_duration_type; + typedef typename time_type::time_duration_type time_duration_type; + + /* OFFSET is difference between 1970-Jan-01 & 1601-Jan-01 + * in 100-nanosecond intervals */ + uint64_t c1 = 27111902UL; + uint64_t c2 = 3577643008UL; // issues warning without 'UL' + const uint64_t OFFSET = (c1 << 32) + c2; + const long sec_pr_day = 86400; // seconds per day + + uint64_t filetime = ft.dwHighDateTime; + filetime <<= 32; + filetime += ft.dwLowDateTime; + filetime -= OFFSET; // filetime is now 100-nanos since 1970-Jan-01 + + uint64_t sec = filetime / 10000000; +#if defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG) + uint64_t sub_sec = (filetime % 10000000) * 100; // nanoseconds +#else + uint64_t sub_sec = (filetime % 10000000) / 10; // truncate to microseconds +#endif + + // split sec into usable chunks: days, hours, minutes, & seconds + long _d = sec / sec_pr_day; + long tmp = sec % sec_pr_day; + long _h = tmp / 3600; // sec_pr_hour + tmp %= 3600; + long _m = tmp / 60; // sec_pr_min + tmp %= 60; + long _s = tmp; // seconds + + date_duration_type dd(_d); + date_type d = date_type(1970, Jan, 01) + dd; + return time_type(d, time_duration_type(_h, _m, _s, sub_sec)); + } + +}} // boost::date_time + +#endif // BOOST_HAS_FTIME + +#endif // DATE_TIME_FILETIME_FUNCTIONS_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/format_date_parser.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/format_date_parser.hpp new file mode 100644 index 0000000000..63a78396ce --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/format_date_parser.hpp @@ -0,0 +1,731 @@ + +#ifndef DATE_TIME_FORMAT_DATE_PARSER_HPP__ +#define DATE_TIME_FORMAT_DATE_PARSER_HPP__ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/lexical_cast.hpp" +#include "boost/date_time/string_parse_tree.hpp" +#include "boost/date_time/strings_from_facet.hpp" +#include "boost/date_time/special_values_parser.hpp" +#include +#include + +namespace boost { namespace date_time { + +//! Helper function for parsing fixed length strings into integers +/*! Will consume 'length' number of characters from stream. Consumed + * character are transfered to parse_match_result struct. + * Returns '-1' if no number can be parsed or incorrect number of + * digits in stream. */ +template +inline +int_type +fixed_string_to_int(std::istreambuf_iterator& itr, + std::istreambuf_iterator& stream_end, + parse_match_result& mr, + unsigned int length, + const charT& fill_char) +{ + //typedef std::basic_string string_type; + unsigned int j = 0; + //string_type s; + while (j < length && itr != stream_end && + (std::isdigit(*itr) || *itr == fill_char)) { + if(*itr == fill_char) { + /* Since a fill_char can be anything, we convert it to a zero. + * lexical_cast will behave predictably when zero is used as fill. */ + mr.cache += ('0'); + } + else { + mr.cache += (*itr); + } + itr++; + j++; + } + int_type i = -1; + // mr.cache will hold leading zeros. size() tells us when input is too short. + if(mr.cache.size() < length) { + return i; + } + try { + i = boost::lexical_cast(mr.cache); + }catch(bad_lexical_cast blc){ + // we want to return -1 if the cast fails so nothing to do here + } + return i; +} + +//! Helper function for parsing fixed length strings into integers +/*! Will consume 'length' number of characters from stream. Consumed + * character are transfered to parse_match_result struct. + * Returns '-1' if no number can be parsed or incorrect number of + * digits in stream. */ +template +inline +int_type +fixed_string_to_int(std::istreambuf_iterator& itr, + std::istreambuf_iterator& stream_end, + parse_match_result& mr, + unsigned int length) +{ + return fixed_string_to_int(itr, stream_end, mr, length, '0'); +} + +//! Helper function for parsing varied length strings into integers +/*! Will consume 'max_length' characters from stream only if those + * characters are digits. Returns '-1' if no number can be parsed. + * Will not parse a number preceeded by a '+' or '-'. */ +template +inline +int_type +var_string_to_int(std::istreambuf_iterator& itr, + std::istreambuf_iterator& /* stream_end */, + unsigned int max_length) +{ + typedef std::basic_string string_type; + unsigned int j = 0; + string_type s; + while ((j < max_length) && std::isdigit(*itr)) { + s += (*itr); + itr++; + j++; + } + int_type i = -1; + if(s.length() != 0) { + i = boost::lexical_cast(s); + } + return i; +} + + +//! Class with generic date parsing using a format string +/*! The following is the set of recognized format specifiers + - %a - Short weekday name + - %A - Long weekday name + - %b - Abbreviated month name + - %B - Full month name + - %d - Day of the month as decimal 01 to 31 + - %j - Day of year as decimal from 001 to 366 + - %m - Month name as a decimal 01 to 12 + - %U - Week number 00 to 53 with first Sunday as the first day of week 1? + - %w - Weekday as decimal number 0 to 6 where Sunday == 0 + - %W - Week number 00 to 53 where Monday is first day of week 1 + - %x - facet default date representation + - %y - Year without the century - eg: 04 for 2004 + - %Y - Year with century + + The weekday specifiers (%a and %A) do not add to the date construction, + but they provide a way to skip over the weekday names for formats that + provide them. + + todo -- Another interesting feature that this approach could provide is + an option to fill in any missing fields with the current values + from the clock. So if you have %m-%d the parser would detect + the missing year value and fill it in using the clock. + + todo -- What to do with the %x. %x in the classic facet is just bad... + + */ +template +class format_date_parser +{ + public: + typedef std::basic_string string_type; + typedef std::basic_ostringstream stringstream_type; + typedef std::istreambuf_iterator stream_itr_type; + typedef typename string_type::const_iterator const_itr; + typedef typename date_type::year_type year_type; + typedef typename date_type::month_type month_type; + typedef typename date_type::day_type day_type; + typedef typename date_type::duration_type duration_type; + typedef typename date_type::day_of_week_type day_of_week_type; + typedef typename date_type::day_of_year_type day_of_year_type; + typedef string_parse_tree parse_tree_type; + typedef typename parse_tree_type::parse_match_result_type match_results; + typedef std::vector > input_collection_type; + + // TODO sv_parser uses its default constructor - write the others + + format_date_parser(const string_type& format_str, + const input_collection_type& month_short_names, + const input_collection_type& month_long_names, + const input_collection_type& weekday_short_names, + const input_collection_type& weekday_long_names) : + m_format(format_str), + m_month_short_names(month_short_names, 1), + m_month_long_names(month_long_names, 1), + m_weekday_short_names(weekday_short_names), + m_weekday_long_names(weekday_long_names) + {} + + format_date_parser(const string_type& format_str, + const std::locale& locale) : + m_format(format_str), + m_month_short_names(gather_month_strings(locale), 1), + m_month_long_names(gather_month_strings(locale, false), 1), + m_weekday_short_names(gather_weekday_strings(locale)), + m_weekday_long_names(gather_weekday_strings(locale, false)) + {} + + format_date_parser(const format_date_parser& fdp) + { + this->m_format = fdp.m_format; + this->m_month_short_names = fdp.m_month_short_names; + this->m_month_long_names = fdp.m_month_long_names; + this->m_weekday_short_names = fdp.m_weekday_short_names; + this->m_weekday_long_names = fdp.m_weekday_long_names; + } + + string_type format() const + { + return m_format; + } + + void format(string_type format_str) + { + m_format = format_str; + } + + void short_month_names(const input_collection_type& month_names) + { + m_month_short_names = parse_tree_type(month_names, 1); + } + void long_month_names(const input_collection_type& month_names) + { + m_month_long_names = parse_tree_type(month_names, 1); + } + void short_weekday_names(const input_collection_type& weekday_names) + { + m_weekday_short_names = parse_tree_type(weekday_names); + } + void long_weekday_names(const input_collection_type& weekday_names) + { + m_weekday_long_names = parse_tree_type(weekday_names); + } + + date_type + parse_date(const string_type& value, + const string_type& format_str, + const special_values_parser& sv_parser) const + { + stringstream_type ss; + ss << value; + stream_itr_type sitr(ss); + stream_itr_type stream_end; + return parse_date(sitr, stream_end, format_str, sv_parser); + } + + date_type + parse_date(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + const special_values_parser& sv_parser) const + { + return parse_date(sitr, stream_end, m_format, sv_parser); + } + + /*! Of all the objects that the format_date_parser can parse, only a + * date can be a special value. Therefore, only parse_date checks + * for special_values. */ + date_type + parse_date(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + string_type format_str, + const special_values_parser& sv_parser) const + { + bool use_current_char = false; + + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + charT current_char = *sitr; + + short year(0), month(0), day(0), day_of_year(0);// wkday(0); + /* Initialized the following to their minimum values. These intermediate + * objects are used so we get specific exceptions when part of the input + * is unparsable. + * Ex: "205-Jan-15" will throw a bad_year, "2005-Jsn-15"- bad_month, etc.*/ + year_type t_year(1400); + month_type t_month(1); + day_type t_day(1); + day_of_week_type wkday(0); + + + const_itr itr(format_str.begin()); + while (itr != format_str.end() && (sitr != stream_end)) { + if (*itr == '%') { + itr++; + if (*itr != '%') { + switch(*itr) { + case 'a': + { + //this value is just throw away. It could be used for + //error checking potentially, but it isn't helpful in + //actually constructing the date - we just need to get it + //out of the stream + match_results mr = m_weekday_short_names.match(sitr, stream_end); + if(mr.current_match == match_results::PARSE_ERROR) { + // check special_values + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + wkday = mr.current_match; + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'A': + { + //this value is just throw away. It could be used for + //error checking potentially, but it isn't helpful in + //actually constructing the date - we just need to get it + //out of the stream + match_results mr = m_weekday_long_names.match(sitr, stream_end); + if(mr.current_match == match_results::PARSE_ERROR) { + // check special_values + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + wkday = mr.current_match; + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'b': + { + match_results mr = m_month_short_names.match(sitr, stream_end); + if(mr.current_match == match_results::PARSE_ERROR) { + // check special_values + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + t_month = month_type(mr.current_match); + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'B': + { + match_results mr = m_month_long_names.match(sitr, stream_end); + if(mr.current_match == match_results::PARSE_ERROR) { + // check special_values + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + t_month = month_type(mr.current_match); + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'd': + { + match_results mr; + day = fixed_string_to_int(sitr, stream_end, mr, 2); + if(day == -1) { + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + t_day = day_type(day); + break; + } + case 'e': + { + match_results mr; + day = fixed_string_to_int(sitr, stream_end, mr, 2, ' '); + if(day == -1) { + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + t_day = day_type(day); + break; + } + case 'j': + { + match_results mr; + day_of_year = fixed_string_to_int(sitr, stream_end, mr, 3); + if(day_of_year == -1) { + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + // these next two lines are so we get an exception with bad input + day_of_year_type t_day_of_year(1); + t_day_of_year = day_of_year_type(day_of_year); + break; + } + case 'm': + { + match_results mr; + month = fixed_string_to_int(sitr, stream_end, mr, 2); + if(month == -1) { + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + t_month = month_type(month); + break; + } + case 'Y': + { + match_results mr; + year = fixed_string_to_int(sitr, stream_end, mr, 4); + if(year == -1) { + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + t_year = year_type(year); + break; + } + case 'y': + { + match_results mr; + year = fixed_string_to_int(sitr, stream_end, mr, 2); + if(year == -1) { + if(sv_parser.match(sitr, stream_end, mr)) { + return date_type(static_cast(mr.current_match)); + } + } + year += 2000; //make 2 digit years in this century + t_year = year_type(year); + break; + } + default: + {} //ignore those we don't understand + + }//switch + + } + else { // itr == '%', second consecutive + sitr++; + } + + itr++; //advance past format specifier + } + else { //skip past chars in format and in buffer + itr++; + if (use_current_char) { + use_current_char = false; + current_char = *sitr; + } + else { + sitr++; + } + } + } + + if (day_of_year > 0) { + date_type d(static_cast(year-1),12,31); //end of prior year + return d + duration_type(day_of_year); + } + + return date_type(t_year, t_month, t_day); // exceptions were thrown earlier + // if input was no good + } + + //! Throws bad_month if unable to parse + month_type + parse_month(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + string_type format_str) const + { + match_results mr; + return parse_month(sitr, stream_end, format_str, mr); + } + + //! Throws bad_month if unable to parse + month_type + parse_month(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + string_type format_str, + match_results& mr) const + { + bool use_current_char = false; + + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + charT current_char = *sitr; + + short month(0); + + const_itr itr(format_str.begin()); + while (itr != format_str.end() && (sitr != stream_end)) { + if (*itr == '%') { + itr++; + if (*itr != '%') { + switch(*itr) { + case 'b': + { + mr = m_month_short_names.match(sitr, stream_end); + month = mr.current_match; + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'B': + { + mr = m_month_long_names.match(sitr, stream_end); + month = mr.current_match; + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'm': + { + month = var_string_to_int(sitr, stream_end, 2); + // var_string_to_int returns -1 if parse failed. That will + // cause a bad_month exception to be thrown so we do nothing here + break; + } + default: + {} //ignore those we don't understand + + }//switch + + } + else { // itr == '%', second consecutive + sitr++; + } + + itr++; //advance past format specifier + } + else { //skip past chars in format and in buffer + itr++; + if (use_current_char) { + use_current_char = false; + current_char = *sitr; + } + else { + sitr++; + } + } + } + + return month_type(month); // throws bad_month exception when values are zero + } + + //! Expects 1 or 2 digits 1-31. Throws bad_day_of_month if unable to parse + day_type + parse_var_day_of_month(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + return day_type(var_string_to_int(sitr, stream_end, 2)); + } + //! Expects 2 digits 01-31. Throws bad_day_of_month if unable to parse + day_type + parse_day_of_month(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + //return day_type(var_string_to_int(sitr, stream_end, 2)); + match_results mr; + return day_type(fixed_string_to_int(sitr, stream_end, mr, 2)); + } + + day_of_week_type + parse_weekday(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + string_type format_str) const + { + match_results mr; + return parse_weekday(sitr, stream_end, format_str, mr); + } + day_of_week_type + parse_weekday(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + string_type format_str, + match_results& mr) const + { + bool use_current_char = false; + + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + charT current_char = *sitr; + + short wkday(0); + + const_itr itr(format_str.begin()); + while (itr != format_str.end() && (sitr != stream_end)) { + if (*itr == '%') { + itr++; + if (*itr != '%') { + switch(*itr) { + case 'a': + { + //this value is just throw away. It could be used for + //error checking potentially, but it isn't helpful in + //actually constructing the date - we just need to get it + //out of the stream + mr = m_weekday_short_names.match(sitr, stream_end); + wkday = mr.current_match; + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'A': + { + //this value is just throw away. It could be used for + //error checking potentially, but it isn't helpful in + //actually constructing the date - we just need to get it + //out of the stream + mr = m_weekday_long_names.match(sitr, stream_end); + wkday = mr.current_match; + if (mr.has_remaining()) { + current_char = mr.last_char(); + use_current_char = true; + } + break; + } + case 'w': + { + // weekday as number 0-6, Sunday == 0 + wkday = var_string_to_int(sitr, stream_end, 2); + break; + } + default: + {} //ignore those we don't understand + + }//switch + + } + else { // itr == '%', second consecutive + sitr++; + } + + itr++; //advance past format specifier + } + else { //skip past chars in format and in buffer + itr++; + if (use_current_char) { + use_current_char = false; + current_char = *sitr; + } + else { + sitr++; + } + } + } + + return day_of_week_type(wkday); // throws bad_day_of_month exception + // when values are zero + } + + //! throws bad_year if unable to parse + year_type + parse_year(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + string_type format_str) const + { + match_results mr; + return parse_year(sitr, stream_end, format_str, mr); + } + + //! throws bad_year if unable to parse + year_type + parse_year(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + string_type format_str, + match_results& mr) const + { + bool use_current_char = false; + + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + charT current_char = *sitr; + + unsigned short year(0); + + const_itr itr(format_str.begin()); + while (itr != format_str.end() && (sitr != stream_end)) { + if (*itr == '%') { + itr++; + if (*itr != '%') { + //match_results mr; + switch(*itr) { + case 'Y': + { + // year from 4 digit string + year = fixed_string_to_int(sitr, stream_end, mr, 4); + break; + } + case 'y': + { + // year from 2 digit string (no century) + year = fixed_string_to_int(sitr, stream_end, mr, 2); + year += 2000; //make 2 digit years in this century + break; + } + default: + {} //ignore those we don't understand + + }//switch + + } + else { // itr == '%', second consecutive + sitr++; + } + + itr++; //advance past format specifier + } + else { //skip past chars in format and in buffer + itr++; + if (use_current_char) { + use_current_char = false; + current_char = *sitr; + } + else { + sitr++; + } + } + } + + return year_type(year); // throws bad_year exception when values are zero + } + + + private: + string_type m_format; + parse_tree_type m_month_short_names; + parse_tree_type m_month_long_names; + parse_tree_type m_weekday_short_names; + parse_tree_type m_weekday_long_names; + +}; + +} } //namespace + +#endif + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/conversion.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/conversion.hpp new file mode 100644 index 0000000000..2155d30c55 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/conversion.hpp @@ -0,0 +1,73 @@ +#ifndef _GREGORIAN__CONVERSION_HPP___ +#define _GREGORIAN__CONVERSION_HPP___ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/c_time.hpp" +#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) +# if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS) +# include "boost/date_time/gregorian/formatters_limited.hpp" +# else +# include "boost/date_time/gregorian/formatters.hpp" +# endif // BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS +#else +# include +# include "boost/date_time/gregorian/gregorian_io.hpp" +#endif // USE_DATE_TIME_PRE_1_33_FACET_IO + +namespace boost { + +namespace gregorian { + + + //! Converts a date to a tm struct. Throws out_of_range exception if date is a special value + inline + std::tm to_tm(const date& d) + { + if(d.is_pos_infinity() || d.is_neg_infinity() || d.is_not_a_date()){ +#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) + std::string s("tm unable to handle date value of " + to_simple_string(d)); + throw std::out_of_range(s); +#else + std::stringstream ss; + ss << "tm unable to handle date value of " << d; + throw std::out_of_range(ss.str()); +#endif // USE_DATE_TIME_PRE_1_33_FACET_IO + } + std::tm datetm; + boost::gregorian::date::ymd_type ymd = d.year_month_day(); + datetm.tm_year = ymd.year-1900; + datetm.tm_mon = ymd.month-1; + datetm.tm_mday = ymd.day; + datetm.tm_wday = d.day_of_week(); + datetm.tm_yday = d.day_of_year()-1; + datetm.tm_hour = datetm.tm_min = datetm.tm_sec = 0; + datetm.tm_isdst = -1; // negative because not enough info to set tm_isdst + return datetm; + } + + //! Converts a tm structure into a date dropping the any time values. + inline + date date_from_tm(const std::tm& datetm) + { + return date(static_cast(datetm.tm_year+1900), + static_cast(datetm.tm_mon+1), + static_cast(datetm.tm_mday)); + } + + +} } //namespace boost::gregorian + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/formatters.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/formatters.hpp new file mode 100644 index 0000000000..786e79f2c1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/formatters.hpp @@ -0,0 +1,162 @@ +#ifndef GREGORIAN_FORMATTERS_HPP___ +#define GREGORIAN_FORMATTERS_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/gregorian/gregorian_types.hpp" +#if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS) +#include "boost/date_time/date_formatting_limited.hpp" +#else +#include "boost/date_time/date_formatting.hpp" +#endif +#include "boost/date_time/iso_format.hpp" +#include "boost/date_time/date_format_simple.hpp" + +/* NOTE: "to_*_string" code for older compilers, ones that define + * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in + * formatters_limited.hpp + */ + +namespace boost { +namespace gregorian { + + // wrapper function for to_simple_(w)string(date) + template + inline + std::basic_string to_simple_string_type(const date& d) { + return date_time::date_formatter,charT>::date_to_string(d); + } + //! To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01 + /*!\ingroup date_format + */ + inline std::string to_simple_string(const date& d) { + return to_simple_string_type(d); + } + + + // wrapper function for to_simple_(w)string(date_period) + template + inline std::basic_string to_simple_string_type(const date_period& d) { + typedef std::basic_string string_type; + charT b = '[', m = '/', e=']'; + + string_type d1(date_time::date_formatter,charT>::date_to_string(d.begin())); + string_type d2(date_time::date_formatter,charT>::date_to_string(d.last())); + return string_type(b + d1 + m + d2 + e); + } + //! Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02] + /*!\ingroup date_format + */ + inline std::string to_simple_string(const date_period& d) { + return to_simple_string_type(d); + } + + // wrapper function for to_iso_(w)string(date_period) + template + inline std::basic_string to_iso_string_type(const date_period& d) { + charT sep = '/'; + std::basic_string s(date_time::date_formatter,charT>::date_to_string(d.begin())); + return s + sep + date_time::date_formatter,charT>::date_to_string(d.last()); + } + //! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231 + /*!\ingroup date_format + */ + inline std::string to_iso_string(const date_period& d) { + return to_iso_string_type(d); + } + + + // wrapper function for to_iso_extended_(w)string(date) + template + inline std::basic_string to_iso_extended_string_type(const date& d) { + return date_time::date_formatter,charT>::date_to_string(d); + } + //! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31 + /*!\ingroup date_format + */ + inline std::string to_iso_extended_string(const date& d) { + return to_iso_extended_string_type(d); + } + + // wrapper function for to_iso_(w)string(date) + template + inline std::basic_string to_iso_string_type(const date& d) { + return date_time::date_formatter,charT>::date_to_string(d); + } + //! Convert to iso standard string YYYYMMDD. Example: 20021231 + /*!\ingroup date_format + */ + inline std::string to_iso_string(const date& d) { + return to_iso_string_type(d); + } + + + + + // wrapper function for to_sql_(w)string(date) + template + inline std::basic_string to_sql_string_type(const date& d) + { + date::ymd_type ymd = d.year_month_day(); + std::basic_ostringstream ss; + ss << ymd.year << "-" + << std::setw(2) << std::setfill(ss.widen('0')) + << ymd.month.as_number() //solves problem with gcc 3.1 hanging + << "-" + << std::setw(2) << std::setfill(ss.widen('0')) + << ymd.day; + return ss.str(); + } + inline std::string to_sql_string(const date& d) { + return to_sql_string_type(d); + } + + +#if !defined(BOOST_NO_STD_WSTRING) + //! Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02] + /*!\ingroup date_format + */ + inline std::wstring to_simple_wstring(const date_period& d) { + return to_simple_string_type(d); + } + //! To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01 + /*!\ingroup date_format + */ + inline std::wstring to_simple_wstring(const date& d) { + return to_simple_string_type(d); + } + //! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231 + /*!\ingroup date_format + */ + inline std::wstring to_iso_wstring(const date_period& d) { + return to_iso_string_type(d); + } + //! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31 + /*!\ingroup date_format + */ + inline std::wstring to_iso_extended_wstring(const date& d) { + return to_iso_extended_string_type(d); + } + //! Convert to iso standard string YYYYMMDD. Example: 20021231 + /*!\ingroup date_format + */ + inline std::wstring to_iso_wstring(const date& d) { + return to_iso_string_type(d); + } + inline std::wstring to_sql_wstring(const date& d) { + return to_sql_string_type(d); + } +#endif // BOOST_NO_STD_WSTRING + +} } //namespace gregorian + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/formatters_limited.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/formatters_limited.hpp new file mode 100644 index 0000000000..4531ebec13 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/formatters_limited.hpp @@ -0,0 +1,81 @@ +#ifndef GREGORIAN_FORMATTERS_LIMITED_HPP___ +#define GREGORIAN_FORMATTERS_LIMITED_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/date_formatting_limited.hpp" +#include "boost/date_time/iso_format.hpp" +#include "boost/date_time/date_format_simple.hpp" +#include "boost/date_time/compiler_config.hpp" + +namespace boost { +namespace gregorian { + + //! To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01 + /*!\ingroup date_format + */ + inline std::string to_simple_string(const date& d) { + return date_time::date_formatter >::date_to_string(d); + } + + //! Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02] + /*!\ingroup date_format + */ + inline std::string to_simple_string(const date_period& d) { + std::string s("["); + std::string d1(date_time::date_formatter >::date_to_string(d.begin())); + std::string d2(date_time::date_formatter >::date_to_string(d.last())); + return std::string("[" + d1 + "/" + d2 + "]"); + } + + //! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231 + /*!\ingroup date_format + */ + inline std::string to_iso_string(const date_period& d) { + std::string s(date_time::date_formatter >::date_to_string(d.begin())); + return s + "/" + date_time::date_formatter >::date_to_string(d.last()); + } + + + //! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31 + /*!\ingroup date_format + */ + inline std::string to_iso_extended_string(const date& d) { + return date_time::date_formatter >::date_to_string(d); + } + + //! Convert to iso standard string YYYYMMDD. Example: 20021231 + /*!\ingroup date_format + */ + inline std::string to_iso_string(const date& d) { + return date_time::date_formatter >::date_to_string(d); + } + + + + inline std::string to_sql_string(const date& d) + { + date::ymd_type ymd = d.year_month_day(); + std::ostringstream ss; + ss << ymd.year << "-" + << std::setw(2) << std::setfill('0') + << ymd.month.as_number() //solves problem with gcc 3.1 hanging + << "-" + << std::setw(2) << std::setfill('0') + << ymd.day; + return ss.str(); + } + + +} } //namespace gregorian + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_calendar.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_calendar.hpp new file mode 100644 index 0000000000..b8b1f5a69d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_calendar.hpp @@ -0,0 +1,47 @@ +#ifndef GREGORIAN_GREGORIAN_CALENDAR_HPP__ +#define GREGORIAN_GREGORIAN_CALENDAR_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/greg_weekday.hpp" +#include "boost/date_time/gregorian/greg_day_of_year.hpp" +#include "boost/date_time/gregorian_calendar.hpp" +#include "boost/date_time/gregorian/greg_ymd.hpp" +#include "boost/date_time/int_adapter.hpp" + +namespace boost { +namespace gregorian { + + //!An internal date representation that includes infinities, not a date + typedef date_time::int_adapter fancy_date_rep; + + //! Gregorian calendar for this implementation, hard work in the base + class gregorian_calendar : + public date_time::gregorian_calendar_base { + public: + //! Type to hold a weekday (eg: Sunday, Monday,...) + typedef greg_weekday day_of_week_type; + //! Counter type from 1 to 366 for gregorian dates. + typedef greg_day_of_year_rep day_of_year_type; + //! Internal date representation that handles infinity, not a date + typedef fancy_date_rep date_rep_type; + //! Date rep implements the traits stuff as well + typedef fancy_date_rep date_traits_type; + + + private: + }; + +} } //namespace gregorian + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_date.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_date.hpp new file mode 100644 index 0000000000..2d34b2a0e0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_date.hpp @@ -0,0 +1,135 @@ +#ifndef GREG_DATE_HPP___ +#define GREG_DATE_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/date.hpp" +#include "boost/date_time/special_defs.hpp" +#include "boost/date_time/gregorian/greg_calendar.hpp" +#include "boost/date_time/gregorian/greg_duration.hpp" + +namespace boost { +namespace gregorian { + + //bring special enum values into the namespace + using date_time::special_values; + using date_time::not_special; + using date_time::neg_infin; + using date_time::pos_infin; + using date_time::not_a_date_time; + using date_time::max_date_time; + using date_time::min_date_time; + + //! A date type based on gregorian_calendar + /*! This class is the primary interface for programming with + greogorian dates. The is a lightweight type that can be + freely passed by value. All comparison operators are + supported. + \ingroup date_basics + */ + class date : public date_time::date + { + public: + typedef gregorian_calendar::year_type year_type; + typedef gregorian_calendar::month_type month_type; + typedef gregorian_calendar::day_type day_type; + typedef gregorian_calendar::day_of_year_type day_of_year_type; + typedef gregorian_calendar::ymd_type ymd_type; + typedef gregorian_calendar::date_rep_type date_rep_type; + typedef gregorian_calendar::date_int_type date_int_type; + typedef date_duration duration_type; +#if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR) + //! Default constructor constructs with not_a_date_time + date(): + date_time::date(date_rep_type::from_special(not_a_date_time)) + {} +#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR + //! Main constructor with year, month, day + date(year_type y, month_type m, day_type d) + : date_time::date(y, m, d) + { + if (gregorian_calendar::end_of_month_day(y, m) < d) { + throw bad_day_of_month(std::string("Day of month is not valid for year")); + } + } + //! Constructor from a ymd_type structure + explicit date(const ymd_type& ymd) + : date_time::date(ymd) + {} + //! Needed copy constructor + explicit date(const date_int_type& rhs): + date_time::date(rhs) + {} + //! Needed copy constructor + explicit date(date_rep_type rhs): + date_time::date(rhs) + {} + //! Constructor for infinities, not a date, max and min date + explicit date(special_values sv): + date_time::date(date_rep_type::from_special(sv)) + { + if (sv == min_date_time) + { + *this = date(1400, 1, 1); + } + if (sv == max_date_time) + { + *this = date(9999, 12, 31); + } + + } + //!Return the Julian Day number for the date. + date_int_type julian_day() const + { + ymd_type ymd = year_month_day(); + return gregorian_calendar::julian_day_number(ymd); + } + //!Return the day of year 1..365 or 1..366 (for leap year) + day_of_year_type day_of_year() const + { + date start_of_year(year(), 1, 1); + unsigned short doy = static_cast((*this-start_of_year).days() + 1); + return day_of_year_type(doy); + } + //!Return the Modified Julian Day number for the date. + long modjulian_day() const + { + ymd_type ymd = year_month_day(); + return gregorian_calendar::modjulian_day_number(ymd); + } + //!Return the iso 8601 week number 1..53 + int week_number() const + { + ymd_type ymd = year_month_day(); + return gregorian_calendar::week_number(ymd); + } + //! Return the day number from the calendar + date_int_type day_number() const + { + return days_; + } + //! Return the last day of the current month + date end_of_month() const + { + ymd_type ymd = year_month_day(); + short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month); + return date(ymd.year, ymd.month, eom_day); + } + + private: + + }; + + + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_day.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_day.hpp new file mode 100644 index 0000000000..92ea6ab07e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_day.hpp @@ -0,0 +1,57 @@ +#ifndef GREG_DAY_HPP___ +#define GREG_DAY_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/constrained_value.hpp" +#include +#include + +namespace boost { +namespace gregorian { + + //! Exception type for gregorian day of month (1..31) + struct bad_day_of_month : public std::out_of_range + { + bad_day_of_month() : + std::out_of_range(std::string("Day of month value is out of range 1..31")) + {} + //! Allow other classes to throw with unique string for bad day like Feb 29 + bad_day_of_month(const std::string& s) : + std::out_of_range(s) + {} + }; + //! Policy class that declares error handling and day of month ranges + typedef CV::simple_exception_policy greg_day_policies; + + //! Generated represetation for gregorian day of month + typedef CV::constrained_value greg_day_rep; + + //! Represent a day of the month (range 1 - 31) + /*! This small class allows for simple conversion an integer value into + a day of the month for a standard gregorian calendar. The type + is automatically range checked so values outside of the range 1-31 + will cause a bad_day_of_month exception + */ + class greg_day : public greg_day_rep { + public: + greg_day(unsigned short day_of_month) : greg_day_rep(day_of_month) {} + unsigned short as_number() const {return value_;} + operator unsigned short() const {return value_;} + private: + + }; + + + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_day_of_year.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_day_of_year.hpp new file mode 100644 index 0000000000..36b22c2b75 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_day_of_year.hpp @@ -0,0 +1,38 @@ +#ifndef GREG_DAY_OF_YEAR_HPP___ +#define GREG_DAY_OF_YEAR_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/constrained_value.hpp" +#include +#include + +namespace boost { +namespace gregorian { + + //! Exception type for day of year (1..366) + struct bad_day_of_year : public std::out_of_range + { + bad_day_of_year() : + std::out_of_range(std::string("Day of year value is out of range 1..366")) + {} + }; + + //! A day of the year range (1..366) + typedef CV::simple_exception_policy greg_day_of_year_policies; + + //! Define a range representation type for the day of the year 1..366 + typedef CV::constrained_value greg_day_of_year_rep; + + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_duration.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_duration.hpp new file mode 100644 index 0000000000..90266456f8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_duration.hpp @@ -0,0 +1,38 @@ +#ifndef GREG_DURATION_HPP___ +#define GREG_DURATION_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/date_duration.hpp" +#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES) +#include "boost/date_time/date_duration_types.hpp" +#endif +#include "boost/date_time/int_adapter.hpp" + + +namespace boost { +namespace gregorian { + + + //!An internal date representation that includes infinities, not a date + typedef boost::date_time::duration_traits_adapted date_duration_rep; + + //! Durations in days for gregorian system + /*! \ingroup date_basics + */ + typedef date_time::date_duration date_duration; + + //! Shorthand for date_duration + typedef date_duration days; + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_duration_types.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_duration_types.hpp new file mode 100644 index 0000000000..9e85ae768f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_duration_types.hpp @@ -0,0 +1,34 @@ +#ifndef GREG_DURATION_TYPES_HPP___ +#define GREG_DURATION_TYPES_HPP___ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Subject to Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/gregorian/greg_date.hpp" +#include "boost/date_time/int_adapter.hpp" +#include "boost/date_time/adjust_functors.hpp" +#include "boost/date_time/date_duration.hpp" +#include "boost/date_time/date_duration_types.hpp" + +namespace boost { +namespace gregorian { + + //! config struct for additional duration types (ie months_duration<> & years_duration<>) + struct greg_durations_config { + typedef date date_type; + typedef date_time::int_adapter int_rep; + typedef date_time::month_functor month_adjustor_type; + }; + + typedef date_time::months_duration months; + typedef date_time::years_duration years; + typedef date_time::weeks_duration weeks; + +}} // namespace boost::gregorian + +#endif // GREG_DURATION_TYPES_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_facet.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_facet.hpp new file mode 100644 index 0000000000..876c980471 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_facet.hpp @@ -0,0 +1,351 @@ +#ifndef GREGORIAN_FACET_HPP___ +#define GREGORIAN_FACET_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/date_formatting_locales.hpp" // sets BOOST_DATE_TIME_NO_LOCALE +#include "boost/date_time/gregorian/parsers.hpp" +#include +#include + +//This file is basically commented out if locales are not supported +#ifndef BOOST_DATE_TIME_NO_LOCALE + + +namespace boost { +namespace gregorian { + + //! Configuration of the output facet template + struct greg_facet_config + { + typedef boost::gregorian::greg_month month_type; + typedef boost::date_time::special_values special_value_enum; + typedef boost::gregorian::months_of_year month_enum; + typedef boost::date_time::weekdays weekday_enum; + }; + +#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) + //! Create the base facet type for gregorian::date + typedef boost::date_time::date_names_put greg_base_facet; + + //! ostream operator for gregorian::date + /*! Uses the date facet to determine various output parameters including: + * - string values for the month (eg: Jan, Feb, Mar) (default: English) + * - string values for special values (eg: not-a-date-time) (default: English) + * - selection of long, short strings, or numerical month representation (default: short string) + * - month day year order (default yyyy-mmm-dd) + */ + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const date& d) + { + typedef boost::date_time::date_names_put facet_def; + typedef boost::date_time::ostream_date_formatter greg_ostream_formatter; + greg_ostream_formatter::date_put(d, os); + return os; + } + + //! operator<< for gregorian::greg_month typically streaming: Jan, Feb, Mar... + /*! Uses the date facet to determine output string as well as selection of long or short strings. + * Default if no facet is installed is to output a 2 wide numeric value for the month + * eg: 01 == Jan, 02 == Feb, ... 12 == Dec. + */ + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const greg_month& m) + { + typedef boost::date_time::date_names_put facet_def; + typedef boost::date_time::ostream_month_formatter greg_month_formatter; + std::locale locale = os.getloc(); + if (std::has_facet(locale)) { + const facet_def& f = std::use_facet(locale); + greg_month_formatter::format_month(m, os, f); + + } + else { //default to numeric + charT fill_char = '0'; + os << std::setw(2) << std::setfill(fill_char) << m.as_number(); + } + + return os; + } + + //! operator<< for gregorian::greg_weekday typically streaming: Sun, Mon, Tue, ... + /*! Uses the date facet to determine output string as well as selection of long or short string. + * Default if no facet is installed is to output a 3 char english string for the + * day of the week. + */ + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const greg_weekday& wd) + { + typedef boost::date_time::date_names_put facet_def; + typedef boost::date_time::ostream_weekday_formatter greg_weekday_formatter; + std::locale locale = os.getloc(); + if (std::has_facet(locale)) { + const facet_def& f = std::use_facet(locale); + greg_weekday_formatter::format_weekday(wd.as_enum(), os, f, true); + } + else { //default to short English string eg: Sun, Mon, Tue, Wed... + os << wd.as_short_string(); + } + + return os; + } + + //! operator<< for gregorian::date_period typical output: [2002-Jan-01/2002-Jan-31] + /*! Uses the date facet to determine output string as well as selection of long + * or short string fr dates. + * Default if no facet is installed is to output a 3 char english string for the + * day of the week. + */ + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const date_period& dp) + { + os << '['; //TODO: facet or manipulator for periods? + os << dp.begin(); + os << '/'; //TODO: facet or manipulator for periods? + os << dp.last(); + os << ']'; + return os; + } + + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const date_duration& dd) + { + //os << dd.days(); + os << dd.get_rep(); + return os; + } + + //! operator<< for gregorian::partial_date. Output: "Jan 1" + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const partial_date& pd) + { + os << std::setw(2) << std::setfill('0') << pd.day() << ' ' + << pd.month().as_short_string() ; + return os; + } + + //! operator<< for gregorian::nth_kday_of_month. Output: "first Mon of Jun" + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const nth_kday_of_month& nkd) + { + os << nkd.nth_week_as_str() << ' ' + << nkd.day_of_week() << " of " + << nkd.month().as_short_string() ; + return os; + } + + //! operator<< for gregorian::first_kday_of_month. Output: "first Mon of Jun" + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const first_kday_of_month& fkd) + { + os << "first " << fkd.day_of_week() << " of " + << fkd.month().as_short_string() ; + return os; + } + + //! operator<< for gregorian::last_kday_of_month. Output: "last Mon of Jun" + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const last_kday_of_month& lkd) + { + os << "last " << lkd.day_of_week() << " of " + << lkd.month().as_short_string() ; + return os; + } + + //! operator<< for gregorian::first_kday_after. Output: "first Mon after" + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const first_kday_after& fka) + { + os << fka.day_of_week() << " after"; + return os; + } + + //! operator<< for gregorian::first_kday_before. Output: "first Mon before" + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const first_kday_before& fkb) + { + os << fkb.day_of_week() << " before"; + return os; + } +#endif // USE_DATE_TIME_PRE_1_33_FACET_IO + /**************** Input Streaming ******************/ + +#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) + //! operator>> for gregorian::date + template + inline + std::basic_istream& operator>>(std::basic_istream& is, date& d) + { + std::istream_iterator, charT> beg(is), eos; + + typedef boost::date_time::all_date_names_put facet_def; + d = from_stream(beg, eos); + return is; + } +#endif // BOOST_NO_STD_ITERATOR_TRAITS + + //! operator>> for gregorian::date_duration + template + inline + std::basic_istream& operator>>(std::basic_istream& is, + date_duration& dd) + { + long v; + is >> v; + dd = date_duration(v); + return is; + } + + //! operator>> for gregorian::date_period + template + inline + std::basic_istream& operator>>(std::basic_istream& is, + date_period& dp) + { + std::basic_string s; + is >> s; + dp = date_time::from_simple_string_type(s); + return is; + } + + //! generates a locale with the set of gregorian name-strings of type char* + BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, char type); + + //! Returns a pointer to a facet with a default set of names (English) + /* Necessary in the event an exception is thrown from op>> for + * weekday or month. See comments in those functions for more info */ + BOOST_DATE_TIME_DECL boost::date_time::all_date_names_put* create_facet_def(char type); + +#ifndef BOOST_NO_STD_WSTRING + //! generates a locale with the set of gregorian name-strings of type wchar_t* + BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, wchar_t type); + //! Returns a pointer to a facet with a default set of names (English) + /* Necessary in the event an exception is thrown from op>> for + * weekday or month. See comments in those functions for more info */ + BOOST_DATE_TIME_DECL boost::date_time::all_date_names_put* create_facet_def(wchar_t type); +#endif // BOOST_NO_STD_WSTRING + + //! operator>> for gregorian::greg_month - throws exception if invalid month given + template + inline + std::basic_istream& operator>>(std::basic_istream& is,greg_month& m) + { + typedef boost::date_time::all_date_names_put facet_def; + + std::basic_string s; + is >> s; + + if(!std::has_facet(is.getloc())) { + std::locale loc = is.getloc(); + charT a = '\0'; + is.imbue(generate_locale(loc, a)); + } + + short num = 0; + + try{ + const facet_def& f = std::use_facet(is.getloc()); + num = date_time::find_match(f.get_short_month_names(), + f.get_long_month_names(), + (greg_month::max)(), s); + } + /* bad_cast will be thrown if the desired facet is not accessible + * so we can generate the facet. This has the drawback of using english + * names as a default. */ + catch(std::bad_cast bc){ + std::cout << "Month exception caught" << std::endl; + charT a = '\0'; + const facet_def* f = create_facet_def(a); + num = date_time::find_match(f->get_short_month_names(), + f->get_long_month_names(), + (greg_month::max)(), s); + delete(f); + } + + num += 1; // months numbered 1-12 + m = greg_month(num); + + return is; + } + + //! operator>> for gregorian::greg_weekday - throws exception if invalid weekday given + template + inline + std::basic_istream& operator>>(std::basic_istream& is,greg_weekday& wd) + { + typedef boost::date_time::all_date_names_put facet_def; + + std::basic_string s; + is >> s; + + if(!std::has_facet(is.getloc())) { + std::locale loc = is.getloc(); + charT a = '\0'; + is.imbue(generate_locale(loc, a)); + } + + short num = 0; + try{ + const facet_def& f = std::use_facet(is.getloc()); + num = date_time::find_match(f.get_short_weekday_names(), + f.get_long_weekday_names(), + (greg_weekday::max)(), s); + } + /* bad_cast will be thrown if the desired facet is not accessible + * so we can generate the facet. This has the drawback of using english + * names as a default. */ + catch(std::bad_cast bc){ + //std::cout << "Weekday exception caught" << std::endl; + charT a = '\0'; + const facet_def* f = create_facet_def(a); + num = date_time::find_match(f->get_short_weekday_names(), + f->get_long_weekday_names(), + (greg_weekday::max)(), s); + delete(f); + } + + wd = greg_weekday(num); // weekdays numbered 0-6 + return is; + } + +} } //namespace gregorian + +#endif + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_month.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_month.hpp new file mode 100644 index 0000000000..fc9c86148d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_month.hpp @@ -0,0 +1,105 @@ +#ifndef GREG_MONTH_HPP___ +#define GREG_MONTH_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/constrained_value.hpp" +#include "boost/date_time/date_defs.hpp" +#include "boost/shared_ptr.hpp" +#include "boost/date_time/compiler_config.hpp" +#include +#include +#include +#include +#include + +namespace boost { +namespace gregorian { + + typedef date_time::months_of_year months_of_year; + + //bring enum values into the namespace + using date_time::Jan; + using date_time::Feb; + using date_time::Mar; + using date_time::Apr; + using date_time::May; + using date_time::Jun; + using date_time::Jul; + using date_time::Aug; + using date_time::Sep; + using date_time::Oct; + using date_time::Nov; + using date_time::Dec; + using date_time::NotAMonth; + using date_time::NumMonths; + + //! Exception thrown if a greg_month is constructed with a value out of range + struct bad_month : public std::out_of_range + { + bad_month() : std::out_of_range(std::string("Month number is out of range 1..12")) {} + }; + //! Build a policy class for the greg_month_rep + typedef CV::simple_exception_policy greg_month_policies; + //! A constrained range that implements the gregorian_month rules + typedef CV::constrained_value greg_month_rep; + + + //! Wrapper class to represent months in gregorian based calendar + class BOOST_DATE_TIME_DECL greg_month : public greg_month_rep { + public: + typedef date_time::months_of_year month_enum; + typedef std::map month_map_type; + typedef boost::shared_ptr month_map_ptr_type; + //! Construct a month from the months_of_year enumeration + greg_month(month_enum theMonth) : + greg_month_rep(static_cast(theMonth)) {} + //! Construct from a short value + greg_month(unsigned short theMonth) : greg_month_rep(theMonth) {} + //! Convert the value back to a short + operator unsigned short() const {return value_;} + //! Returns month as number from 1 to 12 + unsigned short as_number() const {return value_;} + month_enum as_enum() const {return static_cast(value_);} + const char* as_short_string() const; + const char* as_long_string() const; +#ifndef BOOST_NO_STD_WSTRING + const wchar_t* as_short_wstring() const; + const wchar_t* as_long_wstring() const; +#endif // BOOST_NO_STD_WSTRING + //! Shared pointer to a map of Month strings (Names & Abbrev) & numbers + static month_map_ptr_type get_month_map_ptr(); + + /* parameterized as_*_string functions are intended to be called + * from a template function: "... as_short_string(charT c='\0');" */ + const char* as_short_string(char) const + { + return as_short_string(); + } + const char* as_long_string(char) const + { + return as_long_string(); + } +#ifndef BOOST_NO_STD_WSTRING + const wchar_t* as_short_string(wchar_t) const + { + return as_short_wstring(); + } + const wchar_t* as_long_string(wchar_t) const + { + return as_long_wstring(); + } +#endif // BOOST_NO_STD_WSTRING + }; + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_serialize.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_serialize.hpp new file mode 100644 index 0000000000..b39b3a4e01 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_serialize.hpp @@ -0,0 +1,489 @@ +#ifndef GREGORIAN_SERIALIZE_HPP___ +#define GREGORIAN_SERIALIZE_HPP___ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/gregorian/parsers.hpp" +#include "boost/serialization/split_free.hpp" + + +// macros to split serialize functions into save & load functions +// An expanded version is below for gregorian::date +// NOTE: these macros define template functions in the boost::serialization namespace. +// They must be expanded *outside* of any namespace +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_period) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_month) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_day) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_weekday) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::partial_date) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::nth_kday_of_month) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_of_month) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::last_kday_of_month) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_before) +BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_after) + +namespace boost { +namespace serialization { + +/*! Method that does serialization for gregorian::date -- splits to load/save + */ +template +inline void serialize(Archive & ar, + ::boost::gregorian::date & d, + const unsigned int file_version) +{ + split_free(ar, d, file_version); +} + +//! Function to save gregorian::date objects using serialization lib +/*! Dates are serialized into a string for transport and storage. + * While it would be more efficient to store the internal + * integer used to manipulate the dates, it is an unstable solution. + */ +template +void save(Archive & ar, + const ::boost::gregorian::date & d, + unsigned int /* version */) +{ + std::string ds = to_iso_string(d); + ar & make_nvp("date", ds); +} + +//! Function to load gregorian::date objects using serialization lib +/*! Dates are serialized into a string for transport and storage. + * While it would be more efficient to store the internal + * integer used to manipulate the dates, it is an unstable solution. + */ +template +void load(Archive & ar, + ::boost::gregorian::date & d, + unsigned int /*version*/) +{ + std::string ds; + ar & make_nvp("date", ds); + try{ + d = ::boost::gregorian::from_undelimited_string(ds); + }catch(bad_lexical_cast be) { + gregorian::special_values sv = gregorian::special_value_from_string(ds); + if(sv == gregorian::not_special) { + throw(be); // no match found, rethrow original exception + } + else { + d = gregorian::date(sv); + } + } +} + + +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + ::boost::gregorian::date* dp, + const unsigned int /*file_version*/) +{ + // retrieve data from archive required to construct new + // invoke inplace constructor to initialize instance of date + ::new(dp) ::boost::gregorian::date(::boost::gregorian::not_a_date_time); +} + +/**** date_duration ****/ + +//! Function to save gregorian::date_duration objects using serialization lib +template +void save(Archive & ar, const gregorian::date_duration & dd, + unsigned int /*version*/) +{ + typename gregorian::date_duration::duration_rep dr = dd.get_rep(); + ar & make_nvp("date_duration", dr); +} +//! Function to load gregorian::date_duration objects using serialization lib +template +void load(Archive & ar, gregorian::date_duration & dd, unsigned int /*version*/) +{ + typename gregorian::date_duration::duration_rep dr(0); + ar & make_nvp("date_duration", dr); + dd = gregorian::date_duration(dr); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, gregorian::date_duration* dd, + const unsigned int /*file_version*/) +{ + ::new(dd) gregorian::date_duration(gregorian::not_a_date_time); +} + +/**** date_duration::duration_rep (most likely int_adapter) ****/ + +//! helper unction to save date_duration objects using serialization lib +template +void save(Archive & ar, const gregorian::date_duration::duration_rep & dr, + unsigned int /*version*/) +{ + typename gregorian::date_duration::duration_rep::int_type it = dr.as_number(); + ar & make_nvp("date_duration_duration_rep", it); +} +//! helper function to load date_duration objects using serialization lib +template +void load(Archive & ar, gregorian::date_duration::duration_rep & dr, unsigned int /*version*/) +{ + typename gregorian::date_duration::duration_rep::int_type it(0); + ar & make_nvp("date_duration_duration_rep", it); + dr = gregorian::date_duration::duration_rep::int_type(it); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, gregorian::date_duration::duration_rep* dr, + const unsigned int /*file_version*/) +{ + ::new(dr) gregorian::date_duration::duration_rep(0); +} + +/**** date_period ****/ + +//! Function to save gregorian::date_period objects using serialization lib +/*! date_period objects are broken down into 2 parts for serialization: + * the begining date object and the end date object + */ +template +void save(Archive & ar, const gregorian::date_period& dp, + unsigned int /*version*/) +{ + gregorian::date d1 = dp.begin(); + gregorian::date d2 = dp.end(); + ar & make_nvp("date_period_begin_date", d1); + ar & make_nvp("date_period_end_date", d2); +} +//! Function to load gregorian::date_period objects using serialization lib +/*! date_period objects are broken down into 2 parts for serialization: + * the begining date object and the end date object + */ +template +void load(Archive & ar, gregorian::date_period& dp, unsigned int /*version*/) +{ + gregorian::date d1(gregorian::not_a_date_time); + gregorian::date d2(gregorian::not_a_date_time); + ar & make_nvp("date_period_begin_date", d1); + ar & make_nvp("date_period_end_date", d2); + dp = gregorian::date_period(d1,d2); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, gregorian::date_period* dp, + const unsigned int /*file_version*/) +{ + gregorian::date d(gregorian::not_a_date_time); + gregorian::date_duration dd(1); + ::new(dp) gregorian::date_period(d,dd); +} + +/**** greg_month ****/ + +//! Function to save gregorian::greg_month objects using serialization lib +template +void save(Archive & ar, const gregorian::greg_month& gm, + unsigned int /*version*/) +{ + unsigned short us = gm.as_number(); + ar & make_nvp("greg_month", us); +} +//! Function to load gregorian::greg_month objects using serialization lib +template +void load(Archive & ar, gregorian::greg_month& gm, unsigned int /*version*/) +{ + unsigned short us; + ar & make_nvp("greg_month", us); + gm = gregorian::greg_month(us); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, gregorian::greg_month* gm, + const unsigned int /*file_version*/) +{ + ::new(gm) gregorian::greg_month(1); +} + +/**** greg_day ****/ + +//! Function to save gregorian::greg_day objects using serialization lib +template +void save(Archive & ar, const gregorian::greg_day& gd, + unsigned int /*version*/) +{ + unsigned short us = gd.as_number(); + ar & make_nvp("greg_day", us); +} +//! Function to load gregorian::greg_day objects using serialization lib +template +void load(Archive & ar, gregorian::greg_day& gd, unsigned int /*version*/) +{ + unsigned short us; + ar & make_nvp("greg_day", us); + gd = gregorian::greg_day(us); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, gregorian::greg_day* gd, + const unsigned int /*file_version*/) +{ + ::new(gd) gregorian::greg_day(1); +} + +/**** greg_weekday ****/ + +//! Function to save gregorian::greg_weekday objects using serialization lib +template +void save(Archive & ar, const gregorian::greg_weekday& gd, + unsigned int /*version*/) +{ + unsigned short us = gd.as_number(); + ar & make_nvp("greg_weekday", us); +} +//! Function to load gregorian::greg_weekday objects using serialization lib +template +void load(Archive & ar, gregorian::greg_weekday& gd, unsigned int /*version*/) +{ + unsigned short us; + ar & make_nvp("greg_weekday", us); + gd = gregorian::greg_weekday(us); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, gregorian::greg_weekday* gd, + const unsigned int /*file_version*/) +{ + ::new(gd) gregorian::greg_weekday(1); +} + +/**** date_generators ****/ + +/**** partial_date ****/ + +//! Function to save gregorian::partial_date objects using serialization lib +/*! partial_date objects are broken down into 2 parts for serialization: + * the day (typically greg_day) and month (typically greg_month) objects + */ +template +void save(Archive & ar, const gregorian::partial_date& pd, + unsigned int /*version*/) +{ + gregorian::greg_day gd(pd.day()); + gregorian::greg_month gm(pd.month().as_number()); + ar & make_nvp("partial_date_day", gd); + ar & make_nvp("partial_date_month", gm); +} +//! Function to load gregorian::partial_date objects using serialization lib +/*! partial_date objects are broken down into 2 parts for serialization: + * the day (greg_day) and month (greg_month) objects + */ +template +void load(Archive & ar, gregorian::partial_date& pd, unsigned int /*version*/) +{ + gregorian::greg_day gd(1); + gregorian::greg_month gm(1); + ar & make_nvp("partial_date_day", gd); + ar & make_nvp("partial_date_month", gm); + pd = gregorian::partial_date(gd,gm); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, gregorian::partial_date* pd, + const unsigned int /*file_version*/) +{ + gregorian::greg_month gm(1); + gregorian::greg_day gd(1); + ::new(pd) gregorian::partial_date(gd,gm); +} + +/**** nth_kday_of_month ****/ + +//! Function to save nth_day_of_the_week_in_month objects using serialization lib +/*! nth_day_of_the_week_in_month objects are broken down into 3 parts for + * serialization: the week number, the day of the week, and the month + */ +template +void save(Archive & ar, const gregorian::nth_kday_of_month& nkd, + unsigned int /*version*/) +{ + typename gregorian::nth_kday_of_month::week_num wn(nkd.nth_week()); + typename gregorian::nth_kday_of_month::day_of_week_type d(nkd.day_of_week().as_number()); + typename gregorian::nth_kday_of_month::month_type m(nkd.month().as_number()); + ar & make_nvp("nth_kday_of_month_week_num", wn); + ar & make_nvp("nth_kday_of_month_day_of_week", d); + ar & make_nvp("nth_kday_of_month_month", m); +} +//! Function to load nth_day_of_the_week_in_month objects using serialization lib +/*! nth_day_of_the_week_in_month objects are broken down into 3 parts for + * serialization: the week number, the day of the week, and the month + */ +template +void load(Archive & ar, gregorian::nth_kday_of_month& nkd, unsigned int /*version*/) +{ + typename gregorian::nth_kday_of_month::week_num wn(gregorian::nth_kday_of_month::first); + typename gregorian::nth_kday_of_month::day_of_week_type d(gregorian::Monday); + typename gregorian::nth_kday_of_month::month_type m(gregorian::Jan); + ar & make_nvp("nth_kday_of_month_week_num", wn); + ar & make_nvp("nth_kday_of_month_day_of_week", d); + ar & make_nvp("nth_kday_of_month_month", m); + + nkd = gregorian::nth_kday_of_month(wn,d,m); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + gregorian::nth_kday_of_month* nkd, + const unsigned int /*file_version*/) +{ + // values used are not significant + ::new(nkd) gregorian::nth_kday_of_month(gregorian::nth_kday_of_month::first, + gregorian::Monday,gregorian::Jan); +} + +/**** first_kday_of_month ****/ + +//! Function to save first_day_of_the_week_in_month objects using serialization lib +/*! first_day_of_the_week_in_month objects are broken down into 2 parts for + * serialization: the day of the week, and the month + */ +template +void save(Archive & ar, const gregorian::first_kday_of_month& fkd, + unsigned int /*version*/) +{ + typename gregorian::first_kday_of_month::day_of_week_type d(fkd.day_of_week().as_number()); + typename gregorian::first_kday_of_month::month_type m(fkd.month().as_number()); + ar & make_nvp("first_kday_of_month_day_of_week", d); + ar & make_nvp("first_kday_of_month_month", m); +} +//! Function to load first_day_of_the_week_in_month objects using serialization lib +/*! first_day_of_the_week_in_month objects are broken down into 2 parts for + * serialization: the day of the week, and the month + */ +template +void load(Archive & ar, gregorian::first_kday_of_month& fkd, unsigned int /*version*/) +{ + typename gregorian::first_kday_of_month::day_of_week_type d(gregorian::Monday); + typename gregorian::first_kday_of_month::month_type m(gregorian::Jan); + ar & make_nvp("first_kday_of_month_day_of_week", d); + ar & make_nvp("first_kday_of_month_month", m); + + fkd = gregorian::first_kday_of_month(d,m); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + gregorian::first_kday_of_month* fkd, + const unsigned int /*file_version*/) +{ + // values used are not significant + ::new(fkd) gregorian::first_kday_of_month(gregorian::Monday,gregorian::Jan); +} + +/**** last_kday_of_month ****/ + +//! Function to save last_day_of_the_week_in_month objects using serialization lib +/*! last_day_of_the_week_in_month objects are broken down into 2 parts for + * serialization: the day of the week, and the month + */ +template +void save(Archive & ar, const gregorian::last_kday_of_month& lkd, + unsigned int /*version*/) +{ + typename gregorian::last_kday_of_month::day_of_week_type d(lkd.day_of_week().as_number()); + typename gregorian::last_kday_of_month::month_type m(lkd.month().as_number()); + ar & make_nvp("last_kday_of_month_day_of_week", d); + ar & make_nvp("last_kday_of_month_month", m); +} +//! Function to load last_day_of_the_week_in_month objects using serialization lib +/*! last_day_of_the_week_in_month objects are broken down into 2 parts for + * serialization: the day of the week, and the month + */ +template +void load(Archive & ar, gregorian::last_kday_of_month& lkd, unsigned int /*version*/) +{ + typename gregorian::last_kday_of_month::day_of_week_type d(gregorian::Monday); + typename gregorian::last_kday_of_month::month_type m(gregorian::Jan); + ar & make_nvp("last_kday_of_month_day_of_week", d); + ar & make_nvp("last_kday_of_month_month", m); + + lkd = gregorian::last_kday_of_month(d,m); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + gregorian::last_kday_of_month* lkd, + const unsigned int /*file_version*/) +{ + // values used are not significant + ::new(lkd) gregorian::last_kday_of_month(gregorian::Monday,gregorian::Jan); +} + +/**** first_kday_before ****/ + +//! Function to save first_day_of_the_week_before objects using serialization lib +template +void save(Archive & ar, const gregorian::first_kday_before& fkdb, + unsigned int /*version*/) +{ + typename gregorian::first_kday_before::day_of_week_type d(fkdb.day_of_week().as_number()); + ar & make_nvp("first_kday_before_day_of_week", d); +} +//! Function to load first_day_of_the_week_before objects using serialization lib +template +void load(Archive & ar, gregorian::first_kday_before& fkdb, unsigned int /*version*/) +{ + typename gregorian::first_kday_before::day_of_week_type d(gregorian::Monday); + ar & make_nvp("first_kday_before_day_of_week", d); + + fkdb = gregorian::first_kday_before(d); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + gregorian::first_kday_before* fkdb, + const unsigned int /*file_version*/) +{ + // values used are not significant + ::new(fkdb) gregorian::first_kday_before(gregorian::Monday); +} + +/**** first_kday_after ****/ + +//! Function to save first_day_of_the_week_after objects using serialization lib +template +void save(Archive & ar, const gregorian::first_kday_after& fkda, + unsigned int /*version*/) +{ + typename gregorian::first_kday_after::day_of_week_type d(fkda.day_of_week().as_number()); + ar & make_nvp("first_kday_after_day_of_week", d); +} +//! Function to load first_day_of_the_week_after objects using serialization lib +template +void load(Archive & ar, gregorian::first_kday_after& fkda, unsigned int /*version*/) +{ + typename gregorian::first_kday_after::day_of_week_type d(gregorian::Monday); + ar & make_nvp("first_kday_after_day_of_week", d); + + fkda = gregorian::first_kday_after(d); +} +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + gregorian::first_kday_after* fkda, + const unsigned int /*file_version*/) +{ + // values used are not significant + ::new(fkda) gregorian::first_kday_after(gregorian::Monday); +} + +} // namespace serialization +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_weekday.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_weekday.hpp new file mode 100644 index 0000000000..3c4a6a5667 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_weekday.hpp @@ -0,0 +1,66 @@ +#ifndef GREG_WEEKDAY_HPP___ +#define GREG_WEEKDAY_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/constrained_value.hpp" +#include "boost/date_time/date_defs.hpp" +#include "boost/date_time/compiler_config.hpp" +#include +#include + +namespace boost { +namespace gregorian { + + //bring enum values into the namespace + using date_time::Sunday; + using date_time::Monday; + using date_time::Tuesday; + using date_time::Wednesday; + using date_time::Thursday; + using date_time::Friday; + using date_time::Saturday; + + + //! Exception that flags that a weekday number is incorrect + struct bad_weekday : public std::out_of_range + { + bad_weekday() : std::out_of_range(std::string("Weekday os out of range 0..6")) {} + }; + typedef CV::simple_exception_policy greg_weekday_policies; + typedef CV::constrained_value greg_weekday_rep; + + + //! Represent a day within a week (range 0==Sun to 6==Sat) + class BOOST_DATE_TIME_DECL greg_weekday : public greg_weekday_rep { + public: + typedef boost::date_time::weekdays weekday_enum; + greg_weekday(unsigned short day_of_week_num) : + greg_weekday_rep(day_of_week_num) + {} + + unsigned short as_number() const {return value_;} + const char* as_short_string() const; + const char* as_long_string() const; +#ifndef BOOST_NO_STD_WSTRING + const wchar_t* as_short_wstring() const; + const wchar_t* as_long_wstring() const; +#endif // BOOST_NO_STD_WSTRING + weekday_enum as_enum() const {return static_cast(value_);} + + + }; + + + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_year.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_year.hpp new file mode 100644 index 0000000000..ef1735f427 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_year.hpp @@ -0,0 +1,53 @@ +#ifndef GREG_YEAR_HPP___ +#define GREG_YEAR_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/constrained_value.hpp" +#include +#include + +namespace boost { +namespace gregorian { + + //! Exception type for gregorian year + struct bad_year : public std::out_of_range + { + bad_year() : + std::out_of_range(std::string("Year is out of valid range: 1400..10000")) + {} + }; + //! Policy class that declares error handling gregorian year type + typedef CV::simple_exception_policy greg_year_policies; + + //! Generated representation for gregorian year + typedef CV::constrained_value greg_year_rep; + + //! Represent a day of the month (range 1900 - 10000) + /*! This small class allows for simple conversion an integer value into + a year for the gregorian calendar. This currently only allows a + range of 1900 to 10000. Both ends of the range are a bit arbitrary + at the moment, but they are the limits of current testing of the + library. As such they may be increased in the future. + */ + class greg_year : public greg_year_rep { + public: + greg_year(unsigned short year) : greg_year_rep(year) {} + operator unsigned short() const {return value_;} + private: + + }; + + + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_ymd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_ymd.hpp new file mode 100644 index 0000000000..086e73df4a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/greg_ymd.hpp @@ -0,0 +1,33 @@ +#ifndef DATE_TIME_GREG_YMD_HPP__ +#define DATE_TIME_GREG_YMD_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/year_month_day.hpp" +#include "boost/date_time/special_defs.hpp" +#include "boost/date_time/gregorian/greg_day.hpp" +#include "boost/date_time/gregorian/greg_year.hpp" +#include "boost/date_time/gregorian/greg_month.hpp" + +namespace boost { +namespace gregorian { + + typedef date_time::year_month_day_base greg_year_month_day; + + + +} } //namespace gregorian + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian.hpp new file mode 100644 index 0000000000..bfafa1b037 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian.hpp @@ -0,0 +1,38 @@ +#ifndef GREGORIAN_HPP__ +#define GREGORIAN_HPP__ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file gregorian.hpp + Single file header that provides overall include for all elements of + the gregorian date-time system. This includes the various types + defined, but also other functions for formatting and parsing. +*/ + + +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/gregorian/conversion.hpp" +#if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS) +#include "boost/date_time/gregorian/formatters_limited.hpp" +#else +#include "boost/date_time/gregorian/formatters.hpp" +#endif + +#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) +#include "boost/date_time/gregorian/greg_facet.hpp" +#else +#include "boost/date_time/gregorian/gregorian_io.hpp" +#endif // USE_DATE_TIME_PRE_1_33_FACET_IO + +#include "boost/date_time/gregorian/parsers.hpp" + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian_io.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian_io.hpp new file mode 100644 index 0000000000..5f4fd85ec1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian_io.hpp @@ -0,0 +1,777 @@ +#ifndef DATE_TIME_GREGORIAN_IO_HPP__ +#define DATE_TIME_GREGORIAN_IO_HPP__ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/date_facet.hpp" +#include "boost/io/ios_state.hpp" +#include +#include + +namespace boost { +namespace gregorian { + + + typedef boost::date_time::period_formatter wperiod_formatter; + typedef boost::date_time::period_formatter period_formatter; + + typedef boost::date_time::date_facet wdate_facet; + typedef boost::date_time::date_facet date_facet; + + typedef boost::date_time::period_parser period_parser; + typedef boost::date_time::period_parser wperiod_parser; + + typedef boost::date_time::special_values_formatter special_values_formatter; + typedef boost::date_time::special_values_formatter wspecial_values_formatter; + + typedef boost::date_time::special_values_parser special_values_parser; + typedef boost::date_time::special_values_parser wspecial_values_parser; + + typedef boost::date_time::date_input_facet date_input_facet; + typedef boost::date_time::date_input_facet wdate_input_facet; + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::date& d) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), d); + else { + //instantiate a custom facet for dealing with dates since the user + //has not put one in the stream so far. This is for efficiency + //since we would always need to reconstruct for every date + //if the locale did not already exist. Of course this will be overridden + //if the user imbues at some later point. With the default settings + //for the facet the resulting format will be the same as the + //std::time_facet settings. + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), d); + } + return os; + } + + //! input operator for date + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, date& d) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, d); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, d); + } + } + catch(...) { + // mask tells us what exceptions are turned on + std::ios_base::iostate exception_mask = is.exceptions(); + // if the user wants exceptions on failbit, we'll rethrow our + // date_time exception & set the failbit + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} // ignore this one + throw; // rethrow original exception + } + else { + // if the user want's to fail quietly, we simply set the failbit + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::date_duration& dd) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), dd); + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), dd); + + } + return os; + } + + //! input operator for date_duration + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, date_duration& dd) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, dd); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, dd); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::date_period& dp) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), dp); + else { + //instantiate a custom facet for dealing with date periods since the user + //has not put one in the stream so far. This is for efficiency + //since we would always need to reconstruct for every time period + //if the local did not already exist. Of course this will be overridden + //if the user imbues at some later point. With the default settings + //for the facet the resulting format will be the same as the + //std::time_facet settings. + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), dp); + + } + return os; + } + + //! input operator for date_period + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, date_period& dp) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, dp); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, dp); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + /********** small gregorian types **********/ + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::greg_month& gm) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), gm); + else { + custom_date_facet* f = new custom_date_facet();//-> 10/1074199752/32 because year & day not initialized in put(...) + //custom_date_facet* f = new custom_date_facet("%B"); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), gm); + } + return os; + } + + //! input operator for greg_month + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, greg_month& m) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, m); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, m); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::greg_weekday& gw) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), gw); + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), gw); + } + return os; + } + + //! input operator for greg_weekday + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, greg_weekday& wd) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, wd); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, wd); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + //NOTE: output operator for greg_day was not necessary + + //! input operator for greg_day + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, greg_day& gd) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, gd); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, gd); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + //NOTE: output operator for greg_year was not necessary + + //! input operator for greg_year + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, greg_year& gy) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, gy); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, gy); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + /********** date generator types **********/ + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::partial_date& pd) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), pd); + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), pd); + } + return os; + } + + //! input operator for partial_date + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, partial_date& pd) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, pd); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, pd); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::nth_day_of_the_week_in_month& nkd) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), nkd); + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), nkd); + } + return os; + } + + //! input operator for nth_day_of_the_week_in_month + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, + nth_day_of_the_week_in_month& nday) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, nday); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, nday); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::first_day_of_the_week_in_month& fkd) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), fkd); + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), fkd); + } + return os; + } + + //! input operator for first_day_of_the_week_in_month + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, + first_day_of_the_week_in_month& fkd) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, fkd); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, fkd); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::last_day_of_the_week_in_month& lkd) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), lkd); + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), lkd); + } + return os; + } + + //! input operator for last_day_of_the_week_in_month + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, + last_day_of_the_week_in_month& lkd) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, lkd); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, lkd); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::first_day_of_the_week_after& fda) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) { + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), fda); + } + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), fda); + } + return os; + } + + //! input operator for first_day_of_the_week_after + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, + first_day_of_the_week_after& fka) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, fka); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, fka); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + + template + inline std::basic_ostream& + operator<<(std::basic_ostream& os, const boost::gregorian::first_day_of_the_week_before& fdb) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::date_facet custom_date_facet; + std::ostreambuf_iterator output_itr(os); + if (std::has_facet(os.getloc())) { + std::use_facet(os.getloc()).put(output_itr, os, os.fill(), fdb); + } + else { + custom_date_facet* f = new custom_date_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(output_itr, os, os.fill(), fdb); + } + return os; + } + + //! input operator for first_day_of_the_week_before + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, + first_day_of_the_week_before& fkb) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::date_input_facet date_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, fkb); + } + else { + date_input_facet* f = new date_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, fkb); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + +} } // namespaces + +#endif // DATE_TIME_GREGORIAN_IO_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian_types.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian_types.hpp new file mode 100644 index 0000000000..0c74857a25 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/gregorian_types.hpp @@ -0,0 +1,109 @@ +#ifndef _GREGORIAN_TYPES_HPP__ +#define _GREGORIAN_TYPES_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file gregorian_types.hpp + Single file header that defines most of the types for the gregorian + date-time system. +*/ + +#include "boost/date_time/date.hpp" +#include "boost/date_time/period.hpp" +#include "boost/date_time/gregorian/greg_calendar.hpp" +#include "boost/date_time/gregorian/greg_duration.hpp" +#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES) +#include "boost/date_time/gregorian/greg_duration_types.hpp" +#endif +#include "boost/date_time/gregorian/greg_date.hpp" +#include "boost/date_time/date_generators.hpp" +#include "boost/date_time/date_clock_device.hpp" +#include "boost/date_time/date_iterator.hpp" +#include "boost/date_time/adjust_functors.hpp" + +namespace boost { + +//! Gregorian date system based on date_time components +/*! This date system defines a full complement of types including + * a date, date_duration, date_period, day_clock, and a + * day_iterator. + */ +namespace gregorian { + //! Date periods for the gregorian system + /*!\ingroup date_basics + */ + typedef date_time::period date_period; + + //! A unifying date_generator base type + /*! A unifying date_generator base type for: + * partial_date, nth_day_of_the_week_in_month, + * first_day_of_the_week_in_month, and last_day_of_the_week_in_month + */ + typedef date_time::year_based_generator year_based_generator; + + //! A date generation object type + typedef date_time::partial_date partial_date; + + typedef date_time::nth_kday_of_month nth_kday_of_month; + typedef nth_kday_of_month nth_day_of_the_week_in_month; + + typedef date_time::first_kday_of_month first_kday_of_month; + typedef first_kday_of_month first_day_of_the_week_in_month; + + typedef date_time::last_kday_of_month last_kday_of_month; + typedef last_kday_of_month last_day_of_the_week_in_month; + + typedef date_time::first_kday_after first_kday_after; + typedef first_kday_after first_day_of_the_week_after; + + typedef date_time::first_kday_before first_kday_before; + typedef first_kday_before first_day_of_the_week_before; + + //! A clock to get the current day from the local computer + /*!\ingroup date_basics + */ + typedef date_time::day_clock day_clock; + + //! Base date_iterator type for gregorian types. + /*!\ingroup date_basics + */ + typedef date_time::date_itr_base date_iterator; + + //! A day level iterator + /*!\ingroup date_basics + */ + typedef date_time::date_itr, + date> day_iterator; + //! A week level iterator + /*!\ingroup date_basics + */ + typedef date_time::date_itr, + date> week_iterator; + //! A month level iterator + /*!\ingroup date_basics + */ + typedef date_time::date_itr, + date> month_iterator; + //! A year level iterator + /*!\ingroup date_basics + */ + typedef date_time::date_itr, + date> year_iterator; + + // bring in these date_generator functions from date_time namespace + using date_time::days_until_weekday; + using date_time::days_before_weekday; + using date_time::next_weekday; + using date_time::previous_weekday; + +} } //namespace gregorian + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/parsers.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/parsers.hpp new file mode 100644 index 0000000000..95d4f23dec --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian/parsers.hpp @@ -0,0 +1,91 @@ +#ifndef GREGORIAN_PARSERS_HPP___ +#define GREGORIAN_PARSERS_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/date_parsing.hpp" +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/parse_format_base.hpp" +#include +#include + +namespace boost { +namespace gregorian { + + //! Return special_value from string argument + /*! Return special_value from string argument. If argument is + * not one of the special value names (defined in src/gregorian/names.hpp), + * return 'not_special' */ + BOOST_DATE_TIME_DECL special_values special_value_from_string(const std::string& s); + + //! Deprecated: Use from_simple_string + inline date from_string(std::string s) { + return date_time::parse_date(s); + } + + //! From delimited date string where with order year-month-day eg: 2002-1-25 or 2003-Jan-25 (full month name is also accepted) + inline date from_simple_string(std::string s) { + return date_time::parse_date(s, date_time::ymd_order_iso); + } + + //! From delimited date string where with order year-month-day eg: 1-25-2003 or Jan-25-2003 (full month name is also accepted) + inline date from_us_string(std::string s) { + return date_time::parse_date(s, date_time::ymd_order_us); + } + + //! From delimited date string where with order day-month-year eg: 25-1-2002 or 25-Jan-2003 (full month name is also accepted) + inline date from_uk_string(std::string s) { + return date_time::parse_date(s, date_time::ymd_order_dmy); + } + + //! From iso type date string where with order year-month-day eg: 20020125 + inline date from_undelimited_string(std::string s) { + return date_time::parse_undelimited_date(s); + } + + //! From iso type date string where with order year-month-day eg: 20020125 + inline date date_from_iso_string(const std::string& s) { + return date_time::parse_undelimited_date(s); + } + +#if !(defined(BOOST_NO_STD_ITERATOR_TRAITS)) + //! Stream should hold a date in the form of: 2002-1-25. Month number, abbrev, or name are accepted + /* Arguments passed in by-value for convertability of char[] + * to iterator_type. Calls to from_stream_type are by-reference + * since conversion is already done */ + template + inline date from_stream(iterator_type beg, iterator_type end) { + if(beg == end) + { + return date(not_a_date_time); + } + typedef typename std::iterator_traits::value_type value_type; + return date_time::from_stream_type(beg, end, value_type()); + } +#endif //BOOST_NO_STD_ITERATOR_TRAITS + +#if (defined(_MSC_VER) && (_MSC_VER < 1300)) + // This function cannot be compiled with MSVC 6.0 due to internal compiler shorcomings +#else + //! Function to parse a date_period from a string (eg: [2003-Oct-31/2003-Dec-25]) + inline date_period date_period_from_string(const std::string& s){ + return date_time::from_simple_string_type(s); + } +# if !defined(BOOST_NO_STD_WSTRING) + //! Function to parse a date_period from a wstring (eg: [2003-Oct-31/2003-Dec-25]) + inline date_period date_period_from_wstring(const std::wstring& s){ + return date_time::from_simple_string_type(s); + } +# endif // BOOST_NO_STD_WSTRING +#endif + +} } //namespace gregorian + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian_calendar.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian_calendar.hpp new file mode 100644 index 0000000000..6386008bea --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian_calendar.hpp @@ -0,0 +1,70 @@ +#ifndef DATE_TIME_GREGORIAN_CALENDAR_HPP__ +#define DATE_TIME_GREGORIAN_CALENDAR_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +namespace boost { +namespace date_time { + + + //! An implementation of the Gregorian calendar + /*! This is a parameterized implementation of a proleptic Gregorian Calendar that + can be used in the creation of date systems or just to perform calculations. + All the methods of this class are static functions, so the intent is to + never create instances of this class. + @param ymd_type_ Struct type representing the year, month, day. The ymd_type must + define a of types for the year, month, and day. These types need to be + arithmetic types. + @param date_int_type_ Underlying type for the date count. Must be an arithmetic type. + */ + template + class gregorian_calendar_base { + public: + //! define a type a date split into components + typedef ymd_type_ ymd_type; + //! define a type for representing months + typedef typename ymd_type::month_type month_type; + //! define a type for representing days + typedef typename ymd_type::day_type day_type; + //! Type to hold a stand alone year value (eg: 2002) + typedef typename ymd_type::year_type year_type; + //! Define the integer type to use for internal calculations + typedef date_int_type_ date_int_type; + + + static unsigned short day_of_week(const ymd_type& ymd); + static int week_number(const ymd_type&ymd); + //static unsigned short day_of_year(date_int_type); + static date_int_type day_number(const ymd_type& ymd); + static date_int_type julian_day_number(const ymd_type& ymd); + static long modjulian_day_number(const ymd_type& ymd); + static ymd_type from_day_number(date_int_type); + static ymd_type from_julian_day_number(date_int_type); + static ymd_type from_modjulian_day_number(long); + static bool is_leap_year(year_type); + static unsigned short end_of_month_day(year_type y, month_type m); + static ymd_type epoch(); + static unsigned short days_in_week(); + + }; + + + +} } //namespace + +#ifndef NO_BOOST_DATE_TIME_INLINE +#include "boost/date_time/gregorian_calendar.ipp" +#endif + + + +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian_calendar.ipp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian_calendar.ipp new file mode 100644 index 0000000000..36bb4b9f8d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/gregorian_calendar.ipp @@ -0,0 +1,219 @@ +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#ifndef NO_BOOST_DATE_TIME_INLINE + #undef BOOST_DATE_TIME_INLINE + #define BOOST_DATE_TIME_INLINE inline +#endif + +namespace boost { +namespace date_time { + //! Return the day of the week (0==Sunday, 1==Monday, etc) + /*! Converts a the year-month-day into a day of the week number + */ + template + BOOST_DATE_TIME_INLINE + unsigned short + gregorian_calendar_base::day_of_week(const ymd_type& ymd) { + unsigned short a = static_cast((14-ymd.month)/12); + unsigned short y = static_cast(ymd.year - a); + unsigned short m = static_cast(ymd.month + 12*a - 2); + unsigned short d = static_cast((ymd.day + y + (y/4) - (y/100) + (y/400) + (31*m)/12) % 7); + //std::cout << year << "-" << month << "-" << day << " is day: " << d << "\n"; + return d; + } + + //!Return the iso week number for the date + /*!Implements the rules associated with the iso 8601 week number. + Basically the rule is that Week 1 of the year is the week that contains + January 4th or the week that contains the first Thursday in January. + Reference for this algorithm is the Calendar FAQ by Claus Tondering, April 2000. + */ + template + BOOST_DATE_TIME_INLINE + int + gregorian_calendar_base::week_number(const ymd_type& ymd) { + unsigned long julianbegin = julian_day_number(ymd_type(ymd.year,1,1)); + unsigned long juliantoday = julian_day_number(ymd); + unsigned long day = (julianbegin + 3) % 7; + unsigned long week = (juliantoday + day - julianbegin + 4)/7; + + if ((week >= 1) && (week <= 52)) { + return week; + } + + if ((week == 53)) { + if((day==6) ||(day == 5 && is_leap_year(ymd.year))) { + return week; //under these circumstances week == 53. + } else { + return 1; //monday - wednesday is in week 1 of next year + } + } + //if the week is not in current year recalculate using the previous year as the beginning year + else if (week == 0) { + julianbegin = julian_day_number(ymd_type(static_cast(ymd.year-1),1,1)); + juliantoday = julian_day_number(ymd); + day = (julianbegin + 3) % 7; + week = (juliantoday + day - julianbegin + 4)/7; + return week; + } + + return week; //not reachable -- well except if day == 5 and is_leap_year != true + + } + + //! Convert a ymd_type into a day number + /*! The day number is an absolute number of days since the start of count + */ + template + BOOST_DATE_TIME_INLINE + date_int_type_ + gregorian_calendar_base::day_number(const ymd_type& ymd) + { + unsigned short a = static_cast((14-ymd.month)/12); + unsigned short y = static_cast(ymd.year + 4800 - a); + unsigned short m = static_cast(ymd.month + 12*a - 3); + unsigned long d = ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045; + return d; + } + + //! Convert a year-month-day into the julian day number + /*! Since this implementation uses julian day internally, this is the same as the day_number. + */ + template + BOOST_DATE_TIME_INLINE + date_int_type_ + gregorian_calendar_base::julian_day_number(const ymd_type& ymd) + { + return day_number(ymd); + } + + //! Convert year-month-day into a modified julian day number + /*! The day number is an absolute number of days. + * MJD 0 thus started on 17 Nov 1858(Gregorian) at 00:00:00 UTC + */ + template + BOOST_DATE_TIME_INLINE + long + gregorian_calendar_base::modjulian_day_number(const ymd_type& ymd) + { + return julian_day_number(ymd)-2400001; //prerounded + } + + //! Change a day number into a year-month-day + template + BOOST_DATE_TIME_INLINE + ymd_type_ + gregorian_calendar_base::from_day_number(date_int_type dayNumber) + { + date_int_type a = dayNumber + 32044; + date_int_type b = (4*a + 3)/146097; + date_int_type c = a-((146097*b)/4); + date_int_type d = (4*c + 3)/1461; + date_int_type e = c - (1461*d)/4; + date_int_type m = (5*e + 2)/153; + unsigned short day = static_cast(e - ((153*m + 2)/5) + 1); + unsigned short month = static_cast(m + 3 - 12 * (m/10)); + year_type year = static_cast(100*b + d - 4800 + (m/10)); + //std::cout << year << "-" << month << "-" << day << "\n"; + + return ymd_type(static_cast(year),month,day); + } + + //! Change a day number into a year-month-day + template + BOOST_DATE_TIME_INLINE + ymd_type_ + gregorian_calendar_base::from_julian_day_number(date_int_type dayNumber) + { + date_int_type a = dayNumber + 32044; + date_int_type b = (4*a+3)/146097; + date_int_type c = a - ((146097*b)/4); + date_int_type d = (4*c + 3)/1461; + date_int_type e = c - ((1461*d)/4); + date_int_type m = (5*e + 2)/153; + unsigned short day = static_cast(e - ((153*m + 2)/5) + 1); + unsigned short month = static_cast(m + 3 - 12 * (m/10)); + year_type year = static_cast(100*b + d - 4800 + (m/10)); + //std::cout << year << "-" << month << "-" << day << "\n"; + + return ymd_type(year,month,day); + } + + //! Change a modified julian day number into a year-month-day + template + BOOST_DATE_TIME_INLINE + ymd_type_ + gregorian_calendar_base::from_modjulian_day_number(long dayNumber) { + date_int_type jd = dayNumber + 2400001; //is 2400000.5 prerounded + return from_julian_day_number(jd); + } + + //! Determine if the provided year is a leap year + /*! + *@return true if year is a leap year, false otherwise + */ + template + BOOST_DATE_TIME_INLINE + bool + gregorian_calendar_base::is_leap_year(year_type year) + { + //divisible by 4, not if divisible by 100, but true if divisible by 400 + return (!(year % 4)) && ((year % 100) || (!(year % 400))); + } + + //! Calculate the last day of the month + /*! Find the day which is the end of the month given year and month + * No error checking is performed. + */ + template + BOOST_DATE_TIME_INLINE + unsigned short + gregorian_calendar_base::end_of_month_day(year_type year, + month_type month) + { + switch (month) { + case 2: + if (is_leap_year(year)) { + return 29; + } else { + return 28; + }; + case 4: + case 6: + case 9: + case 11: + return 30; + default: + return 31; + }; + + } + + //! Provide the ymd_type specification for the calandar start + template + BOOST_DATE_TIME_INLINE + ymd_type_ + gregorian_calendar_base::epoch() + { + return ymd_type(1400,1,1); + } + + //! Defines length of a week for week calculations + template + BOOST_DATE_TIME_INLINE + unsigned short + gregorian_calendar_base::days_in_week() + { + return 7; + } + + +} } //namespace gregorian + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/int_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/int_adapter.hpp new file mode 100644 index 0000000000..a6ce1ec404 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/int_adapter.hpp @@ -0,0 +1,507 @@ +#ifndef _DATE_TIME_INT_ADAPTER_HPP__ +#define _DATE_TIME_INT_ADAPTER_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/config.hpp" +#include "boost/limits.hpp" //work around compilers without limits +#include "boost/date_time/special_defs.hpp" +#include "boost/date_time/locale_config.hpp" +#include + +namespace boost { +namespace date_time { + + +//! Adapter to create integer types with +-infinity, and not a value +/*! This class is used internally in counted date/time representations. + * It adds the floating point like features of infinities and + * not a number. It also provides mathmatical operations with + * consideration to special values following these rules: + *@code + * +infinity - infinity == Not A Number (NAN) + * infinity * non-zero == infinity + * infinity * zero == NAN + * +infinity * -integer == -infinity + * infinity / infinity == NAN + * infinity * infinity == infinity + *@endcode + */ +template +class int_adapter { +public: + typedef int_type_ int_type; + int_adapter(int_type v) : + value_(v) + {} + static bool has_infinity() + { + return true; + } + static const int_adapter pos_infinity() + { + return (::std::numeric_limits::max)(); + } + static const int_adapter neg_infinity() + { + return (::std::numeric_limits::min)(); + } + static const int_adapter not_a_number() + { + return (::std::numeric_limits::max)()-1; + } + static int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return (::std::numeric_limits::max)()-2; + } + static int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return (::std::numeric_limits::min)()+1; + } + static int_adapter from_special(special_values sv) + { + switch (sv) { + case not_a_date_time: return not_a_number(); + case neg_infin: return neg_infinity(); + case pos_infin: return pos_infinity(); + case max_date_time: return (max)(); + case min_date_time: return (min)(); + default: return not_a_number(); + } + } + static bool is_inf(int_type v) + { + return (v == neg_infinity().as_number() || + v == pos_infinity().as_number()); + } + static bool is_neg_inf(int_type v) + { + return (v == neg_infinity().as_number()); + } + static bool is_pos_inf(int_type v) + { + return (v == pos_infinity().as_number()); + } + static bool is_not_a_number(int_type v) + { + return (v == not_a_number().as_number()); + } + //! Returns either special value type or is_not_special + static special_values to_special(int_type v) + { + if (is_not_a_number(v)) return not_a_date_time; + if (is_neg_inf(v)) return neg_infin; + if (is_pos_inf(v)) return pos_infin; + return not_special; + } + + //-3 leaves room for representations of infinity and not a date + static int_type maxcount() + { + return (::std::numeric_limits::max)()-3; + } + bool is_infinity() const + { + return (value_ == neg_infinity().as_number() || + value_ == pos_infinity().as_number()); + } + bool is_pos_infinity()const + { + return(value_ == pos_infinity().as_number()); + } + bool is_neg_infinity()const + { + return(value_ == neg_infinity().as_number()); + } + bool is_nan() const + { + return (value_ == not_a_number().as_number()); + } + bool is_special() const + { + return(is_infinity() || is_nan()); + } + bool operator==(const int_adapter& rhs) const + { + return (compare(rhs) == 0); + } + bool operator==(const int& rhs) const + { + // quiets compiler warnings + bool is_signed = std::numeric_limits::is_signed; + if(!is_signed) + { + if(is_neg_inf(value_) && rhs == 0) + { + return false; + } + } + return (compare(rhs) == 0); + } + bool operator!=(const int_adapter& rhs) const + { + return (compare(rhs) != 0); + } + bool operator!=(const int& rhs) const + { + // quiets compiler warnings + bool is_signed = std::numeric_limits::is_signed; + if(!is_signed) + { + if(is_neg_inf(value_) && rhs == 0) + { + return true; + } + } + return (compare(rhs) != 0); + } + bool operator<(const int_adapter& rhs) const + { + return (compare(rhs) == -1); + } + bool operator<(const int& rhs) const + { + // quiets compiler warnings + bool is_signed = std::numeric_limits::is_signed; + if(!is_signed) + { + if(is_neg_inf(value_) && rhs == 0) + { + return true; + } + } + return (compare(rhs) == -1); + } + bool operator>(const int_adapter& rhs) const + { + return (compare(rhs) == 1); + } + int_type as_number() const + { + return value_; + } + //! Returns either special value type or is_not_special + special_values as_special() const + { + return int_adapter::to_special(value_); + } + //creates nasty ambiguities +// operator int_type() const +// { +// return value_; +// } + + /*! Operator allows for adding dissimilar int_adapter types. + * The return type will match that of the the calling object's type */ + template + inline + int_adapter operator+(const int_adapter& rhs) const + { + if(is_special() || rhs.is_special()) + { + if (is_nan() || rhs.is_nan()) + { + return int_adapter::not_a_number(); + } + if((is_pos_inf(value_) && rhs.is_neg_inf(rhs.as_number())) || + (is_neg_inf(value_) && rhs.is_pos_inf(rhs.as_number())) ) + { + return int_adapter::not_a_number(); + } + if (is_infinity()) + { + return *this; + } + if (rhs.is_pos_inf(rhs.as_number())) + { + return int_adapter::pos_infinity(); + } + if (rhs.is_neg_inf(rhs.as_number())) + { + return int_adapter::neg_infinity(); + } + } + return int_adapter(value_ + rhs.as_number()); + } + + int_adapter operator+(const int_type rhs) const + { + if(is_special()) + { + if (is_nan()) + { + return int_adapter(not_a_number()); + } + if (is_infinity()) + { + return *this; + } + } + return int_adapter(value_ + rhs); + } + + /*! Operator allows for subtracting dissimilar int_adapter types. + * The return type will match that of the the calling object's type */ + template + inline + int_adapter operator-(const int_adapter& rhs)const + { + if(is_special() || rhs.is_special()) + { + if (is_nan() || rhs.is_nan()) + { + return int_adapter::not_a_number(); + } + if((is_pos_inf(value_) && rhs.is_pos_inf(rhs.as_number())) || + (is_neg_inf(value_) && rhs.is_neg_inf(rhs.as_number())) ) + { + return int_adapter::not_a_number(); + } + if (is_infinity()) + { + return *this; + } + if (rhs.is_pos_inf(rhs.as_number())) + { + return int_adapter::neg_infinity(); + } + if (rhs.is_neg_inf(rhs.as_number())) + { + return int_adapter::pos_infinity(); + } + } + return int_adapter(value_ - rhs.as_number()); + } + int_adapter operator-(const int_type rhs) const + { + if(is_special()) + { + if (is_nan()) + { + return int_adapter(not_a_number()); + } + if (is_infinity()) + { + return *this; + } + } + return int_adapter(value_ - rhs); + } + + // should templatize this to be consistant with op +- + int_adapter operator*(const int_adapter& rhs)const + { + if(this->is_special() || rhs.is_special()) + { + return mult_div_specials(rhs); + } + return int_adapter(value_ * rhs.value_); + } + /*! Provided for cases when automatic conversion from + * 'int' to 'int_adapter' causes incorrect results. */ + int_adapter operator*(const int rhs) const + { + if(is_special()) + { + return mult_div_specials(rhs); + } + return int_adapter(value_ * rhs); + } + + // should templatize this to be consistant with op +- + int_adapter operator/(const int_adapter& rhs)const + { + if(this->is_special() || rhs.is_special()) + { + if(is_infinity() && rhs.is_infinity()) + { + return int_adapter(not_a_number()); + } + if(rhs != 0) + { + return mult_div_specials(rhs); + } + else { // let divide by zero blow itself up + return int_adapter(value_ / rhs.value_); + } + } + return int_adapter(value_ / rhs.value_); + } + /*! Provided for cases when automatic conversion from + * 'int' to 'int_adapter' causes incorrect results. */ + int_adapter operator/(const int rhs) const + { + if(is_special() && rhs != 0) + { + return mult_div_specials(rhs); + } + return int_adapter(value_ / rhs); + } + + // should templatize this to be consistant with op +- + int_adapter operator%(const int_adapter& rhs)const + { + if(this->is_special() || rhs.is_special()) + { + if(is_infinity() && rhs.is_infinity()) + { + return int_adapter(not_a_number()); + } + if(rhs != 0) + { + return mult_div_specials(rhs); + } + else { // let divide by zero blow itself up + return int_adapter(value_ % rhs.value_); + } + } + return int_adapter(value_ % rhs.value_); + } + /*! Provided for cases when automatic conversion from + * 'int' to 'int_adapter' causes incorrect results. */ + int_adapter operator%(const int rhs) const + { + if(is_special() && rhs != 0) + { + return mult_div_specials(rhs); + } + return int_adapter(value_ % rhs); + } +private: + int_type value_; + + //! returns -1, 0, 1, or 2 if 'this' is <, ==, >, or 'nan comparison' rhs + int compare(const int_adapter& rhs)const + { + if(this->is_special() || rhs.is_special()) + { + if(this->is_nan() || rhs.is_nan()) { + if(this->is_nan() && rhs.is_nan()) { + return 0; // equal + } + else { + return 2; // nan + } + } + if((is_neg_inf(value_) && !is_neg_inf(rhs.value_)) || + (is_pos_inf(rhs.value_) && !is_pos_inf(value_)) ) + { + return -1; // less than + } + if((is_pos_inf(value_) && !is_pos_inf(rhs.value_)) || + (is_neg_inf(rhs.value_) && !is_neg_inf(value_)) ) { + return 1; // greater than + } + } + if(value_ < rhs.value_) return -1; + if(value_ > rhs.value_) return 1; + // implied-> if(value_ == rhs.value_) + return 0; + } + /* When multiplying and dividing with at least 1 special value + * very simmilar rules apply. In those cases where the rules + * are different, they are handled in the respective operator + * function. */ + //! Assumes at least 'this' or 'rhs' is a special value + int_adapter mult_div_specials(const int_adapter& rhs)const + { + int min_value; + // quiets compiler warnings + bool is_signed = std::numeric_limits::is_signed; + if(is_signed) { + min_value = 0; + } + else { + min_value = 1;// there is no zero with unsigned + } + if(this->is_nan() || rhs.is_nan()) { + return int_adapter(not_a_number()); + } + if((*this > 0 && rhs > 0) || (*this < min_value && rhs < min_value)) { + return int_adapter(pos_infinity()); + } + if((*this > 0 && rhs < min_value) || (*this < min_value && rhs > 0)) { + return int_adapter(neg_infinity()); + } + //implied -> if(this->value_ == 0 || rhs.value_ == 0) + return int_adapter(not_a_number()); + } + /* Overloaded function necessary because of special + * situation where int_adapter is instantiated with + * 'unsigned' and func is called with negative int. + * It would produce incorrect results since 'unsigned' + * wraps around when initialized with a negative value */ + //! Assumes 'this' is a special value + int_adapter mult_div_specials(const int& rhs) const + { + int min_value; + // quiets compiler warnings + bool is_signed = std::numeric_limits::is_signed; + if(is_signed) { + min_value = 0; + } + else { + min_value = 1;// there is no zero with unsigned + } + if(this->is_nan()) { + return int_adapter(not_a_number()); + } + if((*this > 0 && rhs > 0) || (*this < min_value && rhs < 0)) { + return int_adapter(pos_infinity()); + } + if((*this > 0 && rhs < 0) || (*this < min_value && rhs > 0)) { + return int_adapter(neg_infinity()); + } + //implied -> if(this->value_ == 0 || rhs.value_ == 0) + return int_adapter(not_a_number()); + } + +}; + +#ifndef BOOST_DATE_TIME_NO_LOCALE + /*! Expected output is either a numeric representation + * or a special values representation.
+ * Ex. "12", "+infinity", "not-a-number", etc. */ + //template, typename int_type> + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const int_adapter& ia) + { + if(ia.is_special()) { + // switch copied from date_names_put.hpp + switch(ia.as_special()) + { + case not_a_date_time: + os << "not-a-number"; + break; + case pos_infin: + os << "+infinity"; + break; + case neg_infin: + os << "-infinity"; + break; + default: + os << ""; + } + } + else { + os << ia.as_number(); + } + return os; + } +#endif + + +} } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/iso_format.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/iso_format.hpp new file mode 100644 index 0000000000..8262fa2117 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/iso_format.hpp @@ -0,0 +1,303 @@ +#ifndef ISO_FORMAT_HPP___ +#define ISO_FORMAT_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/parse_format_base.hpp" + +namespace boost { +namespace date_time { + +//! Class to provide common iso formatting spec +template +class iso_format_base { +public: + //! Describe month format -- its an integer in iso format + static month_format_spec month_format() + { + return month_as_integer; + } + + //! String used printed is date is invalid + static const charT* not_a_date() + { + return "not-a-date-time"; + } + //! String used to for positive infinity value + static const charT* pos_infinity() + { + return "+infinity"; + } + //! String used to for positive infinity value + static const charT* neg_infinity() + { + return "-infinity"; + } + + //! ISO char for a year -- used in durations + static charT year_sep_char() + { + return 'Y'; + } + //! ISO char for a month + static charT month_sep_char() + { + return '-'; + } + //! ISO char for a day + static charT day_sep_char() + { + return '-'; + } + //! char for minute + static charT hour_sep_char() + { + return ':'; + } + //! char for minute + static charT minute_sep_char() + { + return ':'; + } + //! char for second + static charT second_sep_char() + { + return ':'; + } + //! ISO char for a period + static charT period_start_char() + { + return 'P'; + } + //! Used in time in mixed strings to set start of time + static charT time_start_char() + { + return 'T'; + } + + //! Used in mixed strings to identify start of a week number + static charT week_start_char() + { + return 'W'; + } + + //! Separators for periods + static charT period_sep_char() + { + return '/'; + } + //! Separator for hh:mm:ss + static charT time_sep_char() + { + return ':'; + } + //! Preferred Separator for hh:mm:ss,decimal_fraction + static charT fractional_time_sep_char() + { + return ','; + } + + static bool is_component_sep(charT sep) + { + switch(sep) { + case 'H': + case 'M': + case 'S': + case 'W': + case 'T': + case 'Y': + case 'D':return true; + default: + return false; + } + } + + static bool is_fractional_time_sep(charT sep) + { + switch(sep) { + case ',': + case '.': return true; + default: return false; + } + } + static bool is_timezone_sep(charT sep) + { + switch(sep) { + case '+': + case '-': return true; + default: return false; + } + } + static charT element_sep_char() + { + return '-'; + } + +}; + +#ifndef BOOST_NO_STD_WSTRING + +//! Class to provide common iso formatting spec +template<> +class iso_format_base { +public: + //! Describe month format -- its an integer in iso format + static month_format_spec month_format() + { + return month_as_integer; + } + + //! String used printed is date is invalid + static const wchar_t* not_a_date() + { + return L"not-a-date-time"; + } + //! String used to for positive infinity value + static const wchar_t* pos_infinity() + { + return L"+infinity"; + } + //! String used to for positive infinity value + static const wchar_t* neg_infinity() + { + return L"-infinity"; + } + + //! ISO char for a year -- used in durations + static wchar_t year_sep_char() + { + return 'Y'; + } + //! ISO char for a month + static wchar_t month_sep_char() + { + return '-'; + } + //! ISO char for a day + static wchar_t day_sep_char() + { + return '-'; + } + //! char for minute + static wchar_t hour_sep_char() + { + return ':'; + } + //! char for minute + static wchar_t minute_sep_char() + { + return ':'; + } + //! char for second + static wchar_t second_sep_char() + { + return ':'; + } + //! ISO char for a period + static wchar_t period_start_char() + { + return 'P'; + } + //! Used in time in mixed strings to set start of time + static wchar_t time_start_char() + { + return 'T'; + } + + //! Used in mixed strings to identify start of a week number + static wchar_t week_start_char() + { + return 'W'; + } + + //! Separators for periods + static wchar_t period_sep_char() + { + return '/'; + } + //! Separator for hh:mm:ss + static wchar_t time_sep_char() + { + return ':'; + } + //! Preferred Separator for hh:mm:ss,decimal_fraction + static wchar_t fractional_time_sep_char() + { + return ','; + } + + static bool is_component_sep(wchar_t sep) + { + switch(sep) { + case 'H': + case 'M': + case 'S': + case 'W': + case 'T': + case 'Y': + case 'D':return true; + default: + return false; + } + } + + static bool is_fractional_time_sep(wchar_t sep) + { + switch(sep) { + case ',': + case '.': return true; + default: return false; + } + } + static bool is_timezone_sep(wchar_t sep) + { + switch(sep) { + case '+': + case '-': return true; + default: return false; + } + } + static wchar_t element_sep_char() + { + return '-'; + } + +}; + +#endif // BOOST_NO_STD_WSTRING + +//! Format description for iso normal YYYYMMDD +template +class iso_format : public iso_format_base { +public: + //! The ios standard format doesn't use char separators + static bool has_date_sep_chars() + { + return false; + } +}; + +//! Extended format uses seperators YYYY-MM-DD +template +class iso_extended_format : public iso_format_base { +public: + //! Extended format needs char separators + static bool has_date_sep_chars() + { + return true; + } + +}; + +} } //namespace date_time + + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/conversion.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/conversion.hpp new file mode 100644 index 0000000000..03c612f3ff --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/conversion.hpp @@ -0,0 +1,35 @@ +#ifndef DATE_TIME_LOCAL_TIME_CONVERSION_HPP__ +#define DATE_TIME_LOCAL_TIME_CONVERSION_HPP__ + +/* Copyright (c) 2003-2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/posix_time/conversion.hpp" +#include "boost/date_time/c_time.hpp" +#include "boost/date_time/local_time/local_date_time.hpp" + +namespace boost { +namespace local_time { + +//! Function that creates a tm struct from a local_date_time +inline +tm to_tm(const local_date_time& lt) { + tm lt_tm; + lt_tm = posix_time::to_tm(lt.local_time()); + if(lt.is_dst()){ + lt_tm.tm_isdst = 1; + } + else{ + lt_tm.tm_isdst = 0; + } + return lt_tm; +} + + +}} // namespaces +#endif // DATE_TIME_LOCAL_TIME_CONVERSION_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/custom_time_zone.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/custom_time_zone.hpp new file mode 100644 index 0000000000..a6c1d42055 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/custom_time_zone.hpp @@ -0,0 +1,169 @@ +#ifndef LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ +#define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ + +/* Copyright (c) 2003-2005 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/time_zone_base.hpp" +#include "boost/date_time/time_zone_names.hpp" +#include "boost/date_time/posix_time/posix_time.hpp" +#include "boost/date_time/local_time/dst_transition_day_rules.hpp" +#include "boost/date_time/string_convert.hpp" +//#include "boost/date_time/special_defs.hpp" +#include "boost/shared_ptr.hpp" + +namespace boost { +namespace local_time { + + //typedef boost::date_time::time_zone_names time_zone_names; + typedef boost::date_time::dst_adjustment_offsets dst_adjustment_offsets; + //typedef boost::date_time::time_zone_base time_zone; + typedef boost::shared_ptr dst_calc_rule_ptr; + + //! A real time zone + template + class custom_time_zone_base : public date_time::time_zone_base { + public: + typedef boost::posix_time::time_duration time_duration_type; + typedef date_time::time_zone_base base_type; + typedef typename base_type::string_type string_type; + typedef typename base_type::stringstream_type stringstream_type; + typedef date_time::time_zone_names_base time_zone_names; + typedef CharT char_type; + + custom_time_zone_base(const time_zone_names& zone_names, + const time_duration_type& utc_offset, + const dst_adjustment_offsets& dst_shift, + boost::shared_ptr calc_rule) : + zone_names_(zone_names), + base_utc_offset_(utc_offset), + dst_offsets_(dst_shift), + dst_calc_rules_(calc_rule) + {}; + virtual ~custom_time_zone_base() {}; + virtual string_type dst_zone_abbrev() const + { + return zone_names_.dst_zone_abbrev(); + } + virtual string_type std_zone_abbrev() const + { + return zone_names_.std_zone_abbrev(); + } + virtual string_type dst_zone_name() const + { + return zone_names_.dst_zone_name(); + } + virtual string_type std_zone_name() const + { + return zone_names_.std_zone_name(); + } + //! True if zone uses daylight savings adjustments + virtual bool has_dst() const + { + return (dst_calc_rules_); //if calc_rule is set the tz has dst + } + //! Local time that DST starts -- NADT if has_dst is false + virtual posix_time::ptime dst_local_start_time(gregorian::greg_year y) const + { + gregorian::date d(gregorian::not_a_date_time); + if (dst_calc_rules_) { + d = dst_calc_rules_->start_day(y); + } + return posix_time::ptime(d, dst_offsets_.dst_start_offset_); + } + //! Local time that DST ends -- NADT if has_dst is false + virtual posix_time::ptime dst_local_end_time(gregorian::greg_year y) const + { + gregorian::date d(gregorian::not_a_date_time); + if (dst_calc_rules_) { + d = dst_calc_rules_->end_day(y); + } + return posix_time::ptime(d, dst_offsets_.dst_end_offset_); + } + //! Base offset from UTC for zone (eg: -07:30:00) + virtual time_duration_type base_utc_offset() const + { + return base_utc_offset_; + } + //! Adjustment forward or back made while DST is in effect + virtual time_duration_type dst_offset() const + { + return dst_offsets_.dst_adjust_; + } + //! Returns a POSIX time_zone string for this object + virtual string_type to_posix_string() const + { + // std offset dst [offset],start[/time],end[/time] - w/o spaces + stringstream_type ss; + ss.fill('0'); + boost::shared_ptr no_rules; + // std + ss << std_zone_abbrev(); + // offset + if(base_utc_offset().is_negative()) { + // inverting the sign guarantees we get two digits + ss << '-' << std::setw(2) << base_utc_offset().invert_sign().hours(); + } + else { + ss << '+' << std::setw(2) << base_utc_offset().hours(); + } + if(base_utc_offset().minutes() != 0 || base_utc_offset().seconds() != 0) { + ss << ':' << std::setw(2) << base_utc_offset().minutes(); + if(base_utc_offset().seconds() != 0) { + ss << ':' << std::setw(2) << base_utc_offset().seconds(); + } + } + if(dst_calc_rules_ != no_rules) { + // dst + ss << dst_zone_abbrev(); + // dst offset + if(dst_offset().is_negative()) { + // inverting the sign guarantees we get two digits + ss << '-' << std::setw(2) << dst_offset().invert_sign().hours(); + } + else { + ss << '+' << std::setw(2) << dst_offset().hours(); + } + if(dst_offset().minutes() != 0 || dst_offset().seconds() != 0) { + ss << ':' << std::setw(2) << dst_offset().minutes(); + if(dst_offset().seconds() != 0) { + ss << ':' << std::setw(2) << dst_offset().seconds(); + } + } + // start/time + ss << ',' << date_time::convert_string_type(dst_calc_rules_->start_rule_as_string()) << '/' + << std::setw(2) << dst_offsets_.dst_start_offset_.hours() << ':' + << std::setw(2) << dst_offsets_.dst_start_offset_.minutes(); + if(dst_offsets_.dst_start_offset_.seconds() != 0) { + ss << ':' << std::setw(2) << dst_offsets_.dst_start_offset_.seconds(); + } + // end/time + ss << ',' << date_time::convert_string_type(dst_calc_rules_->end_rule_as_string()) << '/' + << std::setw(2) << dst_offsets_.dst_end_offset_.hours() << ':' + << std::setw(2) << dst_offsets_.dst_end_offset_.minutes(); + if(dst_offsets_.dst_end_offset_.seconds() != 0) { + ss << ':' << std::setw(2) << dst_offsets_.dst_end_offset_.seconds(); + } + } + + return ss.str(); + } + private: + time_zone_names zone_names_; + bool has_dst_; + time_duration_type base_utc_offset_; + dst_adjustment_offsets dst_offsets_; + boost::shared_ptr dst_calc_rules_; + }; + + typedef custom_time_zone_base custom_time_zone; + +} }//namespace + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/date_duration_operators.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/date_duration_operators.hpp new file mode 100644 index 0000000000..ee870227a9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/date_duration_operators.hpp @@ -0,0 +1,115 @@ +#ifndef LOCAL_TIME_DATE_DURATION_OPERATORS_HPP___ +#define LOCAL_TIME_DATE_DURATION_OPERATORS_HPP___ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or + * http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/greg_duration_types.hpp" +#include "boost/date_time/local_time/local_date_time.hpp" + +namespace boost { +namespace local_time { + + /*!@file date_duration_operators.hpp Operators for local_date_time and + * optional gregorian types. Operators use snap-to-end-of-month behavior. + * Further details on this behavior can be found in reference for + * date_time/date_duration_types.hpp and documentation for + * month and year iterators. + */ + + + /*! Adds a months object and a local_date_time. Result will be same + * day-of-month as local_date_time unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + local_date_time + operator+(const local_date_time& t, const boost::gregorian::months& m) + { + return t + m.get_offset(t.utc_time().date()); + } + + /*! Adds a months object to a local_date_time. Result will be same + * day-of-month as local_date_time unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + local_date_time + operator+=(local_date_time& t, const boost::gregorian::months& m) + { + return t += m.get_offset(t.utc_time().date()); + } + + /*! Subtracts a months object and a local_date_time. Result will be same + * day-of-month as local_date_time unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + local_date_time + operator-(const local_date_time& t, const boost::gregorian::months& m) + { + // get_neg_offset returns a negative duration, so we add + return t + m.get_neg_offset(t.utc_time().date()); + } + + /*! Subtracts a months object from a local_date_time. Result will be same + * day-of-month as local_date_time unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + local_date_time + operator-=(local_date_time& t, const boost::gregorian::months& m) + { + // get_neg_offset returns a negative duration, so we add + return t += m.get_neg_offset(t.utc_time().date()); + } + + // local_date_time & years + + /*! Adds a years object and a local_date_time. Result will be same + * month and day-of-month as local_date_time unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + local_date_time + operator+(const local_date_time& t, const boost::gregorian::years& y) + { + return t + y.get_offset(t.utc_time().date()); + } + + /*! Adds a years object to a local_date_time. Result will be same + * month and day-of-month as local_date_time unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + local_date_time + operator+=(local_date_time& t, const boost::gregorian::years& y) + { + return t += y.get_offset(t.utc_time().date()); + } + + /*! Subtracts a years object and a local_date_time. Result will be same + * month and day-of-month as local_date_time unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + local_date_time + operator-(const local_date_time& t, const boost::gregorian::years& y) + { + // get_neg_offset returns a negative duration, so we add + return t + y.get_neg_offset(t.utc_time().date()); + } + + /*! Subtracts a years object from a local_date_time. Result will be same + * month and day-of-month as local_date_time unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + local_date_time + operator-=(local_date_time& t, const boost::gregorian::years& y) + { + // get_neg_offset returns a negative duration, so we add + return t += y.get_neg_offset(t.utc_time().date()); + } + + +}} // namespaces + +#endif // LOCAL_TIME_DATE_DURATION_OPERATORS_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/dst_transition_day_rules.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/dst_transition_day_rules.hpp new file mode 100644 index 0000000000..3d6cfbacf4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/dst_transition_day_rules.hpp @@ -0,0 +1,77 @@ +#ifndef LOCAL_TIME_DST_TRANSITION_DAY_RULES_HPP__ +#define LOCAL_TIME_DST_TRANSITION_DAY_RULES_HPP__ + +/* Copyright (c) 2003-2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/dst_transition_generators.hpp" + +namespace boost { +namespace local_time { + + //! Provides rule of the form starting Apr 30 ending Oct 21 + typedef date_time::dst_day_calc_rule dst_calc_rule; + + struct partial_date_rule_spec + { + typedef gregorian::date date_type; + typedef gregorian::partial_date start_rule; + typedef gregorian::partial_date end_rule; + }; + + //! Provides rule of the form first Sunday in April, last Saturday in Oct + typedef date_time::day_calc_dst_rule partial_date_dst_rule; + + struct first_last_rule_spec + { + typedef gregorian::date date_type; + typedef gregorian::first_kday_of_month start_rule; + typedef gregorian::last_kday_of_month end_rule; + }; + + //! Provides rule of the form first Sunday in April, last Saturday in Oct + typedef date_time::day_calc_dst_rule first_last_dst_rule; + + struct last_last_rule_spec + { + typedef gregorian::date date_type; + typedef gregorian::last_kday_of_month start_rule; + typedef gregorian::last_kday_of_month end_rule; + }; + + //! Provides rule of the form last Sunday in April, last Saturday in Oct + typedef date_time::day_calc_dst_rule last_last_dst_rule; + + struct nth_last_rule_spec + { + typedef gregorian::date date_type; + typedef gregorian::nth_kday_of_month start_rule; + typedef gregorian::last_kday_of_month end_rule; + }; + + //! Provides rule in form of [1st|2nd|3rd|4th] Sunday in April, last Sunday in Oct + typedef date_time::day_calc_dst_rule nth_last_dst_rule; + + struct nth_kday_rule_spec + { + typedef gregorian::date date_type; + typedef gregorian::nth_kday_of_month start_rule; + typedef gregorian::nth_kday_of_month end_rule; + }; + + //! Provides rule in form of [1st|2nd|3rd|4th] Sunday in April/October + typedef date_time::day_calc_dst_rule nth_kday_dst_rule; + //! Provides rule in form of [1st|2nd|3rd|4th] Sunday in April/October + typedef date_time::day_calc_dst_rule nth_day_of_the_week_in_month_dst_rule; + + +} }//namespace + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_date_time.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_date_time.hpp new file mode 100644 index 0000000000..d1967fe242 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_date_time.hpp @@ -0,0 +1,525 @@ +#ifndef LOCAL_TIME_LOCAL_DATE_TIME_HPP__ +#define LOCAL_TIME_LOCAL_DATE_TIME_HPP__ + +/* Copyright (c) 2003-2005 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/time.hpp" +#include "boost/date_time/posix_time/posix_time.hpp" //todo remove? +#include "boost/shared_ptr.hpp" +#include "boost/date_time/dst_rules.hpp" +#include "boost/date_time/time_zone_base.hpp" +#include "boost/date_time/special_defs.hpp" +#include +#include + +namespace boost { +namespace local_time { + + //! simple exception for reporting when STD or DST cannot be determined + struct ambiguous_result : public std::logic_error + { + ambiguous_result (std::string _msg="") : + std::logic_error(std::string("Daylight Savings Results are ambiguous: " + _msg)) {} + }; + //! simple exception for when time label given cannot exist + struct time_label_invalid : public std::logic_error + { + time_label_invalid (std::string _msg="") : + std::logic_error(std::string("Time label given is invalid: " + _msg)) {} + }; + struct dst_not_valid: public std::logic_error + { + dst_not_valid(std::string _msg="") : + std::logic_error(std::string("is_dst flag does not match resulting dst for time label given: " + _msg)) {} + }; + + //TODO: I think these should be in local_date_time_base and not + // necessarily brought into the namespace + using date_time::time_is_dst_result; + using date_time::is_in_dst; + using date_time::is_not_in_dst; + using date_time::ambiguous; + using date_time::invalid_time_label; + + //! Representation of "wall-clock" time in a particular time zone + /*! Representation of "wall-clock" time in a particular time zone + * Local_date_time_base holds a time value (date and time offset from 00:00) + * along with a time zone. The time value is stored as UTC and conversions + * to wall clock time are made as needed. This approach allows for + * operations between wall-clock times in different time zones, and + * daylight savings time considerations, to be made. Time zones are + * required to be in the form of a boost::shared_ptr. + */ + template > + class local_date_time_base : public date_time::base_time { + public: + typedef utc_time_ utc_time_type; + typedef typename utc_time_type::time_duration_type time_duration_type; + typedef typename utc_time_type::date_type date_type; + typedef typename date_type::duration_type date_duration_type; + typedef typename utc_time_type::time_system_type time_system_type; + /*! This constructor interprets the passed time as a UTC time. + * So, for example, if the passed timezone is UTC-5 then the + * time will be adjusted back 5 hours. The time zone allows for + * automatic calculation of whether the particular time is adjusted for + * daylight savings, etc. + * If the time zone shared pointer is null then time stays unadjusted. + *@param t A UTC time + *@param tz Timezone for to adjust the UTC time to. + */ + local_date_time_base(utc_time_type t, + boost::shared_ptr tz) : + date_time::base_time(t), + zone_(tz) + { + // param was already utc so nothing more to do + } + + /*! This constructs a local time -- the passed time information + * understood to be in the passed tz. The DST flag must be passed + * to indicate whether the time is in daylight savings or not. + * @throws -- time_label_invalid if the time passed does not exist in + * the given locale. The non-existent case occurs typically + * during the shift-back from daylight savings time. When + * the clock is shifted forward a range of times + * (2 am to 3 am in the US) is skipped and hence is invalid. + * @throws -- dst_not_valid if the DST flag is passed for a period + * where DST is not active. + */ + local_date_time_base(date_type d, + time_duration_type td, + boost::shared_ptr tz, + bool dst_flag) : //necessary for constr_adj() + date_time::base_time(construction_adjustment(utc_time_type(d, td), tz, dst_flag)), + zone_(tz) + { + if(tz != boost::shared_ptr() && tz->has_dst()){ + + // d & td are already local so we use them + time_is_dst_result result = check_dst(d, td, tz); + bool in_dst = (result == is_in_dst); // less processing than is_dst() + + // ambig occurs at end, invalid at start + if(result == invalid_time_label){ + // Ex: 2:15am local on trans-in day in nyc, dst_flag irrelevant + std::stringstream ss; + ss << "time given: " << d << ' ' << td; + throw time_label_invalid(ss.str()); + } + else if(result != ambiguous && in_dst != dst_flag){ + // is dst_flag accurate? + // Ex: false flag in NYC in June + std::stringstream ss; + ss << "flag given: " << (dst_flag ? "dst=true" : "dst=false") + << ", dst calculated: " << (in_dst ? "dst=true" : "dst=false"); + throw dst_not_valid(ss.str()); + } + + // everything checks out and conversion to utc already done + } + } + + //TODO maybe not the right set...Ignore the last 2 for now... + enum DST_CALC_OPTIONS { EXCEPTION_ON_ERROR, NOT_DATE_TIME_ON_ERROR }; + //ASSUME_DST_ON_ERROR, ASSUME_NOT_DST_ON_ERROR }; + + /*! This constructs a local time -- the passed time information + * understood to be in the passed tz. The DST flag is calculated + * according to the specified rule. + */ + local_date_time_base(date_type d, + time_duration_type td, + boost::shared_ptr tz, + DST_CALC_OPTIONS calc_option) : + // dummy value - time_ is set in constructor code + date_time::base_time(utc_time_type(d,td)), + zone_(tz) + { + time_is_dst_result result = check_dst(d, td, tz); + if(result == ambiguous) { + if(calc_option == EXCEPTION_ON_ERROR){ + std::stringstream ss; + ss << "time given: " << d << ' ' << td; + throw ambiguous_result(ss.str()); + } + else{ // NADT on error + this->time_ = posix_time::posix_time_system::get_time_rep(date_type(date_time::not_a_date_time), time_duration_type(date_time::not_a_date_time)); + } + } + else if(result == invalid_time_label){ + if(calc_option == EXCEPTION_ON_ERROR){ + std::stringstream ss; + ss << "time given: " << d << ' ' << td; + throw time_label_invalid(ss.str()); + } + else{ // NADT on error + this->time_ = posix_time::posix_time_system::get_time_rep(date_type(date_time::not_a_date_time), time_duration_type(date_time::not_a_date_time)); + } + } + else if(result == is_in_dst){ + utc_time_type t = + construction_adjustment(utc_time_type(d, td), tz, true); + this->time_ = posix_time::posix_time_system::get_time_rep(t.date(), + t.time_of_day()); + } + else{ + utc_time_type t = + construction_adjustment(utc_time_type(d, td), tz, false); + this->time_ = posix_time::posix_time_system::get_time_rep(t.date(), + t.time_of_day()); + } + } + + + //! Determines if given time label is in daylight savings for given zone + /*! Determines if given time label is in daylight savings for given zone. + * Takes a date and time_duration representing a local time, along + * with time zone, and returns a time_is_dst_result object as result. + */ + static time_is_dst_result check_dst(date_type d, + time_duration_type td, + boost::shared_ptr tz) + { + if(tz != boost::shared_ptr() && tz->has_dst()) { + typedef typename date_time::dst_calculator dst_calculator; + return dst_calculator::local_is_dst( + d, td, + tz->dst_local_start_time(d.year()).date(), + tz->dst_local_start_time(d.year()).time_of_day(), + tz->dst_local_end_time(d.year()).date(), + tz->dst_local_end_time(d.year()).time_of_day(), + tz->dst_offset() + ); + } + else{ + return is_not_in_dst; + } + } + + //! Simple destructor, releases time zone if last referrer + ~local_date_time_base() {}; + + //! Copy constructor + local_date_time_base(const local_date_time_base& rhs) : + date_time::base_time(rhs), + zone_(rhs.zone_) + {} + + //! Special values constructor + explicit local_date_time_base(const boost::date_time::special_values sv, + boost::shared_ptr tz = boost::shared_ptr()) : + date_time::base_time(utc_time_type(sv)), + zone_(tz) + {} + + //! returns time zone associated with calling instance + boost::shared_ptr zone() const + { + return zone_; + } + //! returns false is time_zone is NULL and if time value is a special_value + bool is_dst() const + { + if(zone_ != boost::shared_ptr() && zone_->has_dst() && !this->is_special()) { + // check_dst takes a local time, *this is utc + utc_time_type lt(this->time_); + lt += zone_->base_utc_offset(); + // dst_offset only needs to be considered with ambiguous time labels + // make that adjustment there + + switch(check_dst(lt.date(), lt.time_of_day(), zone_)){ + case is_not_in_dst: + return false; + case is_in_dst: + return true; + case ambiguous: + if(lt + zone_->dst_offset() < zone_->dst_local_end_time(lt.date().year())) { + return true; + } + break; + case invalid_time_label: + if(lt >= zone_->dst_local_start_time(lt.date().year())) { + return true; + } + break; + } + } + return false; + } + //! Returns object's time value as a utc representation + utc_time_type utc_time() const + { + return utc_time_type(this->time_); + } + //! Returns object's time value as a local representation + utc_time_type local_time() const + { + if(zone_ != boost::shared_ptr()){ + utc_time_type lt = this->utc_time() + zone_->base_utc_offset(); + if (is_dst()) { + lt += zone_->dst_offset(); + } + return lt; + } + return utc_time_type(this->time_); + } + //! Returns string in the form "2003-Aug-20 05:00:00 EDT" + /*! Returns string in the form "2003-Aug-20 05:00:00 EDT". If + * time_zone is NULL the time zone abbreviation will be "UTC". The time + * zone abbrev will not be included if calling object is a special_value*/ + std::string to_string() const + { + //TODO is this a temporary function ??? + std::stringstream ss; + if(this->is_special()){ + ss << utc_time(); + return ss.str(); + } + if(zone_ == boost::shared_ptr()) { + ss << utc_time() << " UTC"; + return ss.str(); + } + bool is_dst_ = is_dst(); + utc_time_type lt = this->utc_time() + zone_->base_utc_offset(); + if (is_dst_) { + lt += zone_->dst_offset(); + } + ss << local_time() << " "; + if (is_dst()) { + ss << zone_->dst_zone_abbrev(); + } + else { + ss << zone_->std_zone_abbrev(); + } + return ss.str(); + } + /*! returns a local_date_time_base in the given time zone with the + * optional time_duration added. */ + local_date_time_base local_time_in(boost::shared_ptr new_tz, + time_duration_type td=time_duration_type(0,0,0)) const + { + return local_date_time_base(utc_time_type(this->time_) + td, new_tz); + } + + //! Returns name of associated time zone or "Coordinated Universal Time". + /*! Optional bool parameter will return time zone as an offset + * (ie "+07:00" extended iso format). Empty string is returned for + * classes that do not use a time_zone */ + std::string zone_name(bool as_offset=false) const + { + if(zone_ == boost::shared_ptr()) { + if(as_offset) { + return std::string("Z"); + } + else { + return std::string("Coordinated Universal Time"); + } + } + if (is_dst()) { + if(as_offset) { + time_duration_type td = zone_->base_utc_offset(); + td += zone_->dst_offset(); + return zone_as_offset(td, ":"); + } + else { + return zone_->dst_zone_name(); + } + } + else { + if(as_offset) { + time_duration_type td = zone_->base_utc_offset(); + return zone_as_offset(td, ":"); + } + else { + return zone_->std_zone_name(); + } + } + } + //! Returns abbreviation of associated time zone or "UTC". + /*! Optional bool parameter will return time zone as an offset + * (ie "+0700" iso format). Empty string is returned for classes + * that do not use a time_zone */ + std::string zone_abbrev(bool as_offset=false) const + { + if(zone_ == boost::shared_ptr()) { + if(as_offset) { + return std::string("Z"); + } + else { + return std::string("UTC"); + } + } + if (is_dst()) { + if(as_offset) { + time_duration_type td = zone_->base_utc_offset(); + td += zone_->dst_offset(); + return zone_as_offset(td, ""); + } + else { + return zone_->dst_zone_abbrev(); + } + } + else { + if(as_offset) { + time_duration_type td = zone_->base_utc_offset(); + return zone_as_offset(td, ""); + } + else { + return zone_->std_zone_abbrev(); + } + } + } + + //! returns a posix_time_zone string for the associated time_zone. If no time_zone, "UTC+00" is returned. + std::string zone_as_posix_string() const + { + if(zone_ == shared_ptr()) { + return std::string("UTC+00"); + } + return zone_->to_posix_string(); + } + + //! Equality comparison operator + /*bool operator==(const date_time::base_time& rhs) const + { // fails due to rhs.time_ being protected + return date_time::base_time::operator==(rhs); + //return this->time_ == rhs.time_; + }*/ + //! Equality comparison operator + bool operator==(const local_date_time_base& rhs) const + { + return time_system_type::is_equal(this->time_, rhs.time_); + } + //! Non-Equality comparison operator + bool operator!=(const local_date_time_base& rhs) const + { + return !(*this == rhs); + } + //! Less than comparison operator + bool operator<(const local_date_time_base& rhs) const + { + return time_system_type::is_less(this->time_, rhs.time_); + } + //! Less than or equal to comparison operator + bool operator<=(const local_date_time_base& rhs) const + { + return (*this < rhs || *this == rhs); + } + //! Greater than comparison operator + bool operator>(const local_date_time_base& rhs) const + { + return !(*this <= rhs); + } + //! Greater than or equal to comparison operator + bool operator>=(const local_date_time_base& rhs) const + { + return (*this > rhs || *this == rhs); + } + + //! Local_date_time + date_duration + local_date_time_base operator+(const date_duration_type& dd) const + { + return local_date_time_base(time_system_type::add_days(this->time_,dd), zone_); + } + //! Local_date_time += date_duration + local_date_time_base operator+=(const date_duration_type& dd) + { + this->time_ = time_system_type::add_days(this->time_,dd); + return *this; + } + //! Local_date_time - date_duration + local_date_time_base operator-(const date_duration_type& dd) const + { + return local_date_time_base(time_system_type::subtract_days(this->time_,dd), zone_); + } + //! Local_date_time -= date_duration + local_date_time_base operator-=(const date_duration_type& dd) + { + this->time_ = time_system_type::subtract_days(this->time_,dd); + return *this; + } + //! Local_date_time + time_duration + local_date_time_base operator+(const time_duration_type& td) const + { + return local_date_time_base(time_system_type::add_time_duration(this->time_,td), zone_); + } + //! Local_date_time += time_duration + local_date_time_base operator+=(const time_duration_type& td) + { + this->time_ = time_system_type::add_time_duration(this->time_,td); + return *this; + } + //! Local_date_time - time_duration + local_date_time_base operator-(const time_duration_type& td) const + { + return local_date_time_base(time_system_type::subtract_time_duration(this->time_,td), zone_); + } + //! Local_date_time -= time_duration + local_date_time_base operator-=(const time_duration_type& td) + { + this->time_ = time_system_type::subtract_time_duration(this->time_,td); + return *this; + } + //! local_date_time -= local_date_time --> time_duration_type + time_duration_type operator-(const local_date_time_base& rhs) const + { + return utc_time_type(this->time_) - utc_time_type(rhs.time_); + } + private: + boost::shared_ptr zone_; + //bool is_dst_; + + /*! Adjust the passed in time to UTC? + */ + utc_time_type construction_adjustment(utc_time_type t, + boost::shared_ptr z, + bool dst_flag) + { + if(z != boost::shared_ptr()) { + if(dst_flag && z->has_dst()) { + t -= z->dst_offset(); + } // else no adjust + t -= z->base_utc_offset(); + } + return t; + } + + /*! Simple formatting code -- todo remove this? + */ + std::string zone_as_offset(const time_duration_type& td, + const std::string& separator) const + { + std::stringstream ss; + if(td.is_negative()) { + // a negative duration is represented as "-[h]h:mm" + // we require two digits for the hour. A positive duration + // with the %H flag will always give two digits + ss << "-"; + } + else { + ss << "+"; + } + ss << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.hours()) + << separator + << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.minutes()); + return ss.str(); + } + }; + + //!Use the default parameters to define local_date_time + typedef local_date_time_base<> local_date_time; + +} } + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time.hpp new file mode 100644 index 0000000000..f7d4cc68e3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time.hpp @@ -0,0 +1,24 @@ +#ifndef LOCAL_TIME_LOCAL_TIME_HPP__ +#define LOCAL_TIME_LOCAL_TIME_HPP__ + +/* Copyright (c) 2003-2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/posix_time/posix_time.hpp" +#include "boost/date_time/local_time/local_date_time.hpp" +#include "boost/date_time/local_time/local_time_types.hpp" +#if !defined(USE_DATE_TIME_PRE_1_33_FACET_IO) +#include "boost/date_time/local_time/local_time_io.hpp" +#endif // USE_DATE_TIME_PRE_1_33_FACET_IO +#include "boost/date_time/local_time/posix_time_zone.hpp" +#include "boost/date_time/local_time/custom_time_zone.hpp" +#include "boost/date_time/local_time/tz_database.hpp" +#include "boost/date_time/local_time/conversion.hpp" +#include "boost/date_time/time_zone_base.hpp" + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time_io.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time_io.hpp new file mode 100644 index 0000000000..fbd34b6f98 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time_io.hpp @@ -0,0 +1,118 @@ +#ifndef BOOST_DATE_TIME_LOCAL_TIME_IO_HPP__ +#define BOOST_DATE_TIME_LOCAL_TIME_IO_HPP__ + +/* Copyright (c) 2003-2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include "boost/date_time/local_time/local_date_time.hpp" +#include "boost/date_time/local_time/posix_time_zone.hpp" +#include "boost/date_time/time_facet.hpp" +#include "boost/date_time/string_convert.hpp" +#include "boost/io/ios_state.hpp" + +namespace boost { +namespace local_time { + + typedef boost::date_time::time_facet wlocal_time_facet; + typedef boost::date_time::time_facet local_time_facet; + + typedef boost::date_time::time_input_facet wlocal_time_input_facet; + typedef boost::date_time::time_input_facet local_time_input_facet; + + //! operator<< for local_date_time - see local_time docs for formatting details + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const local_date_time& ldt) + { + boost::io::ios_flags_saver iflags(os); + typedef local_date_time time_type;//::utc_time_type typename + typedef date_time::time_facet custom_time_facet; + typedef std::time_put std_time_facet; + std::ostreambuf_iterator oitr(os); + + if(std::has_facet(os.getloc())) { + std::use_facet(os.getloc()).put(oitr, + os, + os.fill(), + ldt); + } + else { + custom_time_facet* f = new custom_time_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(oitr, os, os.fill(), ldt); + } + + return os; + } + + + //! input operator for local_date_time + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, local_date_time& ldt) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename local_date_time::utc_time_type utc_time_type; + typedef typename date_time::time_input_facet time_input_facet; + + // intermediate objects + std::basic_string tz_str; + utc_time_type pt(not_a_date_time); + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get_local_time(sit, str_end, is, pt, tz_str); + } + else { + time_input_facet* f = new time_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get_local_time(sit, str_end, is, pt, tz_str); + } + if(tz_str.empty()) { + time_zone_ptr null_ptr; + // a null time_zone_ptr creates a local_date_time that is UTC + ldt = local_date_time(pt, null_ptr); + } + else { + time_zone_ptr tz_ptr(new posix_time_zone(date_time::convert_string_type(tz_str))); + // the "date & time" constructor expects the time label to *not* be utc. + // a posix_tz_string also expects the time label to *not* be utc. + ldt = local_date_time(pt.date(), pt.time_of_day(), tz_ptr, local_date_time::EXCEPTION_ON_ERROR); + } + } + catch(...) { + // mask tells us what exceptions are turned on + std::ios_base::iostate exception_mask = is.exceptions(); + // if the user wants exceptions on failbit, we'll rethrow our + // date_time exception & set the failbit + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} // ignore this one + throw; // rethrow original exception + } + else { + // if the user want's to fail quietly, we simply set the failbit + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + +} } // namespaces + +#endif // BOOST_DATE_TIME_LOCAL_TIME_IO_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time_types.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time_types.hpp new file mode 100644 index 0000000000..ed58b8018a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/local_time_types.hpp @@ -0,0 +1,52 @@ +#ifndef LOCAL_TIME_LOCAL_TIME_TYPES_HPP__ +#define LOCAL_TIME_LOCAL_TIME_TYPES_HPP__ + +/* Copyright (c) 2003-2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/local_time/local_date_time.hpp" +#include "boost/date_time/period.hpp" +#include "boost/date_time/time_iterator.hpp" +#include "boost/date_time/compiler_config.hpp" +#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES) +#include "boost/date_time/local_time/date_duration_operators.hpp" +#endif //BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES +#include "boost/date_time/local_time/custom_time_zone.hpp" + +namespace boost { +namespace local_time { + + typedef boost::date_time::period local_time_period; + + typedef date_time::time_itr local_time_iterator; + + typedef date_time::second_clock local_sec_clock; + typedef date_time::microsec_clock local_microsec_clock; + + typedef date_time::time_zone_base time_zone; + typedef date_time::time_zone_base wtime_zone; + + //! Shared Pointer for custom_time_zone and posix_time_zone objects + typedef boost::shared_ptr time_zone_ptr; + typedef boost::shared_ptr wtime_zone_ptr; + + typedef date_time::time_zone_names_base time_zone_names; + typedef date_time::time_zone_names_base wtime_zone_names; + + //bring special enum values into the namespace + using date_time::special_values; + using date_time::not_special; + using date_time::neg_infin; + using date_time::pos_infin; + using date_time::not_a_date_time; + using date_time::max_date_time; + using date_time::min_date_time; + +}} // namespaces + +#endif // LOCAL_TIME_LOCAL_TIME_TYPES_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/posix_time_zone.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/posix_time_zone.hpp new file mode 100644 index 0000000000..c8f0fb798a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/posix_time_zone.hpp @@ -0,0 +1,443 @@ +#ifndef _DATE_TIME_POSIX_TIME_ZONE__ +#define _DATE_TIME_POSIX_TIME_ZONE__ + +/* Copyright (c) 2003-2005 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include +#include "boost/date_time/gregorian/gregorian.hpp" +#include "boost/date_time/time_zone_names.hpp" +#include "boost/date_time/time_zone_base.hpp" +#include "boost/date_time/local_time/dst_transition_day_rules.hpp" +#include "boost/date_time/posix_time/posix_time.hpp" +#include "boost/date_time/string_convert.hpp" +#include "boost/date_time/time_parsing.hpp" +#include "boost/tokenizer.hpp" +#include + +namespace boost{ +namespace local_time{ + + //! simple exception for UTC and Daylight savings start/end offsets + struct bad_offset : public std::out_of_range + { + bad_offset(std::string _msg="") : std::out_of_range(std::string("Offset out of range: " + _msg)) {} + }; + //! simple exception for UTC daylight savings adjustment + struct bad_adjustment : public std::out_of_range + { + bad_adjustment(std::string _msg="") : std::out_of_range(std::string("Adjustment out of range: " + _msg)) {} + }; + + typedef boost::date_time::dst_adjustment_offsets dst_adjustment_offsets; + + //! A time zone class constructed from a POSIX time zone string + /*! A POSIX time zone string takes the form of:
+ * "std offset dst [offset],start[/time],end[/time]" (w/no spaces) + * 'std' specifies the abbrev of the time zone.
+ * 'offset' is the offset from UTC.
+ * 'dst' specifies the abbrev of the time zone during daylight savings time.
+ * The second offset is how many hours changed during DST. Default=1
+ * 'start' and'end' are the dates when DST goes into (and out of) effect.
+ * 'offset' takes the form of: [+|-]hh[:mm[:ss]] {h=0-23, m/s=0-59}
+ * 'time' and 'offset' take the same form. Time defaults=02:00:00
+ * 'start' and 'end' can be one of three forms:
+ * Mm.w.d {month=1-12, week=1-5 (5 is always last), day=0-6}
+ * Jn {n=1-365 Feb29 is never counted}
+ * n {n=0-365 Feb29 is counted in leap years}
+ * Example "PST-5PDT01:00:00,M4.1.0/02:00:00,M10.1.0/02:00:00" + *
+ * Exceptions will be thrown under these conditions:
+ * An invalid date spec (see date class)
+ * A boost::local_time::bad_offset exception will be thrown for:
+ * A DST start or end offset that is negative or more than 24 hours
+ * A UTC zone that is greater than +12 or less than -12 hours
+ * A boost::local_time::bad_adjustment exception will be thrown for:
+ * A DST adjustment that is 24 hours or more (positive or negative)
+ */ + template + class posix_time_zone_base : public date_time::time_zone_base { + public: + typedef boost::posix_time::time_duration time_duration_type; + typedef date_time::time_zone_names_base time_zone_names; + typedef date_time::time_zone_base base_type; + typedef typename base_type::string_type string_type; + typedef CharT char_type; + typedef typename base_type::stringstream_type stringstream_type; + typedef boost::char_separator > char_separator_type; + typedef boost::tokenizer tokenizer_type; + typedef typename boost::tokenizer::iterator tokenizer_iterator_type; + + //! Construct from a POSIX time zone string + posix_time_zone_base(const string_type& s) : + //zone_names_("std_name","std_abbrev","no-dst","no-dst"), + zone_names_(), + has_dst_(false), + base_utc_offset_(posix_time::hours(0)), + dst_offsets_(posix_time::hours(0),posix_time::hours(0),posix_time::hours(0)), + dst_calc_rules_() + { + const char_type sep_chars[2] = {','}; + char_separator_type sep(sep_chars); + tokenizer_type tokens(s, sep); + tokenizer_iterator_type it = tokens.begin(); + calc_zone(*it++); + if(has_dst_){ + string_type tmp_str = *it++; + calc_rules(tmp_str, *it); + } + } + virtual ~posix_time_zone_base() {}; + //!String for the zone when not in daylight savings (eg: EST) + virtual string_type std_zone_abbrev()const + { + return zone_names_.std_zone_abbrev(); + } + //!String for the timezone when in daylight savings (eg: EDT) + /*! For those time zones that have no DST, an empty string is used */ + virtual string_type dst_zone_abbrev() const + { + return zone_names_.dst_zone_abbrev(); + } + //!String for the zone when not in daylight savings (eg: Eastern Standard Time) + /*! The full STD name is not extracted from the posix time zone string. + * Therefore, the STD abbreviation is used in it's place */ + virtual string_type std_zone_name()const + { + return zone_names_.std_zone_name(); + } + //!String for the timezone when in daylight savings (eg: Eastern Daylight Time) + /*! The full DST name is not extracted from the posix time zone string. + * Therefore, the STD abbreviation is used in it's place. For time zones + * that have no DST, an empty string is used */ + virtual string_type dst_zone_name()const + { + return zone_names_.dst_zone_name(); + } + //! True if zone uses daylight savings adjustments otherwise false + virtual bool has_dst()const + { + return has_dst_; + } + //! Local time that DST starts -- NADT if has_dst is false + virtual posix_time::ptime dst_local_start_time(gregorian::greg_year y)const + { + gregorian::date d(gregorian::not_a_date_time); + if(has_dst_) + { + d = dst_calc_rules_->start_day(y); + } + return posix_time::ptime(d, dst_offsets_.dst_start_offset_); + } + //! Local time that DST ends -- NADT if has_dst is false + virtual posix_time::ptime dst_local_end_time(gregorian::greg_year y)const + { + gregorian::date d(gregorian::not_a_date_time); + if(has_dst_) + { + d = dst_calc_rules_->end_day(y); + } + return posix_time::ptime(d, dst_offsets_.dst_end_offset_); + } + //! Base offset from UTC for zone (eg: -07:30:00) + virtual time_duration_type base_utc_offset()const + { + return base_utc_offset_; + } + //! Adjustment forward or back made while DST is in effect + virtual time_duration_type dst_offset()const + { + return dst_offsets_.dst_adjust_; + } + + //! Returns a POSIX time_zone string for this object + virtual string_type to_posix_string() const + { + // std offset dst [offset],start[/time],end[/time] - w/o spaces + stringstream_type ss; + ss.fill('0'); + boost::shared_ptr no_rules; + // std + ss << std_zone_abbrev(); + // offset + if(base_utc_offset().is_negative()) { + // inverting the sign guarantees we get two digits + ss << '-' << std::setw(2) << base_utc_offset().invert_sign().hours(); + } + else { + ss << '+' << std::setw(2) << base_utc_offset().hours(); + } + if(base_utc_offset().minutes() != 0 || base_utc_offset().seconds() != 0) { + ss << ':' << std::setw(2) << base_utc_offset().minutes(); + if(base_utc_offset().seconds() != 0) { + ss << ':' << std::setw(2) << base_utc_offset().seconds(); + } + } + if(dst_calc_rules_ != no_rules) { + // dst + ss << dst_zone_abbrev(); + // dst offset + if(dst_offset().is_negative()) { + // inverting the sign guarantees we get two digits + ss << '-' << std::setw(2) << dst_offset().invert_sign().hours(); + } + else { + ss << '+' << std::setw(2) << dst_offset().hours(); + } + if(dst_offset().minutes() != 0 || dst_offset().seconds() != 0) { + ss << ':' << std::setw(2) << dst_offset().minutes(); + if(dst_offset().seconds() != 0) { + ss << ':' << std::setw(2) << dst_offset().seconds(); + } + } + // start/time + ss << ',' << date_time::convert_string_type(dst_calc_rules_->start_rule_as_string()) << '/' + << std::setw(2) << dst_offsets_.dst_start_offset_.hours() << ':' + << std::setw(2) << dst_offsets_.dst_start_offset_.minutes(); + if(dst_offsets_.dst_start_offset_.seconds() != 0) { + ss << ':' << std::setw(2) << dst_offsets_.dst_start_offset_.seconds(); + } + // end/time + ss << ',' << date_time::convert_string_type(dst_calc_rules_->end_rule_as_string()) << '/' + << std::setw(2) << dst_offsets_.dst_end_offset_.hours() << ':' + << std::setw(2) << dst_offsets_.dst_end_offset_.minutes(); + if(dst_offsets_.dst_end_offset_.seconds() != 0) { + ss << ':' << std::setw(2) << dst_offsets_.dst_end_offset_.seconds(); + } + } + + return ss.str(); + } + private: + time_zone_names zone_names_; + bool has_dst_; + time_duration_type base_utc_offset_; + dst_adjustment_offsets dst_offsets_; + boost::shared_ptr dst_calc_rules_; + + /*! Extract time zone abbreviations for STD & DST as well + * as the offsets for the time shift that occurs and how + * much of a shift. At this time full time zone names are + * NOT extracted so the abbreviations are used in their place */ + void calc_zone(const string_type& obj){ + const char_type empty_string[2] = {'\0'}; + stringstream_type ss(empty_string); + typename string_type::const_iterator sit = obj.begin(); + string_type l_std_zone_abbrev, l_dst_zone_abbrev; + + // get 'std' name/abbrev + while(std::isalpha(*sit)){ + ss << *sit++; + } + l_std_zone_abbrev = ss.str(); + ss.str(empty_string); + + // get UTC offset + if(sit != obj.end()){ + // get duration + while(sit != obj.end() && !std::isalpha(*sit)){ + ss << *sit++; + } + base_utc_offset_ = date_time::str_from_delimited_time_duration(ss.str()); + ss.str(empty_string); + + // base offset must be within range of -12 hours to +12 hours + if(base_utc_offset_ < time_duration_type(-12,0,0) || + base_utc_offset_ > time_duration_type(12,0,0)) + { + throw bad_offset(posix_time::to_simple_string(base_utc_offset_)); + } + } + + // get DST data if given + if(sit != obj.end()){ + has_dst_ = true; + + // get 'dst' name/abbrev + while(sit != obj.end() && std::isalpha(*sit)){ + ss << *sit++; + } + l_dst_zone_abbrev = ss.str(); + ss.str(empty_string); + + // get DST offset if given + if(sit != obj.end()){ + // get duration + while(sit != obj.end() && !std::isalpha(*sit)){ + ss << *sit++; + } + dst_offsets_.dst_adjust_ = date_time::str_from_delimited_time_duration(ss.str()); + ss.str(empty_string); + } + else{ // default DST offset + dst_offsets_.dst_adjust_ = posix_time::hours(1); + } + + // adjustment must be within +|- 1 day + if(dst_offsets_.dst_adjust_ <= time_duration_type(-24,0,0) || + dst_offsets_.dst_adjust_ >= time_duration_type(24,0,0)) + { + throw bad_adjustment(posix_time::to_simple_string(dst_offsets_.dst_adjust_)); + } + } + // full names not extracted so abbrevs used in their place + zone_names_ = time_zone_names(l_std_zone_abbrev, l_std_zone_abbrev, l_dst_zone_abbrev, l_dst_zone_abbrev); + } + + void calc_rules(const string_type& start, const string_type& end){ + const char_type sep_chars[2] = {'/'}; + char_separator_type sep(sep_chars); + tokenizer_type st_tok(start, sep); + tokenizer_type et_tok(end, sep); + tokenizer_iterator_type sit = st_tok.begin(); + tokenizer_iterator_type eit = et_tok.begin(); + + // generate date spec + char_type x = string_type(*sit).at(0); + if(x == 'M'){ + M_func(*sit, *eit); + } + else if(x == 'J'){ + julian_no_leap(*sit, *eit); + } + else{ + julian_day(*sit, *eit); + } + + ++sit; + ++eit; + // generate durations + // starting offset + if(sit != st_tok.end()){ + dst_offsets_.dst_start_offset_ = date_time::str_from_delimited_time_duration(*sit); + } + else{ + // default + dst_offsets_.dst_start_offset_ = posix_time::hours(2); + } + // start/end offsets must fall on given date + if(dst_offsets_.dst_start_offset_ < time_duration_type(0,0,0) || + dst_offsets_.dst_start_offset_ >= time_duration_type(24,0,0)) + { + throw bad_offset(posix_time::to_simple_string(dst_offsets_.dst_start_offset_)); + } + + // ending offset + if(eit != et_tok.end()){ + dst_offsets_.dst_end_offset_ = date_time::str_from_delimited_time_duration(*eit); + } + else{ + // default + dst_offsets_.dst_end_offset_ = posix_time::hours(2); + } + // start/end offsets must fall on given date + if(dst_offsets_.dst_end_offset_ < time_duration_type(0,0,0) || + dst_offsets_.dst_end_offset_ >= time_duration_type(24,0,0)) + { + throw bad_offset(posix_time::to_simple_string(dst_offsets_.dst_end_offset_)); + } + } + + /* Parses out a start/end date spec from a posix time zone string. + * Date specs come in three possible formats, this function handles + * the 'M' spec. Ex "M2.2.4" => 2nd month, 2nd week, 4th day . + */ + void M_func(const string_type& s, const string_type& e){ + typedef gregorian::nth_kday_of_month nkday; + unsigned short sm=0,sw=0,sd=0,em=0,ew=0,ed=0; // start/end month,week,day + const char_type sep_chars[3] = {'M','.'}; + char_separator_type sep(sep_chars); + tokenizer_type stok(s, sep), etok(e, sep); + + tokenizer_iterator_type it = stok.begin(); + sm = lexical_cast(*it++); + sw = lexical_cast(*it++); + sd = lexical_cast(*it); + + it = etok.begin(); + em = lexical_cast(*it++); + ew = lexical_cast(*it++); + ed = lexical_cast(*it); + + dst_calc_rules_ = shared_ptr( + new nth_kday_dst_rule( + nth_last_dst_rule::start_rule( + static_cast(sw),sd,sm), + nth_last_dst_rule::start_rule( + static_cast(ew),ed,em) + ) + ); + } + + //! Julian day. Feb29 is never counted, even in leap years + // expects range of 1-365 + void julian_no_leap(const string_type& s, const string_type& e){ + typedef gregorian::gregorian_calendar calendar; + const unsigned short year = 2001; // Non-leap year + unsigned short sm=1; + int sd=0; + sd = lexical_cast(s.substr(1)); // skip 'J' + while(sd >= calendar::end_of_month_day(year,sm)){ + sd -= calendar::end_of_month_day(year,sm++); + } + unsigned short em=1; + int ed=0; + ed = lexical_cast(e.substr(1)); // skip 'J' + while(ed > calendar::end_of_month_day(year,em)){ + ed -= calendar::end_of_month_day(year,em++); + } + + dst_calc_rules_ = shared_ptr( + new partial_date_dst_rule( + partial_date_dst_rule::start_rule( + sd, static_cast(sm)), + partial_date_dst_rule::end_rule( + ed, static_cast(em)) + ) + ); + } + + //! Julian day. Feb29 is always counted, but exception thrown in non-leap years + // expects range of 0-365 + void julian_day(const string_type& s, const string_type& e){ + int sd=0, ed=0; + sd = lexical_cast(s); + ed = lexical_cast(e); + dst_calc_rules_ = shared_ptr( + new partial_date_dst_rule( + partial_date_dst_rule::start_rule(++sd),// args are 0-365 + partial_date_dst_rule::end_rule(++ed) // pd expects 1-366 + ) + ); + } + + //! helper function used when throwing exceptions + static std::string td_as_string(const time_duration_type& td) + { + std::string s; +#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) + s = posix_time::to_simple_string(td); +#else + std::stringstream ss; + ss << td; + s = ss.str(); +#endif + return s; + } + }; + + typedef posix_time_zone_base posix_time_zone; + +} } // namespace boost::local_time + + +#endif // _DATE_TIME_POSIX_TIME_ZONE__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/tz_database.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/tz_database.hpp new file mode 100644 index 0000000000..4cfca45c18 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time/tz_database.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_DATE_TIME_TZ_DATABASE_HPP__ +#define BOOST_DATE_TIME_TZ_DATABASE_HPP__ + +/* Copyright (c) 2003-2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include "boost/date_time/local_time/custom_time_zone.hpp" +#include "boost/date_time/local_time/dst_transition_day_rules.hpp" +#include "boost/date_time/tz_db_base.hpp" + + +namespace boost { +namespace local_time { + + using date_time::data_not_accessible; + using date_time::bad_field_count; + + //! Object populated with boost::shared_ptr objects + /*! Object populated with boost::shared_ptr objects + * Database is populated from specs stored in external csv file. See + * date_time::tz_db_base for greater detail */ + typedef date_time::tz_db_base tz_database; + +}} // namespace + +#endif // BOOST_DATE_TIME_TZ_DATABASE_HPP__ + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time_adjustor.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time_adjustor.hpp new file mode 100644 index 0000000000..500a730436 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_time_adjustor.hpp @@ -0,0 +1,213 @@ +#ifndef DATE_TIME_LOCAL_TIME_ADJUSTOR_HPP__ +#define DATE_TIME_LOCAL_TIME_ADJUSTOR_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file local_time_adjustor.hpp + Time adjustment calculations for local times +*/ + +#include "boost/date_time/date_generators.hpp" +#include "boost/date_time/dst_rules.hpp" +#include + +namespace boost { + namespace date_time { + + + //! Provides a base offset adjustment from utc + template + class utc_adjustment + { + public: + static time_duration_type local_to_utc_base_offset() + { + time_duration_type td(hours,minutes,0); + return td.invert_sign(); + } + static time_duration_type utc_to_local_base_offset() + { + return time_duration_type(hours,minutes,0); + } + }; + + + + //! Allow sliding utc adjustment with fixed dst rules + template + class dynamic_local_time_adjustor : public dst_rules + { + public: + typedef typename time_type::time_duration_type time_duration_type; + typedef typename time_type::date_type date_type; + + dynamic_local_time_adjustor(time_duration_type utc_offset) : + utc_offset_(utc_offset) + {} + + //! Presumes local time + time_duration_type utc_offset(bool is_dst) + { + if (is_dst) { + return utc_offset_ + this->dst_offset(); + } + else { + return utc_offset_; + } + + } + private: + time_duration_type utc_offset_; + + }; + + + + //! Embed the rules for local time adjustments at compile time + template + class static_local_time_adjustor: public dst_rules, public utc_offset_rules + { + public: + typedef typename time_type::time_duration_type time_duration_type; + typedef typename time_type::date_type date_type; + + //! Calculates the offset from a utc time to local based on dst and utc offset + /*! @param t UTC time to calculate offset to local time + * This adjustment depends on the following observations about the + * workings of the DST boundary offset. Since UTC time labels are + * monotonically increasing we can determine if a given local time + * is in DST or not and therefore adjust the offset appropriately. + * + * The logic is as follows. Starting with UTC time use the offset to + * create a label for an non-dst adjusted local time. Then call + * dst_rules::local_is_dst with the non adjust local time. The + * results of this function will either unabiguously decide that + * the initial local time is in dst or return an illegal or + * ambiguous result. An illegal result only occurs at the end + * of dst (where labels are skipped) and indicates that dst has + * ended. An ambiguous result means that we need to recheck by + * making a dst adjustment and then rechecking. If the dst offset + * is added to the utc time and the recheck proves non-ambiguous + * then we are past the boundary. If it is still ambiguous then + * we are ahead of the boundary and dst is still in effect. + * + * TODO -- check if all dst offsets are positive. If not then + * the algorithm needs to check for this and reverse the + * illegal/ambiguous logic. + */ + static time_duration_type utc_to_local_offset(const time_type& t) + { + //get initial local time guess by applying utc offset + time_type initial = t + utc_offset_rules::utc_to_local_base_offset(); + time_is_dst_result dst_flag = + dst_rules::local_is_dst(initial.date(), initial.time_of_day()); + switch(dst_flag) { + case is_in_dst: return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset(); + case is_not_in_dst: return utc_offset_rules::utc_to_local_base_offset(); + case invalid_time_label:return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset(); + case ambiguous: { + time_type retry = initial + dst_rules::dst_offset(); + dst_flag = dst_rules::local_is_dst(retry.date(), retry.time_of_day()); + //if still ambibuous then the utc time still translates to a dst time + if (dst_flag == ambiguous) { + return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset(); + } + // we are past the dst boundary + else { + return utc_offset_rules::utc_to_local_base_offset(); + } + } + }//case + //TODO better excpetion type + throw std::out_of_range("Unreachable case"); + + } + + //! Get the offset to UTC given a local time + static time_duration_type local_to_utc_offset(const time_type& t, + date_time::dst_flags dst=date_time::calculate) + { + switch (dst) { + case is_dst: + return utc_offset_rules::local_to_utc_base_offset() - dst_rules::dst_offset(); + case not_dst: + return utc_offset_rules::local_to_utc_base_offset(); + case calculate: + time_is_dst_result res = + dst_rules::local_is_dst(t.date(), t.time_of_day()); + switch(res) { + case is_in_dst: return utc_offset_rules::local_to_utc_base_offset() - dst_rules::dst_offset(); + case is_not_in_dst: return utc_offset_rules::local_to_utc_base_offset(); + case ambiguous: return utc_offset_rules::local_to_utc_base_offset(); + case invalid_time_label: throw std::out_of_range("Time label invalid"); + } + } + throw std::out_of_range("Time label invalid"); + } + + + private: + + }; + + void dummy_to_prevent_msvc6_ice(); //why ask why? + + //! Template that simplifies the creation of local time calculator + /*! Use this template to create the timezone to utc convertors as required. + * + * This class will also work for other regions that don't use dst and + * have a utc offset which is an integral number of hours. + * + * Template Parameters + * -time_type -- Time class to use + * -utc_offset -- Number hours local time is adjust from utc + * -use_dst -- true (default) if region uses dst, false otherwise + * For example: + * @code + * //eastern timezone is utc-5 + typedef date_time::local_adjustor us_eastern; + typedef date_time::local_adjustor us_central; + typedef date_time::local_adjustor us_mountain; + typedef date_time::local_adjustor us_pacific; + typedef date_time::local_adjustor us_arizona; + @endcode + + */ + template + class local_adjustor + { + public: + typedef typename time_type::time_duration_type time_duration_type; + typedef typename time_type::date_type date_type; + typedef static_local_time_adjustor > dst_adjustor; + //! Convert a utc time to local time + static time_type utc_to_local(const time_type& t) + { + time_duration_type td = dst_adjustor::utc_to_local_offset(t); + return t + td; + } + //! Convert a local time to utc + static time_type local_to_utc(const time_type& t, + date_time::dst_flags dst=date_time::calculate) + { + time_duration_type td = dst_adjustor::local_to_utc_offset(t, dst); + return t + td; + } + }; + + + } } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_timezone_defs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_timezone_defs.hpp new file mode 100644 index 0000000000..508fa7f742 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/local_timezone_defs.hpp @@ -0,0 +1,193 @@ +#ifndef DATE_TIME_LOCAL_TIMEZONE_DEFS_HPP__ +#define DATE_TIME_LOCAL_TIMEZONE_DEFS_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/dst_rules.hpp" + +namespace boost { + namespace date_time { + + // Configurations for common dst rules cases: + // See http://www.wharton.co.uk/Support/sup_dst.htm for more + // information on how various locales use dst rules + + //! Specification for daylight savings start rules in US + /*! This class is used to configure dst_calc_engine template typically + as follows: + @code + using namespace boost::gregorian; + using namespace boost::posix_time; + typedef us_dst_trait us_dst_traits; + typedef boost::date_time::dst_calc_engine + us_dst_calc; + //calculate the 2002 transition day of USA April 7 2002 + date dst_start = us_dst_calc::local_dst_start_day(2002); + + //calculate the 2002 transition day of USA Oct 27 2002 + date dst_end = us_dst_calc::local_dst_end_day(2002); + + //check if a local time is in dst or not -- posible answers + //are yes, no, invalid time label, ambiguous + ptime t(...some time...); + if (us_dst::local_is_dst(t.date(), t.time_of_day()) + == boost::date_time::is_not_in_dst) + { + + } + + @endcode + This generates a type suitable for the calculation of dst + transitions for the United States. Of course other templates + can be used for other locales. + + */ + + template + struct us_dst_trait + { + typedef typename date_type::day_of_week_type day_of_week_type; + typedef typename date_type::month_type month_type; + typedef typename date_type::year_type year_type; + typedef date_time::nth_kday_of_month start_rule_functor; + typedef date_time::first_kday_of_month end_rule_functor; + typedef date_time::first_kday_of_month start_rule_functor_pre2007; + typedef date_time::last_kday_of_month end_rule_functor_pre2007; + static day_of_week_type start_day(year_type) {return Sunday;} + static month_type start_month(year_type y) + { + if (y < 2007) return Apr; + return Mar; + } + static day_of_week_type end_day(year_type y) {return Sunday;} + static month_type end_month(year_type y) + { + if (y < 2007) return Oct; + return Nov; + } + static date_type local_dst_start_day(year_type year) + { + if (year < 2007) { + start_rule_functor_pre2007 start1(start_day(year), + start_month(year)); + return start1.get_date(year); + } + start_rule_functor start(start_rule_functor::second, + start_day(year), + start_month(year)); + return start.get_date(year); + + } + static date_type local_dst_end_day(year_type year) + { + if (year < 2007) { + end_rule_functor_pre2007 end_rule(end_day(year), + end_month(year)); + return end_rule.get_date(year); + } + end_rule_functor end(end_day(year), + end_month(year)); + return end.get_date(year); + } + static int dst_start_offset_minutes() { return 120;} + static int dst_end_offset_minutes() { return 120; } + static int dst_shift_length_minutes() { return 60; } + }; + + //!Rules for daylight savings start in the EU (Last Sun in Mar) + /*!These amount to the following: + - Start of dst day is last Sunday in March + - End day of dst is last Sunday in Oct + - Going forward switch time is 2:00 am (offset 120 minutes) + - Going back switch time is 3:00 am (off set 180 minutes) + - Shift duration is one hour (60 minutes) + */ + template + struct eu_dst_trait + { + typedef typename date_type::day_of_week_type day_of_week_type; + typedef typename date_type::month_type month_type; + typedef typename date_type::year_type year_type; + typedef date_time::last_kday_of_month start_rule_functor; + typedef date_time::last_kday_of_month end_rule_functor; + static day_of_week_type start_day(year_type) {return Sunday;} + static month_type start_month(year_type) {return Mar;} + static day_of_week_type end_day(year_type) {return Sunday;} + static month_type end_month(year_type) {return Oct;} + static int dst_start_offset_minutes() { return 120;} + static int dst_end_offset_minutes() { return 180; } + static int dst_shift_length_minutes() { return 60; } + static date_type local_dst_start_day(year_type year) + { + start_rule_functor start(start_day(year), + start_month(year)); + return start.get_date(year); + } + static date_type local_dst_end_day(year_type year) + { + end_rule_functor end(end_day(year), + end_month(year)); + return end.get_date(year); + } + }; + + //! Alternative dst traits for some parts of the United Kingdom + /* Several places in the UK use EU start and end rules for the + day, but different local conversion times (eg: forward change at 1:00 + am local and backward change at 2:00 am dst instead of 2:00am + forward and 3:00am back for the EU). + */ + template + struct uk_dst_trait : public eu_dst_trait + { + static int dst_start_offset_minutes() { return 60;} + static int dst_end_offset_minutes() { return 120; } + static int dst_shift_length_minutes() { return 60; } + }; + + //Rules for Adelaide Australia + template + struct acst_dst_trait + { + typedef typename date_type::day_of_week_type day_of_week_type; + typedef typename date_type::month_type month_type; + typedef typename date_type::year_type year_type; + typedef date_time::last_kday_of_month start_rule_functor; + typedef date_time::last_kday_of_month end_rule_functor; + static day_of_week_type start_day(year_type) {return Sunday;} + static month_type start_month(year_type) {return Oct;} + static day_of_week_type end_day(year_type) {return Sunday;} + static month_type end_month(year_type) {return Mar;} + static int dst_start_offset_minutes() { return 120;} + static int dst_end_offset_minutes() { return 180; } + static int dst_shift_length_minutes() { return 60; } + static date_type local_dst_start_day(year_type year) + { + start_rule_functor start(start_day(year), + start_month(year)); + return start.get_date(year); + } + static date_type local_dst_end_day(year_type year) + { + end_rule_functor end(end_day(year), + end_month(year)); + return end.get_date(year); + } + }; + + + + + + +} } //namespace boost::date_time + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/locale_config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/locale_config.hpp new file mode 100644 index 0000000000..d01e008fea --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/locale_config.hpp @@ -0,0 +1,31 @@ +#ifndef DATE_TIME_LOCALE_CONFIG_HPP___ +#define DATE_TIME_LOCALE_CONFIG_HPP___ + +/* Copyright (c) 2002-2006 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +// This file configures whether the library will support locales and hence +// iostream based i/o. Even if a compiler has some support for locales, +// any failure to be compatible gets the compiler on the exclusion list. +// +// At the moment this is defined for MSVC 6 and any compiler that +// defines BOOST_NO_STD_LOCALE (gcc 2.95.x) + +#include "boost/config.hpp" //sets BOOST_NO_STD_LOCALE +#include "boost/detail/workaround.hpp" + +//This file basically becomes a noop if locales are not properly supported +#if (defined(BOOST_NO_STD_LOCALE) \ + || (BOOST_WORKAROUND( BOOST_MSVC, < 1300)) \ + || (BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x581 )) ) ) +#define BOOST_DATE_TIME_NO_LOCALE +#endif + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/microsec_time_clock.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/microsec_time_clock.hpp new file mode 100644 index 0000000000..1e946f8e24 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/microsec_time_clock.hpp @@ -0,0 +1,205 @@ +#ifndef DATE_TIME_HIGHRES_TIME_CLOCK_HPP___ +#define DATE_TIME_HIGHRES_TIME_CLOCK_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +/*! @file microsec_time_clock.hpp + This file contains a high resolution time clock implementation. +*/ + +#include +#include "boost/date_time/c_time.hpp" +#include "boost/date_time/time_clock.hpp" +#include "boost/cstdint.hpp" +#include "boost/shared_ptr.hpp" + +#ifdef BOOST_HAS_FTIME +#include +#endif + +#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK + +namespace boost { +namespace date_time { + + + //! A clock providing microsecond level resolution + /*! A high precision clock that measures the local time + * at a resolution up to microseconds and adjusts to the + * resolution of the time system. For example, for the + * a library configuration with nano second resolution, + * the last 3 places of the fractional seconds will always + * be 000 since there are 1000 nano-seconds in a micro second. + */ + template + class microsec_clock + { + public: + typedef typename time_type::date_type date_type; + typedef typename time_type::time_duration_type time_duration_type; + typedef typename time_duration_type::rep_type resolution_traits_type; + + //! return a local time object for the given zone, based on computer clock + //JKG -- looks like we could rewrite this against universal_time + template + static time_type local_time(shared_ptr tz_ptr) { + typedef typename time_type::utc_time_type utc_time_type; + typedef second_clock second_clock; + // we'll need to know the utc_offset this machine has + // in order to get a utc_time_type set to utc + utc_time_type utc_time = second_clock::universal_time(); + time_duration_type utc_offset = second_clock::local_time() - utc_time; + // use micro clock to get a local time with sub seconds + // and adjust it to get a true utc time reading with sub seconds + utc_time = microsec_clock::local_time() - utc_offset; + return time_type(utc_time, tz_ptr); + } + + + private: + // we want this enum available for both platforms yet still private + enum TZ_FOR_CREATE { LOCAL, GMT }; + + public: + +#ifdef BOOST_HAS_GETTIMEOFDAY + //! Return the local time based on computer clock settings + static time_type local_time() { + return create_time(LOCAL); + } + + //! Get the current day in universal date as a ymd_type + static time_type universal_time() + { + return create_time(GMT); + } + + private: + static time_type create_time(TZ_FOR_CREATE tz) { + timeval tv; + gettimeofday(&tv, 0); //gettimeofday does not support TZ adjust on Linux. + std::time_t t = tv.tv_sec; + boost::uint32_t fs = tv.tv_usec; + std::tm curr, *curr_ptr = 0; + if (tz == LOCAL) { + curr_ptr = c_time::localtime(&t, &curr); + } else { + curr_ptr = c_time::gmtime(&t, &curr); + } + date_type d(curr_ptr->tm_year + 1900, + curr_ptr->tm_mon + 1, + curr_ptr->tm_mday); + //The following line will adjusts the fractional second tick in terms + //of the current time system. For example, if the time system + //doesn't support fractional seconds then res_adjust returns 0 + //and all the fractional seconds return 0. + int adjust = resolution_traits_type::res_adjust()/1000000; + + time_duration_type td(curr_ptr->tm_hour, + curr_ptr->tm_min, + curr_ptr->tm_sec, + fs*adjust); + return time_type(d,td); + + } +#endif // BOOST_HAS_GETTIMEOFDAY + +#ifdef BOOST_HAS_FTIME + //! Return the local time based on computer clock settings + static time_type local_time() { + FILETIME ft; + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + // Some runtime library implementations expect local times as the norm for ctime. + FILETIME ft_utc; + GetSystemTimeAsFileTime(&ft_utc); + FileTimeToLocalFileTime(&ft_utc,&ft); + #elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME) + SYSTEMTIME st; + GetSystemTime( &st ); + SystemTimeToFileTime( &st, &ft ); + #else + GetSystemTimeAsFileTime(&ft); + #endif + return create_time(ft, LOCAL); + } + + //! Return the UTC time based on computer settings + static time_type universal_time() { + FILETIME ft; + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + // Some runtime library implementations expect local times as the norm for ctime. + FILETIME ft_utc; + GetSystemTimeAsFileTime(&ft_utc); + FileTimeToLocalFileTime(&ft_utc,&ft); + #elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME) + SYSTEMTIME st; + GetSystemTime( &st ); + SystemTimeToFileTime( &st, &ft ); + #else + GetSystemTimeAsFileTime(&ft); + #endif + return create_time(ft, GMT); + } + + private: + static time_type create_time(FILETIME& ft, TZ_FOR_CREATE tz) { + // offset is difference (in 100-nanoseconds) from + // 1970-Jan-01 to 1601-Jan-01 + boost::uint64_t c1 = 27111902; + boost::uint64_t c2 = 3577643008UL; // 'UL' removes compiler warnings + const boost::uint64_t OFFSET = (c1 << 32) + c2; + + boost::uint64_t filetime = ft.dwHighDateTime; + filetime = filetime << 32; + filetime += ft.dwLowDateTime; + filetime -= OFFSET; + // filetime now holds 100-nanoseconds since 1970-Jan-01 + + // microseconds -- static casts supress warnings + boost::uint32_t sub_sec = static_cast((filetime % 10000000) / 10); + + std::time_t t = static_cast(filetime / 10000000); // seconds since epoch + + std::tm curr, *curr_ptr = 0; + if (tz == LOCAL) { + curr_ptr = c_time::localtime(&t, &curr); + } + else { + curr_ptr = c_time::gmtime(&t, &curr); + } + date_type d(curr_ptr->tm_year + 1900, + curr_ptr->tm_mon + 1, + curr_ptr->tm_mday); + + //The following line will adjusts the fractional second tick in terms + //of the current time system. For example, if the time system + //doesn't support fractional seconds then res_adjust returns 0 + //and all the fractional seconds return 0. + int adjust = static_cast(resolution_traits_type::res_adjust()/1000000); + + time_duration_type td(curr_ptr->tm_hour, + curr_ptr->tm_min, + curr_ptr->tm_sec, + sub_sec * adjust); + //st.wMilliseconds * adjust); + return time_type(d,td); + + } +#endif // BOOST_HAS_FTIME + }; + + +} } //namespace date_time + +#endif //BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/parse_format_base.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/parse_format_base.hpp new file mode 100644 index 0000000000..b17a5c8e77 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/parse_format_base.hpp @@ -0,0 +1,29 @@ +#ifndef DATE_TIME_PARSE_FORMAT_BASE__ +#define DATE_TIME_PARSE_FORMAT_BASE__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +namespace boost { +namespace date_time { + + //! Enum for distinguishing parsing and formatting options + enum month_format_spec {month_as_integer, month_as_short_string, + month_as_long_string}; + + //! Enum for distinguishing the order of Month, Day, & Year. + /*! Enum for distinguishing the order in which Month, Day, & Year + * will appear in a date string */ + enum ymd_order_spec {ymd_order_iso, //order is year-month-day + ymd_order_dmy, //day-month-year + ymd_order_us}; //order is month-day-year + + +} }//namespace date_time + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/period.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/period.hpp new file mode 100644 index 0000000000..c67bc36c65 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/period.hpp @@ -0,0 +1,377 @@ +#ifndef DATE_TIME_PERIOD_HPP___ +#define DATE_TIME_PERIOD_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! \file period.hpp + This file contain the implementation of the period abstraction. This is + basically the same idea as a range. Although this class is intended for + use in the time library, it is pretty close to general enough for other + numeric uses. + +*/ + +#include "boost/operators.hpp" + + +namespace boost { +namespace date_time { + //!Provides generalized period type useful in date-time systems + /*!This template uses a class to represent a time point within the period + and another class to represent a duration. As a result, this class is + not appropriate for use when the number and duration representation + are the same (eg: in the regular number domain). + + A period can be specified by providing either the begining point and + a duration or the begining point and the end point( end is NOT part + of the period but 1 unit past it. A period will be "invalid" if either + end_point <= begin_point or the given duration is <= 0. Any valid period + will return false for is_null(). + + Zero length periods are also considered invalid. Zero length periods are + periods where the begining and end points are the same, or, the given + duration is zero. For a zero length period, the last point will be one + unit less than the begining point. + + In the case that the begin and last are the same, the period has a + length of one unit. + + The best way to handle periods is usually to provide a begining point and + a duration. So, day1 + 7 days is a week period which includes all of the + first day and 6 more days (eg: Sun to Sat). + + */ + template + class period : private + boost::less_than_comparable + , boost::equality_comparable< period + > > + { + public: + typedef point_rep point_type; + typedef duration_rep duration_type; + + period(point_rep first_point, point_rep end_point); + period(point_rep first_point, duration_rep len); + point_rep begin() const; + point_rep end() const; + point_rep last() const; + duration_rep length() const; + bool is_null() const; + bool operator==(const period& rhs) const; + bool operator<(const period& rhs) const; + void shift(const duration_rep& d); + void expand(const duration_rep& d); + bool contains(const point_rep& point) const; + bool contains(const period& other) const; + bool intersects(const period& other) const; + bool is_adjacent(const period& other) const; + bool is_before(const point_rep& point) const; + bool is_after(const point_rep& point) const; + period intersection(const period& other) const; + period merge(const period& other) const; + period span(const period& other) const; + private: + point_rep begin_; + point_rep last_; + }; + + //! create a period from begin to last eg: [begin,end) + /*! If end <= begin then the period will be invalid + */ + template + inline + period::period(point_rep first_point, + point_rep end_point) : + begin_(first_point), + last_(end_point - duration_rep::unit()) + {} + + //! create a period as [begin, begin+len) + /*! If len is <= 0 then the period will be invalid + */ + template + inline + period::period(point_rep first_point, duration_rep len) : + begin_(first_point), + last_(first_point + len-duration_rep::unit()) + { } + + + //! Return the first element in the period + template + inline + point_rep period::begin() const + { + return begin_; + } + + //! Return one past the last element + template + inline + point_rep period::end() const + { + return last_ + duration_rep::unit(); + } + + //! Return the last item in the period + template + inline + point_rep period::last() const + { + return last_; + } + + //! True if period is ill formed (length is zero or less) + template + inline + bool period::is_null() const + { + return end() <= begin_; + } + + //! Return the length of the period + template + inline + duration_rep period::length() const + { + if(last_ < begin_){ // invalid period + return last_+duration_rep::unit() - begin_; + } + else{ + return end() - begin_; // normal case + } + } + + //! Equality operator + template + inline + bool period::operator==(const period& rhs) const + { + return ((begin_ == rhs.begin_) && + (last_ == rhs.last_)); + } + + //! Strict as defined by rhs.last <= lhs.last + template + inline + bool period::operator<(const period& rhs) const + { + return (last_ < rhs.begin_); + } + + + //! Shift the start and end by the specified amount + template + inline + void period::shift(const duration_rep& d) + { + begin_ = begin_ + d; + last_ = last_ + d; + } + + /** Expands the size of the period by the duration on both ends. + * + *So before expand + *@code + * + * [-------] + * ^ ^ ^ ^ ^ ^ ^ + * 1 2 3 4 5 6 7 + * + *@endcode + * After expand(2) + *@code + * + * [----------------------] + * ^ ^ ^ ^ ^ ^ ^ + * 1 2 3 4 5 6 7 + * + *@endcode + */ + template + inline + void period::expand(const duration_rep& d) + { + begin_ = begin_ - d; + last_ = last_ + d; + } + + //! True if the point is inside the period, zero length periods contain no points + template + inline + bool period::contains(const point_rep& point) const + { + return ((point >= begin_) && + (point <= last_)); + } + + + //! True if this period fully contains (or equals) the other period + template + inline + bool period::contains(const period& other) const + { + return ((begin_ <= other.begin_) && (last_ >= other.last_)); + } + + + //! True if periods are next to each other without a gap. + /* In the example below, p1 and p2 are adjacent, but p3 is not adjacent + * with either of p1 or p2. + *@code + * [-p1-) + * [-p2-) + * [-p3-) + *@endcode + */ + template + inline + bool + period::is_adjacent(const period& other) const + { + return (other.begin() == end() || + begin_ == other.end()); + } + + + //! True if all of the period is prior or t < start + /* In the example below only point 1 would evaluate to true. + *@code + * [---------]) + * ^ ^ ^ ^ ^ + * 1 2 3 4 5 + * + *@endcode + */ + template + inline + bool + period::is_after(const point_rep& t) const + { + if (is_null()) + { + return false; //null period isn't after + } + + return t < begin_; + } + + //! True if all of the period is prior to the passed point or end <= t + /* In the example below points 4 and 5 return true. + *@code + * [---------]) + * ^ ^ ^ ^ ^ + * 1 2 3 4 5 + * + *@endcode + */ + template + inline + bool + period::is_before(const point_rep& t) const + { + if (is_null()) + { + return false; //null period isn't before anything + } + + return last_ < t; + } + + + //! True if the periods overlap in any way + /* In the example below p1 intersects with p2, p4, and p6. + *@code + * [---p1---) + * [---p2---) + * [---p3---) + * [---p4---) + * [-p5-) + * [-p6-) + *@endcode + */ + template + inline + bool period::intersects(const period& other) const + { + return ( contains(other.begin_) || + other.contains(begin_) || + ((other.begin_ < begin_) && (other.last_ >= begin_))); + } + + //! Returns the period of intersection or invalid range no intersection + template + inline + period + period::intersection(const period& other) const + { + if (begin_ > other.begin_) { + if (last_ <= other.last_) { //case2 + return *this; + } + //case 1 + return period(begin_, other.end()); + } + else { + if (last_ <= other.last_) { //case3 + return period(other.begin_, this->end()); + } + //case4 + return other; + } + //unreachable + } + + //! Returns the union of intersecting periods -- or null period + /*! + */ + template + inline + period + period::merge(const period& other) const + { + if (this->intersects(other)) { + if (begin_ < other.begin_) { + return period(begin_, last_ > other.last_ ? this->end() : other.end()); + } + + return period(other.begin_, last_ > other.last_ ? this->end() : other.end()); + + } + return period(begin_,begin_); // no intersect return null + } + + //! Combine two periods with earliest start and latest end. + /*! Combines two periods and any gap between them such that + * start = min(p1.start, p2.start) + * end = max(p1.end , p2.end) + *@code + * [---p1---) + * [---p2---) + * result: + * [-----------p3----------) + *@endcode + */ + template + inline + period + period::span(const period& other) const + { + point_rep start((begin_ < other.begin_) ? begin() : other.begin()); + point_rep newend((last_ < other.last_) ? other.end() : this->end()); + return period(start, newend); + } + + +} } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/period_formatter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/period_formatter.hpp new file mode 100644 index 0000000000..08082e10f6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/period_formatter.hpp @@ -0,0 +1,196 @@ + +#ifndef DATETIME_PERIOD_FORMATTER_HPP___ +#define DATETIME_PERIOD_FORMATTER_HPP___ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + + +namespace boost { namespace date_time { + + + //! Not a facet, but a class used to specify and control period formats + /*! Provides settings for the following: + * - period_separator -- default '/' + * - period_open_start_delimeter -- default '[' + * - period_open_range_end_delimeter -- default ')' + * - period_closed_range_end_delimeter -- default ']' + * - display_as_open_range, display_as_closed_range -- default closed_range + * + * Thus the default formatting for a period is as follows: + *@code + * [period.start()/period.last()] + *@endcode + * So for a typical date_period this would be + *@code + * [2004-Jan-04/2004-Feb-01] + *@endcode + * where the date formatting is controlled by the date facet + */ + template > > + class period_formatter { + public: + typedef std::basic_string string_type; + typedef CharT char_type; + typedef typename std::basic_string::const_iterator const_itr_type; + typedef std::vector > collection_type; + + static const char_type default_period_separator[2]; + static const char_type default_period_start_delimeter[2]; + static const char_type default_period_open_range_end_delimeter[2]; + static const char_type default_period_closed_range_end_delimeter[2]; + + enum range_display_options { AS_OPEN_RANGE, AS_CLOSED_RANGE }; + + //! Constructor that sets up period formatter options -- default should suffice most cases. + period_formatter(range_display_options range_option_in = AS_CLOSED_RANGE, + const char_type* const period_separator = default_period_separator, + const char_type* const period_start_delimeter = default_period_start_delimeter, + const char_type* const period_open_range_end_delimeter = default_period_open_range_end_delimeter, + const char_type* const period_closed_range_end_delimeter = default_period_closed_range_end_delimeter) : + m_range_option(range_option_in), + m_period_separator(period_separator), + m_period_start_delimeter(period_start_delimeter), + m_open_range_end_delimeter(period_open_range_end_delimeter), + m_closed_range_end_delimeter(period_closed_range_end_delimeter) + {} + + //! Puts the characters between period elements into stream -- default is / + OutItrT put_period_separator(OutItrT& oitr) const + { + const_itr_type ci = m_period_separator.begin(); + while (ci != m_period_separator.end()) { + *oitr = *ci; + ci++; + } + return oitr; + } + + //! Puts the period start characters into stream -- default is [ + OutItrT put_period_start_delimeter(OutItrT& oitr) const + { + const_itr_type ci = m_period_start_delimeter.begin(); + while (ci != m_period_start_delimeter.end()) { + *oitr = *ci; + ci++; + } + return oitr; + } + + //! Puts the period end characters into stream as controled by open/closed range setting. + OutItrT put_period_end_delimeter(OutItrT& oitr) const + { + + const_itr_type ci, end; + if (m_range_option == AS_OPEN_RANGE) { + ci = m_open_range_end_delimeter.begin(); + end = m_open_range_end_delimeter.end(); + } + else { + ci = m_closed_range_end_delimeter.begin(); + end = m_closed_range_end_delimeter.end(); + } + while (ci != end) { + *oitr = *ci; + ci++; + } + return oitr; + } + + range_display_options range_option() const + { + return m_range_option; + } + + //! Reset the range_option control + void + range_option(range_display_options option) const + { + m_range_option = option; + } + void delimiter_strings(const string_type& separator, + const string_type& start_delim, + const string_type& open_end_delim, + const string_type& closed_end_delim) + { + m_period_separator; + m_period_start_delimeter; + m_open_range_end_delimeter; + m_closed_range_end_delimeter; + } + + + //! Generic code to output a period -- no matter the period type. + /*! This generic code will output any period using a facet to + * to output the 'elements'. For example, in the case of a date_period + * the elements will be instances of a date which will be formatted + * according the to setup in the passed facet parameter. + * + * The steps for formatting a period are always the same: + * - put the start delimiter + * - put start element + * - put the separator + * - put either last or end element depending on range settings + * - put end delimeter depending on range settings + * + * Thus for a typical date period the result might look like this: + *@code + * + * [March 01, 2004/June 07, 2004] <-- closed range + * [March 01, 2004/June 08, 2004) <-- open range + * + *@endcode + */ + template + OutItrT put_period(OutItrT next, + std::ios_base& a_ios, + char_type a_fill, + const period_type& p, + const facet_type& facet) const { + put_period_start_delimeter(next); + next = facet.put(next, a_ios, a_fill, p.begin()); + put_period_separator(next); + if (m_range_option == AS_CLOSED_RANGE) { + facet.put(next, a_ios, a_fill, p.last()); + } + else { + facet.put(next, a_ios, a_fill, p.end()); + } + put_period_end_delimeter(next); + return next; + } + + + private: + range_display_options m_range_option; + string_type m_period_separator; + string_type m_period_start_delimeter; + string_type m_open_range_end_delimeter; + string_type m_closed_range_end_delimeter; + }; + + template + const typename period_formatter::char_type + period_formatter::default_period_separator[2] = {'/'}; + + template + const typename period_formatter::char_type + period_formatter::default_period_start_delimeter[2] = {'['}; + + template + const typename period_formatter::char_type + period_formatter::default_period_open_range_end_delimeter[2] = {')'}; + + template + const typename period_formatter::char_type + period_formatter::default_period_closed_range_end_delimeter[2] = {']'}; + + } } //namespace boost::date_time + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/period_parser.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/period_parser.hpp new file mode 100644 index 0000000000..6c480148a5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/period_parser.hpp @@ -0,0 +1,196 @@ + +#ifndef DATETIME_PERIOD_PARSER_HPP___ +#define DATETIME_PERIOD_PARSER_HPP___ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/string_parse_tree.hpp" +#include "boost/date_time/string_convert.hpp" + + +namespace boost { namespace date_time { + + + //! Not a facet, but a class used to specify and control period parsing + /*! Provides settings for the following: + * - period_separator -- default '/' + * - period_open_start_delimeter -- default '[' + * - period_open_range_end_delimeter -- default ')' + * - period_closed_range_end_delimeter -- default ']' + * - display_as_open_range, display_as_closed_range -- default closed_range + * + * For a typical date_period, the contents of the input stream would be + *@code + * [2004-Jan-04/2004-Feb-01] + *@endcode + * where the date format is controlled by the date facet + */ + template + class period_parser { + public: + typedef std::basic_string string_type; + typedef CharT char_type; + //typedef typename std::basic_string::const_iterator const_itr_type; + typedef std::istreambuf_iterator stream_itr_type; + typedef string_parse_tree parse_tree_type; + typedef typename parse_tree_type::parse_match_result_type match_results; + typedef std::vector > collection_type; + + static const char_type default_period_separator[2]; + static const char_type default_period_start_delimeter[2]; + static const char_type default_period_open_range_end_delimeter[2]; + static const char_type default_period_closed_range_end_delimeter[2]; + + enum period_range_option { AS_OPEN_RANGE, AS_CLOSED_RANGE }; + + //! Constructor that sets up period parser options + period_parser(period_range_option range_option = AS_CLOSED_RANGE, + const char_type* const period_separator = default_period_separator, + const char_type* const period_start_delimeter = default_period_start_delimeter, + const char_type* const period_open_range_end_delimeter = default_period_open_range_end_delimeter, + const char_type* const period_closed_range_end_delimeter = default_period_closed_range_end_delimeter) + : m_range_option(range_option) + { + delimiters.push_back(string_type(period_separator)); + delimiters.push_back(string_type(period_start_delimeter)); + delimiters.push_back(string_type(period_open_range_end_delimeter)); + delimiters.push_back(string_type(period_closed_range_end_delimeter)); + } + + period_parser(const period_parser& p_parser) + { + this->delimiters = p_parser.delimiters; + this->m_range_option = p_parser.m_range_option; + } + + period_range_option range_option() const + { + return m_range_option; + } + void range_option(period_range_option option) + { + m_range_option = option; + } + collection_type delimiter_strings() const + { + return delimiters; + } + void delimiter_strings(const string_type& separator, + const string_type& start_delim, + const string_type& open_end_delim, + const string_type& closed_end_delim) + { + delimiters.clear(); + delimiters.push_back(separator); + delimiters.push_back(start_delim); + delimiters.push_back(open_end_delim); + delimiters.push_back(closed_end_delim); + } + + //! Generic code to parse a period -- no matter the period type. + /*! This generic code will parse any period using a facet to + * to get the 'elements'. For example, in the case of a date_period + * the elements will be instances of a date which will be parsed + * according the to setup in the passed facet parameter. + * + * The steps for parsing a period are always the same: + * - consume the start delimiter + * - get start element + * - consume the separator + * - get either last or end element depending on range settings + * - consume the end delimeter depending on range settings + * + * Thus for a typical date period the contents of the input stream + * might look like this: + *@code + * + * [March 01, 2004/June 07, 2004] <-- closed range + * [March 01, 2004/June 08, 2004) <-- open range + * + *@endcode + */ + template + period_type get_period(stream_itr_type& sitr, + stream_itr_type& stream_end, + std::ios_base& a_ios, + const period_type& p, + const duration_type& dur_unit, + const facet_type& facet) const + { + // skip leading whitespace + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + + typedef typename period_type::point_type point_type; + point_type p1(not_a_date_time), p2(not_a_date_time); + + + consume_delim(sitr, stream_end, delimiters[START]); // start delim + facet.get(sitr, stream_end, a_ios, p1); // first point + consume_delim(sitr, stream_end, delimiters[SEPARATOR]); // separator + facet.get(sitr, stream_end, a_ios, p2); // second point + + // period construction parameters are always open range [begin, end) + if (m_range_option == AS_CLOSED_RANGE) { + consume_delim(sitr, stream_end, delimiters[CLOSED_END]);// end delim + // add 1 duration unit to p2 to make range open + p2 += dur_unit; + } + else { + consume_delim(sitr, stream_end, delimiters[OPEN_END]); // end delim + } + + return period_type(p1, p2); + } + + private: + collection_type delimiters; + period_range_option m_range_option; + + enum delim_ids { SEPARATOR, START, OPEN_END, CLOSED_END }; + + //! throws ios_base::failure if delimiter and parsed data do not match + void consume_delim(stream_itr_type& sitr, + stream_itr_type& stream_end, + const string_type& delim) const + { + /* string_parse_tree will not parse a string of punctuation characters + * without knowing exactly how many characters to process + * Ex [2000. Will not parse out the '[' string without knowing + * to process only one character. By using length of the delimiter + * string we can safely iterate past it. */ + string_type s; + for(unsigned int i = 0; i < delim.length() && sitr != stream_end; ++i) { + s += *sitr; + ++sitr; + } + if(s != delim) { + throw std::ios_base::failure("Parse failed. Expected '" + convert_string_type(delim) + "' but found '" + convert_string_type(s) + "'"); + } + } + }; + + template + const typename period_parser::char_type + period_parser::default_period_separator[2] = {'/'}; + + template + const typename period_parser::char_type + period_parser::default_period_start_delimeter[2] = {'['}; + + template + const typename period_parser::char_type + period_parser::default_period_open_range_end_delimeter[2] = {')'}; + + template + const typename period_parser::char_type + period_parser::default_period_closed_range_end_delimeter[2] = {']'}; + + } } //namespace boost::date_time + +#endif // DATETIME_PERIOD_PARSER_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/conversion.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/conversion.hpp new file mode 100644 index 0000000000..27ad6a84f1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/conversion.hpp @@ -0,0 +1,93 @@ +#ifndef POSIX_TIME_CONVERSION_HPP___ +#define POSIX_TIME_CONVERSION_HPP___ + +/* Copyright (c) 2002-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/posix_time/ptime.hpp" +#include "boost/date_time/posix_time/posix_time_duration.hpp" +#include "boost/date_time/filetime_functions.hpp" +#include "boost/date_time/c_time.hpp" +#include "boost/date_time/gregorian/conversion.hpp" + +namespace boost { + +namespace posix_time { + + + //! Function that converts a time_t into a ptime. + inline + ptime from_time_t(std::time_t t) + { + ptime start(gregorian::date(1970,1,1)); + return start + seconds(static_cast(t)); + } + + //! Convert a time to a tm structure truncating any fractional seconds + inline + std::tm to_tm(const boost::posix_time::ptime& t) { + std::tm timetm = boost::gregorian::to_tm(t.date()); + boost::posix_time::time_duration td = t.time_of_day(); + timetm.tm_hour = td.hours(); + timetm.tm_min = td.minutes(); + timetm.tm_sec = td.seconds(); + timetm.tm_isdst = -1; // -1 used when dst info is unknown + return timetm; + } + //! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components + inline + std::tm to_tm(const boost::posix_time::time_duration& td) { + std::tm timetm; + timetm.tm_year = 0; + timetm.tm_mon = 0; + timetm.tm_mday = 0; + timetm.tm_wday = 0; + timetm.tm_yday = 0; + + timetm.tm_hour = date_time::absolute_value(td.hours()); + timetm.tm_min = date_time::absolute_value(td.minutes()); + timetm.tm_sec = date_time::absolute_value(td.seconds()); + timetm.tm_isdst = -1; // -1 used when dst info is unknown + return timetm; + } + + //! Convert a tm struct to a ptime ignoring is_dst flag + inline + ptime ptime_from_tm(const std::tm& timetm) { + boost::gregorian::date d = boost::gregorian::date_from_tm(timetm); + return ptime(d, time_duration(timetm.tm_hour, timetm.tm_min, timetm.tm_sec)); + } + + +#if defined(BOOST_HAS_FTIME) + + //! Function to create a time object from an initialized FILETIME struct. + /*! Function to create a time object from an initialized FILETIME struct. + * A FILETIME struct holds 100-nanosecond units (0.0000001). When + * built with microsecond resolution the FILETIME's sub second value + * will be truncated. Nanosecond resolution has no truncation. + * + * Note ftime is part of the Win32 API, so it is not portable to non-windows + * platforms. + */ + template + inline + time_type from_ftime(const FILETIME& ft) + { + return boost::date_time::time_from_ftime(ft); + } + +#endif // BOOST_HAS_FTIME + +} } //namespace boost::posix_time + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/date_duration_operators.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/date_duration_operators.hpp new file mode 100644 index 0000000000..e6899ba0aa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/date_duration_operators.hpp @@ -0,0 +1,114 @@ +#ifndef DATE_DURATION_OPERATORS_HPP___ +#define DATE_DURATION_OPERATORS_HPP___ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or + * http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/greg_duration_types.hpp" +#include "boost/date_time/posix_time/ptime.hpp" + +namespace boost { +namespace posix_time { + + /*!@file date_duration_operators.hpp Operators for ptime and + * optional gregorian types. Operators use snap-to-end-of-month behavior. + * Further details on this behavior can be found in reference for + * date_time/date_duration_types.hpp and documentation for + * month and year iterators. + */ + + + /*! Adds a months object and a ptime. Result will be same + * day-of-month as ptime unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + ptime + operator+(const ptime& t, const boost::gregorian::months& m) + { + return t + m.get_offset(t.date()); + } + + /*! Adds a months object to a ptime. Result will be same + * day-of-month as ptime unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + ptime + operator+=(ptime& t, const boost::gregorian::months& m) + { + // get_neg_offset returns a negative duration, so we add + return t += m.get_offset(t.date()); + } + + /*! Subtracts a months object and a ptime. Result will be same + * day-of-month as ptime unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + ptime + operator-(const ptime& t, const boost::gregorian::months& m) + { + // get_neg_offset returns a negative duration, so we add + return t + m.get_neg_offset(t.date()); + } + + /*! Subtracts a months object from a ptime. Result will be same + * day-of-month as ptime unless original day was the last day of month. + * see date_time::months_duration for more details */ + inline + ptime + operator-=(ptime& t, const boost::gregorian::months& m) + { + return t += m.get_neg_offset(t.date()); + } + + // ptime & years + + /*! Adds a years object and a ptime. Result will be same + * month and day-of-month as ptime unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + ptime + operator+(const ptime& t, const boost::gregorian::years& y) + { + return t + y.get_offset(t.date()); + } + + /*! Adds a years object to a ptime. Result will be same + * month and day-of-month as ptime unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + ptime + operator+=(ptime& t, const boost::gregorian::years& y) + { + return t += y.get_offset(t.date()); + } + + /*! Subtracts a years object and a ptime. Result will be same + * month and day-of-month as ptime unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + ptime + operator-(const ptime& t, const boost::gregorian::years& y) + { + // get_neg_offset returns a negative duration, so we add + return t + y.get_neg_offset(t.date()); + } + + /*! Subtracts a years object from a ptime. Result will be same + * month and day-of-month as ptime unless original day was the + * last day of month. see date_time::years_duration for more details */ + inline + ptime + operator-=(ptime& t, const boost::gregorian::years& y) + { + // get_neg_offset returns a negative duration, so we add + return t += y.get_neg_offset(t.date()); + } + +}} // namespaces + +#endif // DATE_DURATION_OPERATORS_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time.hpp new file mode 100644 index 0000000000..4e9294c426 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time.hpp @@ -0,0 +1,39 @@ +#ifndef POSIX_TIME_HPP___ +#define POSIX_TIME_HPP___ + +/* Copyright (c) 2002-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ +/*!@file posix_time.hpp Global header file to get all of posix time types + */ + +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/posix_time/ptime.hpp" +#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES) +#include "boost/date_time/posix_time/date_duration_operators.hpp" +#endif + +// output functions +#if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS) +#include "boost/date_time/posix_time/time_formatters_limited.hpp" +#else +#include "boost/date_time/posix_time/time_formatters.hpp" +#endif // BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS + +// streaming operators +#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) +#include "boost/date_time/posix_time/posix_time_legacy_io.hpp" +#else +#include "boost/date_time/posix_time/posix_time_io.hpp" +#endif // USE_DATE_TIME_PRE_1_33_FACET_IO + +#include "boost/date_time/posix_time/time_parsers.hpp" +#include "boost/date_time/posix_time/conversion.hpp" + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_config.hpp new file mode 100644 index 0000000000..c40a15cec8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_config.hpp @@ -0,0 +1,178 @@ +#ifndef POSIX_TIME_CONFIG_HPP___ +#define POSIX_TIME_CONFIG_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-10-13 05:00:03 -0400 (Mon, 13 Oct 2008) $ + */ + +#include "boost/date_time/time_duration.hpp" +#include "boost/date_time/time_resolution_traits.hpp" +#include "boost/date_time/gregorian/gregorian_types.hpp" +#include "boost/date_time/wrapping_int.hpp" +#include "boost/limits.hpp" +#include "boost/date_time/compiler_config.hpp" +#include "boost/cstdint.hpp" +#include +#include //for MCW 7.2 std::abs(long long) + +namespace boost { +namespace posix_time { + +//Remove the following line if you want 64 bit millisecond resolution time +//#define BOOST_GDTL_POSIX_TIME_STD_CONFIG + +#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG + // set up conditional test compilations +#define BOOST_DATE_TIME_HAS_MILLISECONDS +#define BOOST_DATE_TIME_HAS_MICROSECONDS +#define BOOST_DATE_TIME_HAS_NANOSECONDS + typedef date_time::time_resolution_traits time_res_traits; +#else + // set up conditional test compilations +#define BOOST_DATE_TIME_HAS_MILLISECONDS +#define BOOST_DATE_TIME_HAS_MICROSECONDS +#undef BOOST_DATE_TIME_HAS_NANOSECONDS + typedef date_time::time_resolution_traits< + boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro, + 1000000, 6 > time_res_traits; + + +// #undef BOOST_DATE_TIME_HAS_MILLISECONDS +// #undef BOOST_DATE_TIME_HAS_MICROSECONDS +// #undef BOOST_DATE_TIME_HAS_NANOSECONDS +// typedef date_time::time_resolution_traits time_res_traits; + +#endif + + + //! Base time duration type + /*! \ingroup time_basics + */ + class time_duration : + public date_time::time_duration + { + public: + typedef time_res_traits rep_type; + typedef time_res_traits::day_type day_type; + typedef time_res_traits::hour_type hour_type; + typedef time_res_traits::min_type min_type; + typedef time_res_traits::sec_type sec_type; + typedef time_res_traits::fractional_seconds_type fractional_seconds_type; + typedef time_res_traits::tick_type tick_type; + typedef time_res_traits::impl_type impl_type; + time_duration(hour_type hour, + min_type min, + sec_type sec, + fractional_seconds_type fs=0) : + date_time::time_duration(hour,min,sec,fs) + {} + time_duration() : + date_time::time_duration(0,0,0) + {} + //! Construct from special_values + time_duration(boost::date_time::special_values sv) : + date_time::time_duration(sv) + {} + //Give duration access to ticks constructor -- hide from users + friend class date_time::time_duration; + private: + explicit time_duration(impl_type ticks) : + date_time::time_duration(ticks) + {} + }; + +#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG + + //! Simple implementation for the time rep + struct simple_time_rep + { + typedef gregorian::date date_type; + typedef time_duration time_duration_type; + simple_time_rep(date_type d, time_duration_type tod) : + day(d), + time_of_day(tod) + { + // make sure we have sane values for date & time + if(!day.is_special() && !time_of_day.is_special()){ + if(time_of_day >= time_duration_type(24,0,0)) { + while(time_of_day >= time_duration_type(24,0,0)) { + day += date_type::duration_type(1); + time_of_day -= time_duration_type(24,0,0); + } + } + else if(time_of_day.is_negative()) { + while(time_of_day.is_negative()) { + day -= date_type::duration_type(1); + time_of_day += time_duration_type(24,0,0); + } + } + } + } + date_type day; + time_duration_type time_of_day; + bool is_special()const + { + return(is_pos_infinity() || is_neg_infinity() || is_not_a_date_time()); + } + bool is_pos_infinity()const + { + return(day.is_pos_infinity() || time_of_day.is_pos_infinity()); + } + bool is_neg_infinity()const + { + return(day.is_neg_infinity() || time_of_day.is_neg_infinity()); + } + bool is_not_a_date_time()const + { + return(day.is_not_a_date() || time_of_day.is_not_a_date_time()); + } + }; + + class posix_time_system_config + { + public: + typedef simple_time_rep time_rep_type; + typedef gregorian::date date_type; + typedef gregorian::date_duration date_duration_type; + typedef time_duration time_duration_type; + typedef time_res_traits::tick_type int_type; + typedef time_res_traits resolution_traits; +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers +#else + BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000000); +#endif + }; + +#else + + class millisec_posix_time_system_config + { + public: + typedef boost::int64_t time_rep_type; + //typedef time_res_traits::tick_type time_rep_type; + typedef gregorian::date date_type; + typedef gregorian::date_duration date_duration_type; + typedef time_duration time_duration_type; + typedef time_res_traits::tick_type int_type; + typedef time_res_traits::impl_type impl_type; + typedef time_res_traits resolution_traits; +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers +#else + BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000); +#endif + }; + +#endif + +} }//namespace posix_time + + +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_duration.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_duration.hpp new file mode 100644 index 0000000000..db3b85fec3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_duration.hpp @@ -0,0 +1,82 @@ +#ifndef POSIX_TIME_DURATION_HPP___ +#define POSIX_TIME_DURATION_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/posix_time/posix_time_config.hpp" + +namespace boost { +namespace posix_time { + + //! Allows expression of durations as an hour count + /*! \ingroup time_basics + */ + class hours : public time_duration + { + public: + explicit hours(long h) : + time_duration(h,0,0) + {} + }; + + //! Allows expression of durations as a minute count + /*! \ingroup time_basics + */ + class minutes : public time_duration + { + public: + explicit minutes(long m) : + time_duration(0,m,0) + {} + }; + + //! Allows expression of durations as a seconds count + /*! \ingroup time_basics + */ + class seconds : public time_duration + { + public: + explicit seconds(long s) : + time_duration(0,0,s) + {} + }; + + + //! Allows expression of durations as milli seconds + /*! \ingroup time_basics + */ + typedef date_time::subsecond_duration millisec; + typedef date_time::subsecond_duration milliseconds; + + //! Allows expression of durations as micro seconds + /*! \ingroup time_basics + */ + typedef date_time::subsecond_duration microsec; + typedef date_time::subsecond_duration microseconds; + + //This is probably not needed anymore... +#if defined(BOOST_DATE_TIME_HAS_NANOSECONDS) + + //! Allows expression of durations as nano seconds + /*! \ingroup time_basics + */ + typedef date_time::subsecond_duration nanosec; + typedef date_time::subsecond_duration nanoseconds; + + +#endif + + + + +} }//namespace posix_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_io.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_io.hpp new file mode 100644 index 0000000000..5fa9ce2845 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_io.hpp @@ -0,0 +1,246 @@ +#ifndef DATE_TIME_POSIX_TIME_IO_HPP__ +#define DATE_TIME_POSIX_TIME_IO_HPP__ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/time_facet.hpp" +#include "boost/date_time/period_formatter.hpp" +#include "boost/date_time/posix_time/time_period.hpp" +#include "boost/date_time/posix_time/posix_time_duration.hpp" +//#include "boost/date_time/gregorian/gregorian_io.hpp" +#include "boost/io/ios_state.hpp" +#include +#include + +namespace boost { +namespace posix_time { + + + //! wptime_facet is depricated and will be phased out. use wtime_facet instead + //typedef boost::date_time::time_facet wptime_facet; + //! ptime_facet is depricated and will be phased out. use time_facet instead + //typedef boost::date_time::time_facet ptime_facet; + + //! wptime_input_facet is depricated and will be phased out. use wtime_input_facet instead + //typedef boost::date_time::time_input_facet wptime_input_facet; + //! ptime_input_facet is depricated and will be phased out. use time_input_facet instead + //typedef boost::date_time::time_input_facet ptime_input_facet; + + typedef boost::date_time::time_facet wtime_facet; + typedef boost::date_time::time_facet time_facet; + + typedef boost::date_time::time_input_facet wtime_input_facet; + typedef boost::date_time::time_input_facet time_input_facet; + + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const ptime& p) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::time_facet custom_ptime_facet; + typedef std::time_put std_ptime_facet; + std::ostreambuf_iterator oitr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(oitr, os, os.fill(), p); + else { + //instantiate a custom facet for dealing with times since the user + //has not put one in the stream so far. This is for efficiency + //since we would always need to reconstruct for every time period + //if the locale did not already exist. Of course this will be overridden + //if the user imbues as some later point. + std::ostreambuf_iterator oitr(os); + custom_ptime_facet* f = new custom_ptime_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(oitr, os, os.fill(), p); + } + return os; + } + + //! input operator for ptime + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, ptime& pt) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::time_input_facet time_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, pt); + } + else { + time_input_facet* f = new time_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, pt); + } + } + catch(...) { + // mask tells us what exceptions are turned on + std::ios_base::iostate exception_mask = is.exceptions(); + // if the user wants exceptions on failbit, we'll rethrow our + // date_time exception & set the failbit + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} // ignore this one + throw; // rethrow original exception + } + else { + // if the user want's to fail quietly, we simply set the failbit + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const boost::posix_time::time_period& p) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::time_facet custom_ptime_facet; + typedef std::time_put std_time_facet; + std::ostreambuf_iterator oitr(os); + if (std::has_facet(os.getloc())) { + std::use_facet(os.getloc()).put(oitr, os, os.fill(), p); + } + else { + //instantiate a custom facet for dealing with periods since the user + //has not put one in the stream so far. This is for efficiency + //since we would always need to reconstruct for every time period + //if the local did not already exist. Of course this will be overridden + //if the user imbues as some later point. + std::ostreambuf_iterator oitr(os); + custom_ptime_facet* f = new custom_ptime_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(oitr, os, os.fill(), p); + } + return os; + } + + //! input operator for time_period + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, time_period& tp) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::time_input_facet time_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, tp); + } + else { + time_input_facet* f = new time_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, tp); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + + //! ostream operator for posix_time::time_duration + // todo fix to use facet -- place holder for now... + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const time_duration& td) + { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::time_facet custom_ptime_facet; + typedef std::time_put std_ptime_facet; + std::ostreambuf_iterator oitr(os); + if (std::has_facet(os.getloc())) + std::use_facet(os.getloc()).put(oitr, os, os.fill(), td); + else { + //instantiate a custom facet for dealing with times since the user + //has not put one in the stream so far. This is for efficiency + //since we would always need to reconstruct for every time period + //if the locale did not already exist. Of course this will be overridden + //if the user imbues as some later point. + std::ostreambuf_iterator oitr(os); + custom_ptime_facet* f = new custom_ptime_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(oitr, os, os.fill(), td); + } + return os; + } + + //! input operator for time_duration + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, time_duration& td) + { + boost::io::ios_flags_saver iflags(is); + typename std::basic_istream::sentry strm_sentry(is, false); + if (strm_sentry) { + try { + typedef typename date_time::time_input_facet time_input_facet; + + std::istreambuf_iterator sit(is), str_end; + if(std::has_facet(is.getloc())) { + std::use_facet(is.getloc()).get(sit, str_end, is, td); + } + else { + time_input_facet* f = new time_input_facet(); + std::locale l = std::locale(is.getloc(), f); + is.imbue(l); + f->get(sit, str_end, is, td); + } + } + catch(...) { + std::ios_base::iostate exception_mask = is.exceptions(); + if(std::ios_base::failbit & exception_mask) { + try { is.setstate(std::ios_base::failbit); } + catch(std::ios_base::failure&) {} + throw; // rethrow original exception + } + else { + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + +} } // namespaces +#endif // DATE_TIME_POSIX_TIME_IO_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_legacy_io.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_legacy_io.hpp new file mode 100644 index 0000000000..f5b20a8f8b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_legacy_io.hpp @@ -0,0 +1,153 @@ +#ifndef POSIX_TIME_PRE133_OPERATORS_HPP___ +#define POSIX_TIME_PRE133_OPERATORS_HPP___ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file posix_time_pre133_operators.hpp + * These input and output operators are for use with the + * pre 1.33 version of the date_time libraries io facet code. + * The operators used in version 1.33 and later can be found + * in posix_time_io.hpp */ + +#include +#include +#include +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/gregorian/gregorian.hpp" +#include "boost/date_time/posix_time/posix_time_duration.hpp" +#include "boost/date_time/posix_time/ptime.hpp" +#include "boost/date_time/posix_time/time_period.hpp" +#include "boost/date_time/time_parsing.hpp" + +namespace boost { +namespace posix_time { + + +//The following code is removed for configurations with poor std::locale support (eg: MSVC6, gcc 2.9x) +#ifndef BOOST_DATE_TIME_NO_LOCALE +#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) + //! ostream operator for posix_time::time_duration + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const time_duration& td) + { + typedef boost::date_time::ostream_time_duration_formatter duration_formatter; + duration_formatter::duration_put(td, os); + return os; + } + + //! ostream operator for posix_time::ptime + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const ptime& t) + { + typedef boost::date_time::ostream_time_formatter time_formatter; + time_formatter::time_put(t, os); + return os; + } + + //! ostream operator for posix_time::time_period + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, const time_period& tp) + { + typedef boost::date_time::ostream_time_period_formatter period_formatter; + period_formatter::period_put(tp, os); + return os; + } +#endif // USE_DATE_TIME_PRE_1_33_FACET_IO +/******** input streaming ********/ + template + inline + std::basic_istream& operator>>(std::basic_istream& is, time_duration& td) + { + // need to create a std::string and parse it + std::basic_string inp_s; + std::stringstream out_ss; + is >> inp_s; + typename std::basic_string::iterator b = inp_s.begin(); + // need to use both iterators because there is no requirement + // for the data held by a std::basic_string<> be terminated with + // any marker (such as '\0'). + typename std::basic_string::iterator e = inp_s.end(); + while(b != e){ + out_ss << out_ss.narrow(*b, 0); + ++b; + } + + td = date_time::parse_delimited_time_duration(out_ss.str()); + return is; + } + + template + inline + std::basic_istream& operator>>(std::basic_istream& is, ptime& pt) + { + gregorian::date d(not_a_date_time); + time_duration td(0,0,0); + is >> d >> td; + pt = ptime(d, td); + + return is; + } + + /** operator>> for time_period. time_period must be in + * "[date time_duration/date time_duration]" format. */ + template + inline + std::basic_istream& operator>>(std::basic_istream& is, time_period& tp) + { + gregorian::date d(not_a_date_time); + time_duration td(0,0,0); + ptime beg(d, td); + ptime end(beg); + std::basic_string s; + // get first date string and remove leading '[' + is >> s; + { + std::basic_stringstream ss; + ss << s.substr(s.find('[')+1); + ss >> d; + } + // get first time_duration & second date string, remove the '/' + // and split into 2 strings + is >> s; + { + std::basic_stringstream ss; + ss << s.substr(0, s.find('/')); + ss >> td; + } + beg = ptime(d, td); + { + std::basic_stringstream ss; + ss << s.substr(s.find('/')+1); + ss >> d; + } + // get last time_duration and remove the trailing ']' + is >> s; + { + std::basic_stringstream ss; + ss << s.substr(0, s.find(']')); + ss >> td; + } + end = ptime(d, td); + + tp = time_period(beg,end); + return is; + } + + +#endif //BOOST_DATE_TIME_NO_LOCALE + +} } // namespaces + +#endif // POSIX_TIME_PRE133_OPERATORS_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_system.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_system.hpp new file mode 100644 index 0000000000..3d44e0ff00 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_system.hpp @@ -0,0 +1,68 @@ +#ifndef POSIX_TIME_SYSTEM_HPP___ +#define POSIX_TIME_SYSTEM_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/posix_time/posix_time_config.hpp" +#include "boost/date_time/time_system_split.hpp" +#include "boost/date_time/time_system_counted.hpp" +#include "boost/date_time/compiler_config.hpp" + + +namespace boost { +namespace posix_time { + +#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG + +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers + typedef date_time::split_timedate_system posix_time_system; +#else + typedef date_time::split_timedate_system posix_time_system; +#endif + +#else + + typedef date_time::counted_time_rep int64_time_rep; + typedef date_time::counted_time_system posix_time_system; + +#endif + +} }//namespace posix_time + + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_types.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_types.hpp new file mode 100644 index 0000000000..f2488f8bed --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/posix_time_types.hpp @@ -0,0 +1,55 @@ +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + */ +#ifndef POSIX_TIME_TYPES_HPP___ +#define POSIX_TIME_TYPES_HPP___ + +#include "boost/date_time/time_clock.hpp" +#include "boost/date_time/microsec_time_clock.hpp" +#include "boost/date_time/posix_time/ptime.hpp" +#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES) +#include "boost/date_time/posix_time/date_duration_operators.hpp" +#endif +#include "boost/date_time/posix_time/posix_time_duration.hpp" +#include "boost/date_time/posix_time/posix_time_system.hpp" +#include "boost/date_time/posix_time/time_period.hpp" +#include "boost/date_time/time_iterator.hpp" +#include "boost/date_time/dst_rules.hpp" + +namespace boost { + +//!Defines a non-adjusted time system with nano-second resolution and stable calculation properties +namespace posix_time { + + //! Iterator over a defined time duration + /*! \ingroup time_basics + */ + typedef date_time::time_itr time_iterator; + //! A time clock that has a resolution of one second + /*! \ingroup time_basics + */ + typedef date_time::second_clock second_clock; + +#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK + //! A time clock that has a resolution of one microsecond + /*! \ingroup time_basics + */ + typedef date_time::microsec_clock microsec_clock; +#endif + + //! Define a dst null dst rule for the posix_time system + typedef date_time::null_dst_rules no_dst; + //! Define US dst rule calculator for the posix_time system + typedef date_time::us_dst_rules us_dst; + + +} } //namespace posix_time + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/ptime.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/ptime.hpp new file mode 100644 index 0000000000..2abc02d318 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/ptime.hpp @@ -0,0 +1,65 @@ +#ifndef POSIX_PTIME_HPP___ +#define POSIX_PTIME_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/posix_time/posix_time_system.hpp" +#include "boost/date_time/time.hpp" + +namespace boost { + +namespace posix_time { + + //bring special enum values into the namespace + using date_time::special_values; + using date_time::not_special; + using date_time::neg_infin; + using date_time::pos_infin; + using date_time::not_a_date_time; + using date_time::max_date_time; + using date_time::min_date_time; + + //! Time type with no timezone or other adjustments + /*! \ingroup time_basics + */ + class ptime : public date_time::base_time + { + public: + typedef posix_time_system time_system_type; + typedef time_system_type::time_rep_type time_rep_type; + typedef time_system_type::time_duration_type time_duration_type; + typedef ptime time_type; + //! Construct with date and offset in day + ptime(gregorian::date d,time_duration_type td) : date_time::base_time(d,td) + {} + //! Construct a time at start of the given day (midnight) + explicit ptime(gregorian::date d) : date_time::base_time(d,time_duration_type(0,0,0)) + {} + //! Copy from time_rep + ptime(const time_rep_type& rhs): + date_time::base_time(rhs) + {} + //! Construct from special value + ptime(const special_values sv) : date_time::base_time(sv) + {} +#if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR) + // Default constructor constructs to not_a_date_time + ptime() : date_time::base_time(gregorian::date(not_a_date_time), time_duration_type(not_a_date_time)) + {} +#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR + + }; + + + +} }//namespace posix_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_formatters.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_formatters.hpp new file mode 100644 index 0000000000..dc8facf57a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_formatters.hpp @@ -0,0 +1,289 @@ +#ifndef POSIXTIME_FORMATTERS_HPP___ +#define POSIXTIME_FORMATTERS_HPP___ + +/* Copyright (c) 2002-2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/gregorian.hpp" +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/iso_format.hpp" +#include "boost/date_time/date_format_simple.hpp" +#include "boost/date_time/posix_time/posix_time_types.hpp" +#include "boost/date_time/time_formatting_streams.hpp" + +#include "boost/date_time/time_parsing.hpp" + +/* NOTE: The "to_*_string" code for older compilers, ones that define + * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in + * formatters_limited.hpp + */ + +namespace boost { + +namespace posix_time { + + // template function called by wrapper functions: + // to_*_string(time_duration) & to_*_wstring(time_duration) + template + inline std::basic_string to_simple_string_type(time_duration td) { + std::basic_ostringstream ss; + if(td.is_special()) { + /* simply using 'ss << td.get_rep()' won't work on compilers + * that don't support locales. This way does. */ + // switch copied from date_names_put.hpp + switch(td.get_rep().as_special()) + { + case not_a_date_time: + //ss << "not-a-number"; + ss << "not-a-date-time"; + break; + case pos_infin: + ss << "+infinity"; + break; + case neg_infin: + ss << "-infinity"; + break; + default: + ss << ""; + } + } + else { + charT fill_char = '0'; + if(td.is_negative()) { + ss << '-'; + } + ss << std::setw(2) << std::setfill(fill_char) + << date_time::absolute_value(td.hours()) << ":"; + ss << std::setw(2) << std::setfill(fill_char) + << date_time::absolute_value(td.minutes()) << ":"; + ss << std::setw(2) << std::setfill(fill_char) + << date_time::absolute_value(td.seconds()); + //TODO the following is totally non-generic, yelling FIXME +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + boost::int64_t frac_sec = + date_time::absolute_value(td.fractional_seconds()); + // JDG [7/6/02 VC++ compatibility] + charT buff[32]; + _i64toa(frac_sec, buff, 10); +#else + time_duration::fractional_seconds_type frac_sec = + date_time::absolute_value(td.fractional_seconds()); +#endif + if (frac_sec != 0) { + ss << "." << std::setw(time_duration::num_fractional_digits()) + << std::setfill(fill_char) + + // JDG [7/6/02 VC++ compatibility] +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + << buff; +#else + << frac_sec; +#endif + } + }// else + return ss.str(); + } + //! Time duration to string -hh::mm::ss.fffffff. Example: 10:09:03.0123456 + /*!\ingroup time_format + */ + inline std::string to_simple_string(time_duration td) { + return to_simple_string_type(td); + } + + + // template function called by wrapper functions: + // to_*_string(time_duration) & to_*_wstring(time_duration) + template + inline std::basic_string to_iso_string_type(time_duration td) + { + std::basic_ostringstream ss; + if(td.is_special()) { + /* simply using 'ss << td.get_rep()' won't work on compilers + * that don't support locales. This way does. */ + // switch copied from date_names_put.hpp + switch(td.get_rep().as_special()) { + case not_a_date_time: + //ss << "not-a-number"; + ss << "not-a-date-time"; + break; + case pos_infin: + ss << "+infinity"; + break; + case neg_infin: + ss << "-infinity"; + break; + default: + ss << ""; + } + } + else { + charT fill_char = '0'; + if(td.is_negative()) { + ss << '-'; + } + ss << std::setw(2) << std::setfill(fill_char) + << date_time::absolute_value(td.hours()); + ss << std::setw(2) << std::setfill(fill_char) + << date_time::absolute_value(td.minutes()); + ss << std::setw(2) << std::setfill(fill_char) + << date_time::absolute_value(td.seconds()); + //TODO the following is totally non-generic, yelling FIXME +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + boost::int64_t frac_sec = + date_time::absolute_value(td.fractional_seconds()); + // JDG [7/6/02 VC++ compatibility] + charT buff[32]; + _i64toa(frac_sec, buff, 10); +#else + time_duration::fractional_seconds_type frac_sec = + date_time::absolute_value(td.fractional_seconds()); +#endif + if (frac_sec != 0) { + ss << "." << std::setw(time_duration::num_fractional_digits()) + << std::setfill(fill_char) + + // JDG [7/6/02 VC++ compatibility] +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + << buff; +#else + << frac_sec; +#endif + } + }// else + return ss.str(); + } + //! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456 + /*!\ingroup time_format + */ + inline std::string to_iso_string(time_duration td){ + return to_iso_string_type(td); + } + + //! Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff + /*!\ingroup time_format + */ + template + inline std::basic_string to_simple_string_type(ptime t) + { + // can't use this w/gcc295, no to_simple_string_type<>(td) available + std::basic_string ts = gregorian::to_simple_string_type(t.date());// + " "; + if(!t.time_of_day().is_special()) { + charT space = ' '; + return ts + space + to_simple_string_type(t.time_of_day()); + } + else { + return ts; + } + } + inline std::string to_simple_string(ptime t){ + return to_simple_string_type(t); + } + + // function called by wrapper functions to_*_string(time_period) + // & to_*_wstring(time_period) + template + inline std::basic_string to_simple_string_type(time_period tp) + { + charT beg = '[', mid = '/', end = ']'; + std::basic_string d1(to_simple_string_type(tp.begin())); + std::basic_string d2(to_simple_string_type(tp.last())); + return std::basic_string(beg + d1 + mid + d2 + end); + } + //! Convert to string of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff] + /*!\ingroup time_format + */ + inline std::string to_simple_string(time_period tp){ + return to_simple_string_type(tp); + } + + // function called by wrapper functions to_*_string(time_period) + // & to_*_wstring(time_period) + template + inline std::basic_string to_iso_string_type(ptime t) + { + std::basic_string ts = gregorian::to_iso_string_type(t.date());// + "T"; + if(!t.time_of_day().is_special()) { + charT sep = 'T'; + return ts + sep + to_iso_string_type(t.time_of_day()); + } + else { + return ts; + } + } + //! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator + /*!\ingroup time_format + */ + inline std::string to_iso_string(ptime t){ + return to_iso_string_type(t); + } + + + // function called by wrapper functions to_*_string(time_period) + // & to_*_wstring(time_period) + template + inline std::basic_string to_iso_extended_string_type(ptime t) + { + std::basic_string ts = gregorian::to_iso_extended_string_type(t.date());// + "T"; + if(!t.time_of_day().is_special()) { + charT sep = 'T'; + return ts + sep + to_simple_string_type(t.time_of_day()); + } + else { + return ts; + } + } + //! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator + /*!\ingroup time_format + */ + inline std::string to_iso_extended_string(ptime t){ + return to_iso_extended_string_type(t); + } + +#if !defined(BOOST_NO_STD_WSTRING) + //! Time duration to wstring -hh::mm::ss.fffffff. Example: 10:09:03.0123456 + /*!\ingroup time_format + */ + inline std::wstring to_simple_wstring(time_duration td) { + return to_simple_string_type(td); + } + //! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456 + /*!\ingroup time_format + */ + inline std::wstring to_iso_wstring(time_duration td){ + return to_iso_string_type(td); + } + inline std::wstring to_simple_wstring(ptime t){ + return to_simple_string_type(t); + } + //! Convert to wstring of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff] + /*!\ingroup time_format + */ + inline std::wstring to_simple_wstring(time_period tp){ + return to_simple_string_type(tp); + } + //! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator + /*!\ingroup time_format + */ + inline std::wstring to_iso_wstring(ptime t){ + return to_iso_string_type(t); + } + //! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator + /*!\ingroup time_format + */ + inline std::wstring to_iso_extended_wstring(ptime t){ + return to_iso_extended_string_type(t); + } + +#endif // BOOST_NO_STD_WSTRING + + +} } //namespace posix_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_formatters_limited.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_formatters_limited.hpp new file mode 100644 index 0000000000..def51694a1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_formatters_limited.hpp @@ -0,0 +1,211 @@ +#ifndef POSIXTIME_FORMATTERS_LIMITED_HPP___ +#define POSIXTIME_FORMATTERS_LIMITED_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/gregorian.hpp" +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/iso_format.hpp" +#include "boost/date_time/date_format_simple.hpp" +#include "boost/date_time/posix_time/posix_time_types.hpp" +#include "boost/date_time/time_formatting_streams.hpp" + +namespace boost { + +namespace posix_time { + + //! Time duration to string -hh::mm::ss.fffffff. Example: 10:09:03.0123456 + /*!\ingroup time_format + */ + inline std::string to_simple_string(time_duration td) { + std::ostringstream ss; + if(td.is_special()) { + /* simply using 'ss << td.get_rep()' won't work on compilers + * that don't support locales. This way does. */ + // switch copied from date_names_put.hpp + switch(td.get_rep().as_special()) + { + case not_a_date_time: + //ss << "not-a-number"; + ss << "not-a-date-time"; + break; + case pos_infin: + ss << "+infinity"; + break; + case neg_infin: + ss << "-infinity"; + break; + default: + ss << ""; + } + } + else { + if(td.is_negative()) { + ss << '-'; + } + ss << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.hours()) << ":"; + ss << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.minutes()) << ":"; + ss << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.seconds()); + //TODO the following is totally non-generic, yelling FIXME +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + boost::int64_t frac_sec = + date_time::absolute_value(td.fractional_seconds()); + // JDG [7/6/02 VC++ compatibility] + char buff[32]; + _i64toa(frac_sec, buff, 10); +#else + time_duration::fractional_seconds_type frac_sec = + date_time::absolute_value(td.fractional_seconds()); +#endif + if (frac_sec != 0) { + ss << "." << std::setw(time_duration::num_fractional_digits()) + << std::setfill('0') + + // JDG [7/6/02 VC++ compatibility] +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + << buff; +#else + << frac_sec; +#endif + } + }// else + return ss.str(); + } + + //! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456 + /*!\ingroup time_format + */ + inline + std::string + to_iso_string(time_duration td) + { + std::ostringstream ss; + if(td.is_special()) { + /* simply using 'ss << td.get_rep()' won't work on compilers + * that don't support locales. This way does. */ + // switch copied from date_names_put.hpp + switch(td.get_rep().as_special()) { + case not_a_date_time: + //ss << "not-a-number"; + ss << "not-a-date-time"; + break; + case pos_infin: + ss << "+infinity"; + break; + case neg_infin: + ss << "-infinity"; + break; + default: + ss << ""; + } + } + else { + if(td.is_negative()) { + ss << '-'; + } + ss << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.hours()); + ss << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.minutes()); + ss << std::setw(2) << std::setfill('0') + << date_time::absolute_value(td.seconds()); + //TODO the following is totally non-generic, yelling FIXME +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + boost::int64_t frac_sec = + date_time::absolute_value(td.fractional_seconds()); + // JDG [7/6/02 VC++ compatibility] + char buff[32]; + _i64toa(frac_sec, buff, 10); +#else + time_duration::fractional_seconds_type frac_sec = + date_time::absolute_value(td.fractional_seconds()); +#endif + if (frac_sec != 0) { + ss << "." << std::setw(time_duration::num_fractional_digits()) + << std::setfill('0') + + // JDG [7/6/02 VC++ compatibility] +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + << buff; +#else + << frac_sec; +#endif + } + }// else + return ss.str(); + } + + //! Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff + /*!\ingroup time_format + */ + inline + std::string + to_simple_string(ptime t) + { + std::string ts = gregorian::to_simple_string(t.date());// + " "; + if(!t.time_of_day().is_special()) { + return ts + " " + to_simple_string(t.time_of_day()); + } + else { + return ts; + } + } + + //! Convert to string of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff] + /*!\ingroup time_format + */ + inline + std::string + to_simple_string(time_period tp) + { + std::string d1(to_simple_string(tp.begin())); + std::string d2(to_simple_string(tp.last())); + return std::string("[" + d1 + "/" + d2 +"]"); + } + + //! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator + /*!\ingroup time_format + */ + inline + std::string to_iso_string(ptime t) + { + std::string ts = gregorian::to_iso_string(t.date());// + "T"; + if(!t.time_of_day().is_special()) { + return ts + "T" + to_iso_string(t.time_of_day()); + } + else { + return ts; + } + } + + //! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator + /*!\ingroup time_format + */ + inline + std::string + to_iso_extended_string(ptime t) + { + std::string ts = gregorian::to_iso_extended_string(t.date());// + "T"; + if(!t.time_of_day().is_special()) { + return ts + "T" + to_simple_string(t.time_of_day()); + } + else { + return ts; + } + } + + +} } //namespace posix_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_parsers.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_parsers.hpp new file mode 100644 index 0000000000..8a352f6e2b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_parsers.hpp @@ -0,0 +1,44 @@ +#ifndef POSIXTIME_PARSERS_HPP___ +#define POSIXTIME_PARSERS_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/gregorian/gregorian.hpp" +#include "boost/date_time/time_parsing.hpp" +#include "boost/date_time/posix_time/posix_time_types.hpp" + + +namespace boost { + +namespace posix_time { + + //! Creates a time_duration object from a delimited string + /*! Expected format for string is "[-]h[h][:mm][:ss][.fff]". + * A negative duration will be created if the first character in + * string is a '-', all other '-' will be treated as delimiters. + * Accepted delimiters are "-:,.". */ + inline time_duration duration_from_string(const std::string& s) { + return date_time::parse_delimited_time_duration(s); + } + + inline ptime time_from_string(const std::string& s) { + return date_time::parse_delimited_time(s, ' '); + } + + inline ptime from_iso_string(const std::string& s) { + return date_time::parse_iso_time(s, 'T'); + } + + + +} } //namespace posix_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_period.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_period.hpp new file mode 100644 index 0000000000..cb7bf07f47 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_period.hpp @@ -0,0 +1,29 @@ +#ifndef POSIX_TIME_PERIOD_HPP___ +#define POSIX_TIME_PERIOD_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/period.hpp" +#include "boost/date_time/posix_time/posix_time_duration.hpp" +#include "boost/date_time/posix_time/ptime.hpp" + +namespace boost { +namespace posix_time { + + //! Time period type + /*! \ingroup time_basics + */ + typedef date_time::period time_period; + + +} }//namespace posix_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_serialize.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_serialize.hpp new file mode 100644 index 0000000000..acadd57bb3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/posix_time/time_serialize.hpp @@ -0,0 +1,200 @@ +#ifndef POSIX_TIME_SERIALIZE_HPP___ +#define POSIX_TIME_SERIALIZE_HPP___ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/posix_time/posix_time.hpp" +#include "boost/date_time/gregorian/greg_serialize.hpp" +#include "boost/serialization/split_free.hpp" + + +// macros to split serialize functions into save & load functions +// NOTE: these macros define template functions in the boost::serialization namespace. +// They must be expanded *outside* of any namespace +BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::ptime) +BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::time_duration) +BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::time_period) + +namespace boost { +namespace serialization { + + +/*** time_duration ***/ + +//! Function to save posix_time::time_duration objects using serialization lib +/*! time_duration objects are broken down into 4 parts for serialization: + * types are hour_type, min_type, sec_type, and fractional_seconds_type + * as defined in the time_duration class + */ +template +void save(Archive & ar, + const posix_time::time_duration& td, + unsigned int /*version*/) +{ + // serialize a bool so we know how to read this back in later + bool is_special = td.is_special(); + ar & make_nvp("is_special", is_special); + if(is_special) { + std::string s = to_simple_string(td); + ar & make_nvp("sv_time_duration", s); + } + else { + typename posix_time::time_duration::hour_type h = td.hours(); + typename posix_time::time_duration::min_type m = td.minutes(); + typename posix_time::time_duration::sec_type s = td.seconds(); + typename posix_time::time_duration::fractional_seconds_type fs = td.fractional_seconds(); + ar & make_nvp("time_duration_hours", h); + ar & make_nvp("time_duration_minutes", m); + ar & make_nvp("time_duration_seconds", s); + ar & make_nvp("time_duration_fractional_seconds", fs); + } +} + +//! Function to load posix_time::time_duration objects using serialization lib +/*! time_duration objects are broken down into 4 parts for serialization: + * types are hour_type, min_type, sec_type, and fractional_seconds_type + * as defined in the time_duration class + */ +template +void load(Archive & ar, + posix_time::time_duration & td, + unsigned int /*version*/) +{ + bool is_special = false; + ar & make_nvp("is_special", is_special); + if(is_special) { + std::string s; + ar & make_nvp("sv_time_duration", s); + posix_time::special_values sv = gregorian::special_value_from_string(s); + td = posix_time::time_duration(sv); + } + else { + typename posix_time::time_duration::hour_type h(0); + typename posix_time::time_duration::min_type m(0); + typename posix_time::time_duration::sec_type s(0); + typename posix_time::time_duration::fractional_seconds_type fs(0); + ar & make_nvp("time_duration_hours", h); + ar & make_nvp("time_duration_minutes", m); + ar & make_nvp("time_duration_seconds", s); + ar & make_nvp("time_duration_fractional_seconds", fs); + td = posix_time::time_duration(h,m,s,fs); + } +} + +// no load_construct_data function provided as time_duration provides a +// default constructor + +/*** ptime ***/ + +//! Function to save posix_time::ptime objects using serialization lib +/*! ptime objects are broken down into 2 parts for serialization: + * a date object and a time_duration onject + */ +template +void save(Archive & ar, + const posix_time::ptime& pt, + unsigned int /*version*/) +{ + // from_iso_string does not include fractional seconds + // therefore date and time_duration are used + typename posix_time::ptime::date_type d = pt.date(); + ar & make_nvp("ptime_date", d); + if(!pt.is_special()) { + typename posix_time::ptime::time_duration_type td = pt.time_of_day(); + ar & make_nvp("ptime_time_duration", td); + } +} + +//! Function to load posix_time::ptime objects using serialization lib +/*! ptime objects are broken down into 2 parts for serialization: + * a date object and a time_duration onject + */ +template +void load(Archive & ar, + posix_time::ptime & pt, + unsigned int /*version*/) +{ + // from_iso_string does not include fractional seconds + // therefore date and time_duration are used + typename posix_time::ptime::date_type d(posix_time::not_a_date_time); + typename posix_time::ptime::time_duration_type td; + ar & make_nvp("ptime_date", d); + if(!d.is_special()) { + ar & make_nvp("ptime_time_duration", td); + pt = boost::posix_time::ptime(d,td); + } + else { + pt = boost::posix_time::ptime(d.as_special()); + } + +} + +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + posix_time::ptime* pt, + const unsigned int /*file_version*/) +{ + // retrieve data from archive required to construct new + // invoke inplace constructor to initialize instance of date + new(pt) boost::posix_time::ptime(boost::posix_time::not_a_date_time); +} + +/*** time_period ***/ + +//! Function to save posix_time::time_period objects using serialization lib +/*! time_period objects are broken down into 2 parts for serialization: + * a begining ptime object and an ending ptime object + */ +template +void save(Archive & ar, + const posix_time::time_period& tp, + unsigned int /*version*/) +{ + posix_time::ptime beg(tp.begin().date(), tp.begin().time_of_day()); + posix_time::ptime end(tp.end().date(), tp.end().time_of_day()); + ar & make_nvp("time_period_begin", beg); + ar & make_nvp("time_period_end", end); +} + +//! Function to load posix_time::time_period objects using serialization lib +/*! time_period objects are broken down into 2 parts for serialization: + * a begining ptime object and an ending ptime object + */ +template +void load(Archive & ar, + boost::posix_time::time_period & tp, + unsigned int /*version*/) +{ + posix_time::time_duration td(1,0,0); + gregorian::date d(gregorian::not_a_date_time); + posix_time::ptime beg(d,td); + posix_time::ptime end(d,td); + ar & make_nvp("time_period_begin", beg); + ar & make_nvp("time_period_end", end); + tp = boost::posix_time::time_period(beg, end); +} + +//!override needed b/c no default constructor +template +inline void load_construct_data(Archive & ar, + boost::posix_time::time_period* tp, + const unsigned int /*file_version*/) +{ + posix_time::time_duration td(1,0,0); + gregorian::date d(gregorian::not_a_date_time); + posix_time::ptime beg(d,td); + posix_time::ptime end(d,td); + new(tp) boost::posix_time::time_period(beg,end); +} + +} // namespace serialization +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_defs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_defs.hpp new file mode 100644 index 0000000000..56eb6fea1d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_defs.hpp @@ -0,0 +1,25 @@ +#ifndef DATE_TIME_SPECIAL_DEFS_HPP__ +#define DATE_TIME_SPECIAL_DEFS_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +namespace boost { +namespace date_time { + + enum special_values {not_a_date_time, + neg_infin, pos_infin, + min_date_time, max_date_time, + not_special, NumSpecialValues}; + + +} } //namespace date_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_values_formatter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_values_formatter.hpp new file mode 100644 index 0000000000..33542b6e42 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_values_formatter.hpp @@ -0,0 +1,96 @@ + +#ifndef DATETIME_SPECIAL_VALUE_FORMATTER_HPP___ +#define DATETIME_SPECIAL_VALUE_FORMATTER_HPP___ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include +#include "boost/date_time/special_defs.hpp" + +namespace boost { namespace date_time { + + + //! Class that provides generic formmatting ostream formatting for special values + /*! This class provides for the formmating of special values to an output stream. + * In particular, it produces strings for the values of negative and positive + * infinity as well as not_a_date_time. + * + * While not a facet, this class is used by the date and time facets for formatting + * special value types. + * + */ + template > > + class special_values_formatter + { + public: + typedef std::basic_string string_type; + typedef CharT char_type; + typedef std::vector collection_type; + static const char_type default_special_value_names[3][17]; + + //! Construct special values formatter using default strings. + /*! Default strings are not-a-date-time -infinity +infinity + */ + special_values_formatter() + { + std::copy(&default_special_value_names[0], + &default_special_value_names[3], + std::back_inserter(m_special_value_names)); + } + + //! Construct special values formatter from array of strings + /*! This constructor will take pair of iterators from an array of strings + * that represent the special values and copy them for use in formatting + * special values. + *@code + * const char* const special_value_names[]={"nadt","-inf","+inf" }; + * + * special_value_formatter svf(&special_value_names[0], &special_value_names[3]); + *@endcode + */ + special_values_formatter(const char_type* const* begin, const char_type* const* end) + { + std::copy(begin, end, std::back_inserter(m_special_value_names)); + } + special_values_formatter(typename collection_type::iterator beg, typename collection_type::iterator end) + { + std::copy(beg, end, std::back_inserter(m_special_value_names)); + } + + OutItrT put_special(OutItrT next, + const boost::date_time::special_values& value) const + { + + unsigned int index = value; + if (index < m_special_value_names.size()) { + std::copy(m_special_value_names[index].begin(), + m_special_value_names[index].end(), + next); + } + return next; + } + protected: + collection_type m_special_value_names; + }; + + //! Storage for the strings used to indicate special values + /* using c_strings to initialize these worked fine in testing, however, + * a project that compiled its objects separately, then linked in a separate + * step wound up with redefinition errors for the values in this array. + * Initializing individual characters eliminated this problem */ + template + const typename special_values_formatter::char_type special_values_formatter::default_special_value_names[3][17] = { + {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'}, + {'-','i','n','f','i','n','i','t','y'}, + {'+','i','n','f','i','n','i','t','y'} }; + + } } //namespace boost::date_time + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_values_parser.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_values_parser.hpp new file mode 100644 index 0000000000..e48ec5fda9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/special_values_parser.hpp @@ -0,0 +1,159 @@ + +#ifndef DATE_TIME_SPECIAL_VALUES_PARSER_HPP__ +#define DATE_TIME_SPECIAL_VALUES_PARSER_HPP__ + +/* Copyright (c) 2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: + */ + + +#include "boost/date_time/string_parse_tree.hpp" +#include "boost/date_time/special_defs.hpp" +#include +#include + +namespace boost { namespace date_time { + + //! Class for special_value parsing + /*! + * TODO: add doc-comments for which elements can be changed + * Parses input stream for strings representing special_values. + * Special values parsed are: + * - not_a_date_time + * - neg_infin + * - pod_infin + * - min_date_time + * - max_date_time + */ + template + class special_values_parser + { + public: + typedef std::basic_string string_type; + //typedef std::basic_stringstream stringstream_type; + typedef std::istreambuf_iterator stream_itr_type; + //typedef typename string_type::const_iterator const_itr; + //typedef typename date_type::year_type year_type; + //typedef typename date_type::month_type month_type; + typedef typename date_type::duration_type duration_type; + //typedef typename date_type::day_of_week_type day_of_week_type; + //typedef typename date_type::day_type day_type; + typedef string_parse_tree parse_tree_type; + typedef typename parse_tree_type::parse_match_result_type match_results; + typedef std::vector > collection_type; + + typedef charT char_type; + static const char_type nadt_string[16]; + static const char_type neg_inf_string[10]; + static const char_type pos_inf_string[10]; + static const char_type min_date_time_string[18]; + static const char_type max_date_time_string[18]; + + //! Creates a special_values_parser with the default set of "sv_strings" + special_values_parser() + { + sv_strings(string_type(nadt_string), + string_type(neg_inf_string), + string_type(pos_inf_string), + string_type(min_date_time_string), + string_type(max_date_time_string)); + } + + //! Creates a special_values_parser using a user defined set of element strings + special_values_parser(const string_type& nadt_str, + const string_type& neg_inf_str, + const string_type& pos_inf_str, + const string_type& min_dt_str, + const string_type& max_dt_str) + { + sv_strings(nadt_str, neg_inf_str, pos_inf_str, min_dt_str, max_dt_str); + } + + special_values_parser(typename collection_type::iterator beg, typename collection_type::iterator end) + { + collection_type phrases; + std::copy(beg, end, std::back_inserter(phrases)); + m_sv_strings = parse_tree_type(phrases, static_cast(not_a_date_time)); + } + + special_values_parser(const special_values_parser& svp) + { + this->m_sv_strings = svp.m_sv_strings; + } + + //! Replace special value strings + void sv_strings(const string_type& nadt_str, + const string_type& neg_inf_str, + const string_type& pos_inf_str, + const string_type& min_dt_str, + const string_type& max_dt_str) + { + collection_type phrases; + phrases.push_back(nadt_str); + phrases.push_back(neg_inf_str); + phrases.push_back(pos_inf_str); + phrases.push_back(min_dt_str); + phrases.push_back(max_dt_str); + m_sv_strings = parse_tree_type(phrases, static_cast(not_a_date_time)); + } + + /* Does not return a special_value because if the parsing fails, + * the return value will always be not_a_date_time + * (mr.current_match retains its default value of -1 on a failed + * parse and that casts to not_a_date_time). */ + //! Sets match_results.current_match to the corresponding special_value or -1 + bool match(stream_itr_type& sitr, + stream_itr_type& str_end, + match_results& mr) const + { + unsigned int level = 0; + m_sv_strings.match(sitr, str_end, mr, level); + return (mr.current_match != match_results::PARSE_ERROR); + } + /*special_values match(stream_itr_type& sitr, + stream_itr_type& str_end, + match_results& mr) const + { + unsigned int level = 0; + m_sv_strings.match(sitr, str_end, mr, level); + if(mr.current_match == match_results::PARSE_ERROR) { + throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"); + } + return static_cast(mr.current_match); + }*/ + + + private: + parse_tree_type m_sv_strings; + + }; + + template + const typename special_values_parser::char_type + special_values_parser::nadt_string[16] = + {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'}; + template + const typename special_values_parser::char_type + special_values_parser::neg_inf_string[10] = + {'-','i','n','f','i','n','i','t','y'}; + template + const typename special_values_parser::char_type + special_values_parser::pos_inf_string[10] = + {'+','i','n','f','i','n','i','t','y'}; + template + const typename special_values_parser::char_type + special_values_parser::min_date_time_string[18] = + {'m','i','n','i','m','u','m','-','d','a','t','e','-','t','i','m','e'}; + template + const typename special_values_parser::char_type + special_values_parser::max_date_time_string[18] = + {'m','a','x','i','m','u','m','-','d','a','t','e','-','t','i','m','e'}; + +} } //namespace + +#endif // DATE_TIME_SPECIAL_VALUES_PARSER_HPP__ + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/string_convert.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/string_convert.hpp new file mode 100644 index 0000000000..54a979c70f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/string_convert.hpp @@ -0,0 +1,33 @@ +#ifndef _STRING_CONVERT_HPP___ +#define _STRING_CONVERT_HPP___ + +/* Copyright (c) 2005 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/compiler_config.hpp" +#include + +namespace boost { +namespace date_time { + + //! Converts a string from one value_type to another + /*! Converts a wstring to a string (or a string to wstring). If both template parameters + * are of same type, a copy of the input string is returned. */ + template + inline + std::basic_string convert_string_type(const std::basic_string& inp_str) + { + typedef std::basic_string input_type; + typedef std::basic_string output_type; + output_type result; + result.insert(result.begin(), inp_str.begin(), inp_str.end()); + return result; + } + +}} // namespace boost::date_time + +#endif // _STRING_CONVERT_HPP___ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/string_parse_tree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/string_parse_tree.hpp new file mode 100644 index 0000000000..1ed5fe8db9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/string_parse_tree.hpp @@ -0,0 +1,278 @@ +#ifndef BOOST_DATE_TIME_STRING_PARSE_TREE___HPP__ +#define BOOST_DATE_TIME_STRING_PARSE_TREE___HPP__ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/lexical_cast.hpp" //error without? +#include "boost/algorithm/string/case_conv.hpp" +#include +#include +#include +#include + +namespace boost { namespace date_time { + + +template +struct parse_match_result +{ + parse_match_result() : + match_depth(0), + current_match(-1)// -1 is match_not-found value + {} + typedef std::basic_string string_type; + string_type remaining() const + { + if (match_depth == cache.size()) { + return string_type(); + } + if (current_match == -1) { + return cache; + } + //some of the cache was used return the rest + return string_type(cache, match_depth); + } + charT last_char() const + { + return cache[cache.size()-1]; + } + //! Returns true if more characters were parsed than was necessary + /*! Should be used in conjunction with last_char() + * to get the remaining character. + */ + bool has_remaining() const + { + return (cache.size() > match_depth); + } + + // cache will hold characters that have been read from the stream + string_type cache; + unsigned short match_depth; + short current_match; + enum PARSE_STATE { PARSE_ERROR= -1 }; +}; + + //for debug -- really only char streams... +template +std::basic_ostream& +operator<<(std::basic_ostream& os, parse_match_result& mr) +{ + os << "cm: " << mr.current_match + << " C: '" << mr.cache + << "' md: " << mr.match_depth + << " R: " << mr.remaining(); + return os; +} + + + +//! Recursive data structure to allow efficient parsing of various strings +/*! This class provides a quick lookup by building what amounts to a + * tree data structure. It also features a match function which can + * can handle nasty input interators by caching values as it recurses + * the tree so that it can backtrack as needed. + */ +template +struct string_parse_tree +{ +#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) + typedef std::multimap > ptree_coll; +#else + typedef std::multimap ptree_coll; +#endif + typedef typename ptree_coll::value_type value_type; + typedef typename ptree_coll::iterator iterator; + typedef typename ptree_coll::const_iterator const_iterator; + typedef std::basic_string string_type; + typedef std::vector > collection_type; + typedef parse_match_result parse_match_result_type; + + /*! Parameter "starting_point" desingates where the numbering begins. + * A starting_point of zero will start the numbering at zero + * (Sun=0, Mon=1, ...) were a starting_point of one starts the + * numbering at one (Jan=1, Feb=2, ...). The default is zero, + * negative vaules are not allowed */ + string_parse_tree(collection_type names, unsigned int starting_point=0) + { + // iterate thru all the elements and build the tree + unsigned short index = 0; + while (index != names.size() ) { + string_type s = boost::algorithm::to_lower_copy(names[index]); + insert(s, static_cast(index + starting_point)); + index++; + } + //set the last tree node = index+1 indicating a value + index++; + } + + + string_parse_tree(short value = -1) : + m_value(value) + {} + ptree_coll m_next_chars; + short m_value; + + void insert(const string_type& s, unsigned short value) + { + unsigned int i = 0; + iterator ti; + while(i < s.size()) { + if (i==0) { + if (i == (s.size()-1)) { + ti = m_next_chars.insert(value_type(s[i], + string_parse_tree(value))); + } + else { + ti = m_next_chars.insert(value_type(s[i], + string_parse_tree())); + } + } + else { + if (i == (s.size()-1)) { + ti = ti->second.m_next_chars.insert(value_type(s[i], + string_parse_tree(value))); + } + + else { + ti = ti->second.m_next_chars.insert(value_type(s[i], + string_parse_tree())); + } + + } + i++; + } + } + + + //! Recursive function that finds a matching string in the tree. + /*! Must check match_results::has_remaining() after match() is + * called. This is required so the user can determine if + * stream iterator is already pointing to the expected + * character or not (match() might advance sitr to next char in stream). + * + * A parse_match_result that has been returned from a failed match + * attempt can be sent in to the match function of a different + * string_parse_tree to attempt a match there. Use the iterators + * for the partially consumed stream, the parse_match_result object, + * and '0' for the level parameter. */ + short + match(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end, + parse_match_result_type& result, + unsigned int& level) const + { + + level++; + charT c; + // if we conditionally advance sitr, we won't have + // to consume the next character past the input + bool adv_itr = true; + if (level > result.cache.size()) { + if (sitr == stream_end) return 0; //bail - input exhausted + c = static_cast(std::tolower(*sitr)); + //result.cache += c; + //sitr++; + } + else { + // if we're looking for characters from the cache, + // we don't want to increment sitr + adv_itr = false; + c = static_cast(std::tolower(result.cache[level-1])); + } + const_iterator litr = m_next_chars.lower_bound(c); + const_iterator uitr = m_next_chars.upper_bound(c); + while (litr != uitr) { // equal if not found + if(adv_itr) { + sitr++; + result.cache += c; + } + if (litr->second.m_value != -1) { // -1 is default value + if (result.match_depth < level) { + result.current_match = litr->second.m_value; + result.match_depth = static_cast(level); + } + litr->second.match(sitr, stream_end, + result, level); + level--; + } + else { + litr->second.match(sitr, stream_end, + result, level); + level--; + } + + if(level <= result.cache.size()) { + adv_itr = false; + } + + litr++; + } + return result.current_match; + + } + + /*! Must check match_results::has_remaining() after match() is + * called. This is required so the user can determine if + * stream iterator is already pointing to the expected + * character or not (match() might advance sitr to next char in stream). + */ + parse_match_result_type + match(std::istreambuf_iterator& sitr, + std::istreambuf_iterator& stream_end) const + { + // lookup to_lower of char in tree. + unsigned int level = 0; + // string_type cache; + parse_match_result_type result; + match(sitr, stream_end, result, level); + return result; + } + + void printme(std::ostream& os, int& level) + { + level++; + iterator itr = m_next_chars.begin(); + iterator end = m_next_chars.end(); + // os << "starting level: " << level << std::endl; + while (itr != end) { + os << "level: " << level + << " node: " << itr->first + << " value: " << itr->second.m_value + << std::endl; + itr->second.printme(os, level); + itr++; + } + level--; + } + + void print(std::ostream& os) + { + int level = 0; + printme(os, level); + } + + void printmatch(std::ostream& os, charT c) + { + iterator litr = m_next_chars.lower_bound(c); + iterator uitr = m_next_chars.upper_bound(c); + os << "matches for: " << c << std::endl; + while (litr != uitr) { + os << " node: " << litr->first + << " value: " << litr->second.m_value + << std::endl; + litr++; + } + } + +}; + + +} } //namespace +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/strings_from_facet.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/strings_from_facet.hpp new file mode 100644 index 0000000000..1d1b234143 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/strings_from_facet.hpp @@ -0,0 +1,123 @@ +#ifndef DATE_TIME_STRINGS_FROM_FACET__HPP___ +#define DATE_TIME_STRINGS_FROM_FACET__HPP___ + +/* Copyright (c) 2004 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include +#include +#include +#include + +namespace boost { namespace date_time { + +//! This function gathers up all the month strings from a std::locale +/*! Using the time_put facet, this function creates a collection of + * all the month strings from a locale. This is handy when building + * custom date parsers or formatters that need to be localized. + * + *@param charT The type of char to use when gathering typically char + * or wchar_t. + *@param locale The locale to use when gathering the strings + *@param short_strings True(default) to gather short strings, + * false for long strings. + *@return A vector of strings containing the strings in order. eg: + * Jan, Feb, Mar, etc. + */ +template +std::vector > +gather_month_strings(const std::locale& locale, bool short_strings=true) +{ + typedef std::basic_string string_type; + typedef std::vector collection_type; + typedef std::basic_ostringstream ostream_type; + typedef std::ostreambuf_iterator ostream_iter_type; + typedef std::basic_ostringstream stringstream_type; + typedef std::time_put time_put_facet_type; + charT short_fmt[3] = { '%', 'b' }; + charT long_fmt[3] = { '%', 'B' }; + collection_type months; + string_type outfmt(short_fmt); + if (!short_strings) { + outfmt = long_fmt; + } + { + //grab the needed strings by using the locale to + //output each month + for (int m=0; m < 12; m++) { + tm tm_value; + tm_value.tm_mon = m; + stringstream_type ss; + ostream_iter_type oitr(ss); + std::use_facet(locale).put(oitr, ss, ss.fill(), + &tm_value, + &*outfmt.begin(), + &*outfmt.begin()+outfmt.size()); + months.push_back(ss.str()); + } + } + return months; +} + +//! This function gathers up all the weekday strings from a std::locale +/*! Using the time_put facet, this function creates a collection of + * all the weekday strings from a locale starting with the string for + * 'Sunday'. This is handy when building custom date parsers or + * formatters that need to be localized. + * + *@param charT The type of char to use when gathering typically char + * or wchar_t. + *@param locale The locale to use when gathering the strings + *@param short_strings True(default) to gather short strings, + * false for long strings. + *@return A vector of strings containing the weekdays in order. eg: + * Sun, Mon, Tue, Wed, Thu, Fri, Sat + */ +template +std::vector > +gather_weekday_strings(const std::locale& locale, bool short_strings=true) +{ + typedef std::basic_string string_type; + typedef std::vector collection_type; + typedef std::basic_ostringstream ostream_type; + typedef std::ostreambuf_iterator ostream_iter_type; + typedef std::basic_ostringstream stringstream_type; + typedef std::time_put time_put_facet_type; + charT short_fmt[3] = { '%', 'a' }; + charT long_fmt[3] = { '%', 'A' }; + + collection_type weekdays; + + + string_type outfmt(short_fmt); + if (!short_strings) { + outfmt = long_fmt; + } + { + //grab the needed strings by using the locale to + //output each month / weekday + for (int i=0; i < 7; i++) { + tm tm_value; + tm_value.tm_wday = i; + stringstream_type ss; + ostream_iter_type oitr(ss); + std::use_facet(locale).put(oitr, ss, ss.fill(), + &tm_value, + &*outfmt.begin(), + &*outfmt.begin()+outfmt.size()); + + weekdays.push_back(ss.str()); + } + } + return weekdays; +} + +} } //namespace + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/testfrmwk.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/testfrmwk.hpp new file mode 100644 index 0000000000..9a9ae9121f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/testfrmwk.hpp @@ -0,0 +1,66 @@ + +#ifndef TEST_FRMWK_HPP___ +#define TEST_FRMWK_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * $Date: 2008-03-26 17:16:15 -0400 (Wed, 26 Mar 2008) $ + */ + + +#include +#include + +//! Really simple test framework for counting and printing +class TestStats +{ +public: + static TestStats& instance() {static TestStats ts; return ts;} + void addPassingTest() {testcount_++; passcount_++;} + void addFailingTest() {testcount_++;} + unsigned int testcount() const {return testcount_;} + unsigned int passcount() const {return passcount_;} + void print(std::ostream& out = std::cout) const + { + out << testcount_ << " Tests Executed: " ; + if (passcount() != testcount()) { + out << (testcount() - passcount()) << " FAILURES"; + } + else { + out << "All Succeeded" << std::endl; + } + out << std::endl; + } +private: + TestStats() : testcount_(0), passcount_(0) {} + unsigned int testcount_; + unsigned int passcount_; +}; + + +bool check(const std::string& testname, bool testcond) +{ + TestStats& stat = TestStats::instance(); + if (testcond) { + std::cout << "Pass :: " << testname << " " << std::endl; + stat.addPassingTest(); + return true; + } + else { + stat.addFailingTest(); + std::cout << "FAIL :: " << testname << " " << std::endl; + return false; + } +} + + +int printTestStats() +{ + TestStats& stat = TestStats::instance(); + stat.print(); + return stat.testcount() - stat.passcount(); +} + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time.hpp new file mode 100644 index 0000000000..58ac8d6567 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time.hpp @@ -0,0 +1,190 @@ +#ifndef DATE_TIME_TIME_HPP___ +#define DATE_TIME_TIME_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +/*! @file time.hpp + This file contains the interface for the time associated classes. +*/ +#include "boost/date_time/time_defs.hpp" +#include "boost/operators.hpp" +#include + +namespace boost { +namespace date_time { + + //! Representation of a precise moment in time, including the date. + /*! + This class is a skeleton for the interface of a temporal type + with a resolution that is higher than a day. It is intended that + this class be the base class and that the actual time + class be derived using the BN pattern. In this way, the derived + class can make decisions such as 'should there be a default constructor' + and what should it set its value to, should there be optional constructors + say allowing only an time_durations that generate a time from a clock,etc. + So, in fact multiple time types can be created for a time_system with + different construction policies, and all of them can perform basic + operations by only writing a copy constructor. Finally, compiler + errors are also shorter. + + The real behavior of the time class is provided by the time_system + template parameter. This class must provide all the logic + for addition, subtraction, as well as define all the interface + types. + + */ + + template + class base_time : private + boost::less_than_comparable > + { + public: + typedef T time_type; + typedef typename time_system::time_rep_type time_rep_type; + typedef typename time_system::date_type date_type; + typedef typename time_system::date_duration_type date_duration_type; + typedef typename time_system::time_duration_type time_duration_type; + //typedef typename time_system::hms_type hms_type; + + base_time(const date_type& day, + const time_duration_type& td, + dst_flags dst=not_dst) : + time_(time_system::get_time_rep(day, td, dst)) + {} + base_time(special_values sv) : + time_(time_system::get_time_rep(sv)) + {} + base_time(const time_rep_type& rhs) : + time_(rhs) + {} + date_type date() const + { + return time_system::get_date(time_); + } + time_duration_type time_of_day() const + { + return time_system::get_time_of_day(time_); + } + /*! Optional bool parameter will return time zone as an offset + * (ie "+07:00"). Empty string is returned for classes that do + * not use a time_zone */ + std::string zone_name(bool as_offset=false) const + { + return time_system::zone_name(time_); + } + /*! Optional bool parameter will return time zone as an offset + * (ie "+07:00"). Empty string is returned for classes that do + * not use a time_zone */ + std::string zone_abbrev(bool as_offset=false) const + { + return time_system::zone_name(time_); + } + //! An empty string is returned for classes that do not use a time_zone + std::string zone_as_posix_string() const + { + return std::string(""); + } + + //! check to see if date is not a value + bool is_not_a_date_time() const + { + return time_.is_not_a_date_time(); + } + //! check to see if date is one of the infinity values + bool is_infinity() const + { + return (is_pos_infinity() || is_neg_infinity()); + } + //! check to see if date is greater than all possible dates + bool is_pos_infinity() const + { + return time_.is_pos_infinity(); + } + //! check to see if date is greater than all possible dates + bool is_neg_infinity() const + { + return time_.is_neg_infinity(); + } + //! check to see if time is a special value + bool is_special() const + { + return(is_not_a_date_time() || is_infinity()); + } + //!Equality operator -- others generated by boost::equality_comparable + bool operator==(const time_type& rhs) const + { + return time_system::is_equal(time_,rhs.time_); + } + //!Equality operator -- others generated by boost::less_than_comparable + bool operator<(const time_type& rhs) const + { + return time_system::is_less(time_,rhs.time_); + } + //! difference between two times + time_duration_type operator-(const time_type& rhs) const + { + return time_system::subtract_times(time_, rhs.time_); + } + //! add date durations + time_type operator+(const date_duration_type& dd) const + { + return time_system::add_days(time_, dd); + } + time_type operator+=(const date_duration_type& dd) + { + time_ = (time_system::get_time_rep(date() + dd, time_of_day())); + return time_type(time_); + } + //! subtract date durations + time_type operator-(const date_duration_type& dd) const + { + return time_system::subtract_days(time_, dd); + } + time_type operator-=(const date_duration_type& dd) + { + time_ = (time_system::get_time_rep(date() - dd, time_of_day())); + return time_type(time_); + } + //! add time durations + time_type operator+(const time_duration_type& td) const + { + return time_type(time_system::add_time_duration(time_, td)); + } + time_type operator+=(const time_duration_type& td) + { + time_ = (time_system::get_time_rep(date(), time_of_day() + td)); + return time_type(time_); + } + //! subtract time durations + time_type operator-(const time_duration_type& rhs) const + { + return time_system::subtract_time_duration(time_, rhs); + } + time_type operator-=(const time_duration_type& td) + { + time_ = (time_system::get_time_rep(date(), time_of_day() - td)); + return time_type(time_); + } + + protected: + time_rep_type time_; + }; + + + + + +} } //namespace date_time::boost + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_clock.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_clock.hpp new file mode 100644 index 0000000000..1ea5d2e8bd --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_clock.hpp @@ -0,0 +1,83 @@ +#ifndef DATE_TIME_TIME_CLOCK_HPP___ +#define DATE_TIME_TIME_CLOCK_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +/*! @file time_clock.hpp + This file contains the interface for clock devices. +*/ + +#include "boost/date_time/c_time.hpp" +#include "boost/shared_ptr.hpp" + +namespace boost { +namespace date_time { + + + //! A clock providing time level services based on C time_t capabilities + /*! This clock provides resolution to the 1 second level + */ + template + class second_clock + { + public: + typedef typename time_type::date_type date_type; + typedef typename time_type::time_duration_type time_duration_type; + + static time_type local_time() + { + ::std::time_t t; + ::std::time(&t); + ::std::tm curr, *curr_ptr; + //curr_ptr = ::std::localtime(&t); + curr_ptr = c_time::localtime(&t, &curr); + return create_time(curr_ptr); + } + + + //! Get the current day in universal date as a ymd_type + static time_type universal_time() + { + + ::std::time_t t; + ::std::time(&t); + ::std::tm curr, *curr_ptr; + //curr_ptr = ::std::gmtime(&t); + curr_ptr = c_time::gmtime(&t, &curr); + return create_time(curr_ptr); + } + + template + static time_type local_time(boost::shared_ptr tz_ptr) + { + typedef typename time_type::utc_time_type utc_time_type; + utc_time_type utc_time = second_clock::universal_time(); + return time_type(utc_time, tz_ptr); + } + + + private: + static time_type create_time(::std::tm* current) + { + date_type d(static_cast(current->tm_year + 1900), + static_cast(current->tm_mon + 1), + static_cast(current->tm_mday)); + time_duration_type td(current->tm_hour, + current->tm_min, + current->tm_sec); + return time_type(d,td); + } + + }; + + +} } //namespace date_time + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_defs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_defs.hpp new file mode 100644 index 0000000000..312c5df27d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_defs.hpp @@ -0,0 +1,33 @@ +#ifndef DATE_TIME_TIME_PRECISION_LIMITS_HPP +#define DATE_TIME_TIME_PRECISION_LIMITS_HPP + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + + +/*! \file time_defs.hpp + This file contains nice definitions for handling the resoluion of various time + reprsentations. +*/ + +namespace boost { +namespace date_time { + + //!Defines some nice types for handling time level resolutions + enum time_resolutions {sec, tenth, hundreth, milli, ten_thousandth, micro, nano, NumResolutions }; + + //! Flags for daylight savings or summer time + enum dst_flags {not_dst, is_dst, calculate}; + + +} } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_duration.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_duration.hpp new file mode 100644 index 0000000000..40041250d3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_duration.hpp @@ -0,0 +1,281 @@ +#ifndef DATE_TIME_TIME_DURATION_HPP___ +#define DATE_TIME_TIME_DURATION_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/operators.hpp" +#include "boost/date_time/time_defs.hpp" +#include "boost/date_time/special_defs.hpp" +#include "boost/date_time/compiler_config.hpp" + +namespace boost { +namespace date_time { + + + //! Represents some amount of elapsed time measure to a given resolution + /*! This class represents a standard set of capabilities for all + counted time durations. Time duration implementations should derive + from this class passing their type as the first template parameter. + This design allows the subclass duration types to provide custom + construction policies or other custom features not provided here. + + @param T The subclass type + @param rep_type The time resolution traits for this duration type. + */ + template + class time_duration : private + boost::less_than_comparable > + /* dividable, addable, and subtractable operator templates + * won't work with this class (MSVC++ 6.0). return type + * from '+=' is different than expected return type + * from '+'. multipliable probably wont work + * either (haven't tried) */ + { + public: + typedef T duration_type; //the subclass + typedef rep_type traits_type; + typedef typename rep_type::day_type day_type; + typedef typename rep_type::hour_type hour_type; + typedef typename rep_type::min_type min_type; + typedef typename rep_type::sec_type sec_type; + typedef typename rep_type::fractional_seconds_type fractional_seconds_type; + typedef typename rep_type::tick_type tick_type; + typedef typename rep_type::impl_type impl_type; + + time_duration() : ticks_(0) {} + time_duration(hour_type hours_in, + min_type minutes_in, + sec_type seconds_in=0, + fractional_seconds_type frac_sec_in = 0) : + ticks_(rep_type::to_tick_count(hours_in,minutes_in,seconds_in,frac_sec_in)) + {} + // copy constructor required for dividable<> + //! Construct from another time_duration (Copy constructor) + time_duration(const time_duration& other) + : ticks_(other.ticks_) + {} + //! Construct from special_values + time_duration(special_values sv) : ticks_(impl_type::from_special(sv)) + {} + //! Returns smallest representable duration + static duration_type unit() + { + return duration_type(0,0,0,1); + } + //! Return the number of ticks in a second + static tick_type ticks_per_second() + { + return rep_type::res_adjust(); + } + //! Provide the resolution of this duration type + static time_resolutions resolution() + { + return rep_type::resolution(); + } + //! Returns number of hours in the duration + hour_type hours() const + { + return static_cast(ticks() / (3600*ticks_per_second())); + } + //! Returns normalized number of minutes + min_type minutes() const + { + return static_cast((ticks() / (60*ticks_per_second())) % 60); + } + //! Returns normalized number of seconds (0..60) + sec_type seconds() const + { + return static_cast((ticks()/ticks_per_second()) % 60); + } + //! Returns total number of seconds truncating any fractional seconds + sec_type total_seconds() const + { + return static_cast(ticks() / ticks_per_second()); + } + //! Returns total number of milliseconds truncating any fractional seconds + tick_type total_milliseconds() const + { + if (ticks_per_second() < 1000) { + return ticks() * (static_cast(1000) / ticks_per_second()); + } + return ticks() / (ticks_per_second() / static_cast(1000)) ; + } + //! Returns total number of nanoseconds truncating any sub millisecond values + tick_type total_nanoseconds() const + { + if (ticks_per_second() < 1000000000) { + return ticks() * (static_cast(1000000000) / ticks_per_second()); + } + return ticks() / (ticks_per_second() / static_cast(1000000000)) ; + } + //! Returns total number of microseconds truncating any sub microsecond values + tick_type total_microseconds() const + { + if (ticks_per_second() < 1000000) { + return ticks() * (static_cast(1000000) / ticks_per_second()); + } + return ticks() / (ticks_per_second() / static_cast(1000000)) ; + } + //! Returns count of fractional seconds at given resolution + fractional_seconds_type fractional_seconds() const + { + return (ticks() % ticks_per_second()); + } + //! Returns number of possible digits in fractional seconds + static unsigned short num_fractional_digits() + { + return rep_type::num_fractional_digits(); + } + duration_type invert_sign() const + { + return duration_type(ticks_ * (-1)); + } + bool is_negative() const + { + return ticks_ < 0; + } + bool operator<(const time_duration& rhs) const + { + return ticks_ < rhs.ticks_; + } + bool operator==(const time_duration& rhs) const + { + return ticks_ == rhs.ticks_; + } + //! unary- Allows for time_duration td = -td1 + duration_type operator-()const + { + return duration_type(ticks_ * (-1)); + } + duration_type operator-(const duration_type& d) const + { + return duration_type(ticks_ - d.ticks_); + } + duration_type operator+(const duration_type& d) const + { + return duration_type(ticks_ + d.ticks_); + } + duration_type operator/(int divisor) const + { + return duration_type(ticks_ / divisor); + } + duration_type operator-=(const duration_type& d) + { + ticks_ = ticks_ - d.ticks_; + return duration_type(ticks_); + } + duration_type operator+=(const duration_type& d) + { + ticks_ = ticks_ + d.ticks_; + return duration_type(ticks_); + } + //! Division operations on a duration with an integer. + duration_type operator/=(int divisor) + { + ticks_ = ticks_ / divisor; + return duration_type(ticks_); + } + //! Multiplication operations an a duration with an integer + duration_type operator*(int rhs) const + { + return duration_type(ticks_ * rhs); + } + duration_type operator*=(int divisor) + { + ticks_ = ticks_ * divisor; + return duration_type(ticks_); + } + tick_type ticks() const + { + return traits_type::as_number(ticks_); + } + + //! Is ticks_ a special value? + bool is_special()const + { + if(traits_type::is_adapted()) + { + return ticks_.is_special(); + } + else{ + return false; + } + } + //! Is duration pos-infinity + bool is_pos_infinity()const + { + if(traits_type::is_adapted()) + { + return ticks_.is_pos_infinity(); + } + else{ + return false; + } + } + //! Is duration neg-infinity + bool is_neg_infinity()const + { + if(traits_type::is_adapted()) + { + return ticks_.is_neg_infinity(); + } + else{ + return false; + } + } + //! Is duration not-a-date-time + bool is_not_a_date_time()const + { + if(traits_type::is_adapted()) + { + return ticks_.is_nan(); + } + else{ + return false; + } + } + + //! Used for special_values output + impl_type get_rep()const + { + return ticks_; + } + + protected: + explicit time_duration(impl_type in) : ticks_(in) {}; + impl_type ticks_; + }; + + + + //! Template for instantiating derived adjusting durations + /* These templates are designed to work with multiples of + * 10 for frac_of_second and resoultion adjustment + */ + template + class subsecond_duration : public base_duration + { + public: + typedef typename base_duration::traits_type traits_type; + explicit subsecond_duration(boost::int64_t ss) : + base_duration(0,0,0,ss*traits_type::res_adjust()/frac_of_second) + {} + }; + + + +} } //namespace date_time + + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_facet.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_facet.hpp new file mode 100644 index 0000000000..47f43c6afd --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_facet.hpp @@ -0,0 +1,1263 @@ + +#ifndef _DATE_TIME_FACET__HPP__ +#define _DATE_TIME_FACET__HPP__ + +/* Copyright (c) 2004-2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Martin Andrian, Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/date_time/date_facet.hpp" +#include "boost/date_time/string_convert.hpp" +#include "boost/algorithm/string/erase.hpp" +#include +#include +#include + +namespace boost { +namespace date_time { + + template + struct time_formats { + public: + typedef CharT char_type; + static const char_type fractional_seconds_format[3]; // f + static const char_type fractional_seconds_or_none_format[3]; // F + static const char_type seconds_with_fractional_seconds_format[3]; // s + static const char_type seconds_format[3]; // S + static const char_type standard_format[9]; // x X + static const char_type zone_abbrev_format[3]; // z + static const char_type zone_name_format[3]; // Z + static const char_type zone_iso_format[3]; // q + static const char_type zone_iso_extended_format[3]; // Q + static const char_type posix_zone_string_format[4]; // ZP + static const char_type duration_sign_negative_only[3]; // - + static const char_type duration_sign_always[3]; // + + static const char_type duration_seperator[2]; + static const char_type negative_sign[2]; //- + static const char_type positive_sign[2]; //+ + static const char_type iso_time_format_specifier[18]; + static const char_type iso_time_format_extended_specifier[22]; + //default ptime format is YYYY-Mon-DD HH:MM:SS[.fff...][ zzz] + static const char_type default_time_format[23]; + // default_time_input_format uses a posix_time_zone_string instead of a time zone abbrev + static const char_type default_time_input_format[24]; + //default time_duration format is HH:MM:SS[.fff...] + static const char_type default_time_duration_format[11]; + }; + + template + const typename time_formats::char_type + time_formats::fractional_seconds_format[3] = {'%','f'}; + + template + const typename time_formats::char_type + time_formats::fractional_seconds_or_none_format[3] = {'%','F'}; + + template + const typename time_formats::char_type + time_formats::seconds_with_fractional_seconds_format[3] = + {'%','s'}; + + template + const typename time_formats::char_type + time_formats::seconds_format[3] = {'%','S'}; + + template + const typename time_formats::char_type + //time_formats::standard_format[5] = {'%','c',' ','%','z'}; + time_formats::standard_format[9] = {'%','x',' ','%','X',' ','%','z'}; + + template + const typename time_formats::char_type + time_formats::zone_abbrev_format[3] = {'%','z'}; + + template + const typename time_formats::char_type + time_formats::zone_name_format[3] = {'%','Z'}; + + template + const typename time_formats::char_type + time_formats::zone_iso_format[3] = {'%','q'}; + + template + const typename time_formats::char_type + time_formats::zone_iso_extended_format[3] ={'%','Q'}; + + template + const typename time_formats::char_type + time_formats::posix_zone_string_format[4] ={'%','Z','P'}; + + template + const typename time_formats::char_type + time_formats::duration_seperator[2] = {':'}; + + template + const typename time_formats::char_type + time_formats::negative_sign[2] = {'-'}; + + template + const typename time_formats::char_type + time_formats::positive_sign[2] = {'+'}; + + template + const typename time_formats::char_type + time_formats::duration_sign_negative_only[3] ={'%','-'}; + + template + const typename time_formats::char_type + time_formats::duration_sign_always[3] ={'%','+'}; + + template + const typename time_formats::char_type + time_formats::iso_time_format_specifier[18] = + {'%', 'Y', '%', 'm', '%', 'd', 'T', + '%', 'H', '%', 'M', '%', 'S', '%', 'F', '%','q' }; + + template + const typename time_formats::char_type + time_formats::iso_time_format_extended_specifier[22] = + {'%', 'Y', '-', '%', 'm', '-', '%', 'd', ' ', + '%', 'H', ':', '%', 'M', ':', '%', 'S', '%', 'F','%','Q'}; + + template + const typename time_formats::char_type + time_formats::default_time_format[23] = + {'%','Y','-','%','b','-','%','d',' ', + '%','H',':','%','M',':','%','S','%','F',' ','%','z'}; + + template + const typename time_formats::char_type + time_formats::default_time_input_format[24] = + {'%','Y','-','%','b','-','%','d',' ', + '%','H',':','%','M',':','%','S','%','F',' ','%','Z','P'}; + + template + const typename time_formats::char_type + time_formats::default_time_duration_format[11] = + {'%','H',':','%','M',':','%','S','%','F'}; + + + + /*! Facet used for format-based output of time types + * This class provides for the use of format strings to output times. In addition + * to the flags for formatting date elements, the following are the allowed format flags: + * - %x %X => default format - enables addition of more flags to default (ie. "%x %X %z") + * - %f => fractional seconds ".123456" + * - %F => fractional seconds or none: like frac sec but empty if frac sec == 0 + * - %s => seconds w/ fractional sec "02.123" (this is the same as "%S%f) + * - %S => seconds "02" + * - %z => abbreviated time zone "EDT" + * - %Z => full time zone name "Eastern Daylight Time" + */ + template > > + class time_facet : + public boost::date_time::date_facet { + public: + typedef typename time_type::date_type date_type; + typedef typename time_type::time_duration_type time_duration_type; + typedef boost::date_time::period period_type; + typedef boost::date_time::date_facet base_type; + typedef typename base_type::string_type string_type; + typedef typename base_type::char_type char_type; + typedef typename base_type::period_formatter_type period_formatter_type; + typedef typename base_type::special_values_formatter_type special_values_formatter_type; + typedef typename base_type::date_gen_formatter_type date_gen_formatter_type; + static const char_type* fractional_seconds_format; // %f + static const char_type* fractional_seconds_or_none_format; // %F + static const char_type* seconds_with_fractional_seconds_format; // %s + static const char_type* seconds_format; // %S + static const char_type* standard_format; // %x X + static const char_type* zone_abbrev_format; // %z + static const char_type* zone_name_format; // %Z + static const char_type* zone_iso_format; // %q + static const char_type* zone_iso_extended_format; // %Q + static const char_type* posix_zone_string_format; // %ZP + static const char_type* duration_seperator; + static const char_type* duration_sign_always; // %+ + static const char_type* duration_sign_negative_only; // %- + static const char_type* negative_sign; //- + static const char_type* positive_sign; //+ + static const char_type* iso_time_format_specifier; + static const char_type* iso_time_format_extended_specifier; + + //default ptime format is YYYY-Mon-DD HH:MM:SS[.fff...][ zzz] + static const char_type* default_time_format; + //default time_duration format is HH:MM:SS[.fff...] + static const char_type* default_time_duration_format; + static std::locale::id id; + +#if defined (__SUNPRO_CC) && defined (_RWSTD_VER) + std::locale::id& __get_id (void) const { return id; } +#endif + + //! sets default formats for ptime, local_date_time, and time_duration + explicit time_facet(::size_t /* a_ref */ = 0) + //: base_type(standard_format), + : base_type(default_time_format), + m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) + {} + + //! Construct the facet with an explicitly specified format + explicit time_facet(const char_type* a_format, + period_formatter_type period_formatter = period_formatter_type(), + const special_values_formatter_type& special_value_formatter = special_values_formatter_type(), + date_gen_formatter_type dg_formatter = date_gen_formatter_type(), + ::size_t a_ref = 0) + : base_type(a_format, + period_formatter, + special_value_formatter, + dg_formatter, + a_ref), + m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) + {} + + //! Changes format for time_duration + void time_duration_format(const char_type* const format) + { + m_time_duration_format = format; + } + + virtual void set_iso_format() + { + this->m_format = iso_time_format_specifier; + } + virtual void set_iso_extended_format() + { + this->m_format = iso_time_format_extended_specifier; + } + + OutItrT put(OutItrT a_next, + std::ios_base& a_ios, + char_type a_fill, + const time_type& a_time) const + { + if (a_time.is_special()) { + return this->do_put_special(a_next, a_ios, a_fill, + a_time.date().as_special()); + } + string_type format(this->m_format); + string_type frac_str; + if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { + // replace %s with %S.nnn + frac_str = + fractional_seconds_as_string(a_time.time_of_day(), false); + char_type sep = std::use_facet >(a_ios.getloc()).decimal_point(); + + string_type replace_string(seconds_format); + replace_string += sep; + replace_string += frac_str; + boost::algorithm::replace_all(format, + seconds_with_fractional_seconds_format, + replace_string); + } + /* NOTE: replacing posix_zone_string_format must be done BEFORE + * zone_name_format: "%ZP" & "%Z", if Z is checked first it will + * incorrectly replace a zone_name where a posix_string should go */ + if (format.find(posix_zone_string_format) != string_type::npos) { + if(a_time.zone_abbrev().empty()) { + // if zone_abbrev() returns an empty string, we want to + // erase posix_zone_string_format from format + boost::algorithm::replace_all(format, + posix_zone_string_format, + ""); + } + else{ + boost::algorithm::replace_all(format, + posix_zone_string_format, + a_time.zone_as_posix_string()); + } + } + if (format.find(zone_name_format) != string_type::npos) { + if(a_time.zone_name().empty()) { + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This + * code removes the flag from the default formats */ + + // if zone_name() returns an empty string, we want to + // erase zone_name_format & one preceeding space + std::basic_ostringstream ss; + ss << ' ' << zone_name_format; + boost::algorithm::replace_all(format, + ss.str(), + ""); + } + else{ + boost::algorithm::replace_all(format, + zone_name_format, + a_time.zone_name()); + } + } + if (format.find(zone_abbrev_format) != string_type::npos) { + if(a_time.zone_abbrev(false).empty()) { + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This + * code removes the flag from the default formats */ + + // if zone_abbrev() returns an empty string, we want to + // erase zone_abbrev_format & one preceeding space + std::basic_ostringstream ss; + ss << ' ' << zone_abbrev_format; + boost::algorithm::replace_all(format, + ss.str(), + ""); + } + else{ + boost::algorithm::replace_all(format, + zone_abbrev_format, + a_time.zone_abbrev(false)); + } + } + if (format.find(zone_iso_extended_format) != string_type::npos) { + if(a_time.zone_name(true).empty()) { + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This + * code removes the flag from the default formats */ + + // if zone_name() returns an empty string, we want to + // erase zone_iso_extended_format from format + boost::algorithm::replace_all(format, + zone_iso_extended_format, + ""); + } + else{ + boost::algorithm::replace_all(format, + zone_iso_extended_format, + a_time.zone_name(true)); + } + } + + if (format.find(zone_iso_format) != string_type::npos) { + if(a_time.zone_abbrev(true).empty()) { + /* TODO: this'll probably create problems if a user places + * the zone_*_format flag in the format with a ptime. This + * code removes the flag from the default formats */ + + // if zone_abbrev() returns an empty string, we want to + // erase zone_iso_format from format + boost::algorithm::replace_all(format, + zone_iso_format, + ""); + } + else{ + boost::algorithm::replace_all(format, + zone_iso_format, + a_time.zone_abbrev(true)); + } + } + if (format.find(fractional_seconds_format) != string_type::npos) { + // replace %f with nnnnnnn + if (!frac_str.size()) { + frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); + } + boost::algorithm::replace_all(format, + fractional_seconds_format, + frac_str); + } + + if (format.find(fractional_seconds_or_none_format) != string_type::npos) { + // replace %F with nnnnnnn or nothing if fs == 0 + frac_str = + fractional_seconds_as_string(a_time.time_of_day(), true); + if (frac_str.size()) { + char_type sep = std::use_facet >(a_ios.getloc()).decimal_point(); + string_type replace_string; + replace_string += sep; + replace_string += frac_str; + boost::algorithm::replace_all(format, + fractional_seconds_or_none_format, + replace_string); + } + else { + boost::algorithm::erase_all(format, + fractional_seconds_or_none_format); + } + } + + return this->do_put_tm(a_next, a_ios, a_fill, + to_tm(a_time), format); + } + + //! put function for time_duration + OutItrT put(OutItrT a_next, + std::ios_base& a_ios, + char_type a_fill, + const time_duration_type& a_time_dur) const + { + if (a_time_dur.is_special()) { + return this->do_put_special(a_next, a_ios, a_fill, + a_time_dur.get_rep().as_special()); + } + + string_type format(m_time_duration_format); + if (a_time_dur.is_negative()) { + // replace %- with minus sign. Should we use the numpunct facet? + boost::algorithm::replace_all(format, + duration_sign_negative_only, + negative_sign); + // remove all the %+ in the string with '-' + boost::algorithm::replace_all(format, + duration_sign_always, + negative_sign); + } + else { //duration is positive + // remove all the %- combos from the string + boost::algorithm::replace_all(format, + duration_sign_negative_only, + ""); + // remove all the %+ in the string with '+' + boost::algorithm::replace_all(format, + duration_sign_always, + positive_sign); + } + + string_type frac_str; + if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { + // replace %s with %S.nnn + frac_str = + fractional_seconds_as_string(a_time_dur, false); + char_type sep = std::use_facet >(a_ios.getloc()).decimal_point(); + + string_type replace_string(seconds_format); + replace_string += sep; + replace_string += frac_str; + boost::algorithm::replace_all(format, + seconds_with_fractional_seconds_format, + replace_string); + } + if (format.find(fractional_seconds_format) != string_type::npos) { + // replace %f with nnnnnnn + if (!frac_str.size()) { + frac_str = fractional_seconds_as_string(a_time_dur, false); + } + boost::algorithm::replace_all(format, + fractional_seconds_format, + frac_str); + } + + if (format.find(fractional_seconds_or_none_format) != string_type::npos) { + // replace %F with nnnnnnn or nothing if fs == 0 + frac_str = + fractional_seconds_as_string(a_time_dur, true); + if (frac_str.size()) { + char_type sep = std::use_facet >(a_ios.getloc()).decimal_point(); + string_type replace_string; + replace_string += sep; + replace_string += frac_str; + boost::algorithm::replace_all(format, + fractional_seconds_or_none_format, + replace_string); + } + else { + boost::algorithm::erase_all(format, + fractional_seconds_or_none_format); + } + } + + return this->do_put_tm(a_next, a_ios, a_fill, + to_tm(a_time_dur), format); + } + + OutItrT put(OutItrT next, std::ios_base& a_ios, + char_type fill, const period_type& p) const + { + return this->m_period_formatter.put_period(next, a_ios, fill,p,*this); + } + + + protected: + + static + string_type + fractional_seconds_as_string(const time_duration_type& a_time, + bool null_when_zero) + { + typename time_duration_type::fractional_seconds_type frac_sec = + a_time.fractional_seconds(); + + if (null_when_zero && (frac_sec == 0)) { + return string_type(); + } + + //make sure there is no sign + frac_sec = date_time::absolute_value(frac_sec); + std::basic_ostringstream ss; + ss.imbue(std::locale::classic()); // don't want any formatting + ss << std::setw(time_duration_type::num_fractional_digits()) + << std::setfill(static_cast('0')); +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + // JDG [7/6/02 VC++ compatibility] + char_type buff[34]; + ss << _i64toa(static_cast(frac_sec), buff, 10); +#else + ss << frac_sec; +#endif + return ss.str(); + } + + private: + string_type m_time_duration_format; + + }; + + template + std::locale::id time_facet::id; + + template + const typename time_facet::char_type* + time_facet::fractional_seconds_format = time_formats::fractional_seconds_format; + + template + const typename time_facet::char_type* + time_facet::fractional_seconds_or_none_format = time_formats::fractional_seconds_or_none_format; + + template + const typename time_facet::char_type* + time_facet::seconds_with_fractional_seconds_format = + time_formats::seconds_with_fractional_seconds_format; + + + template + const typename time_facet::char_type* + time_facet::zone_name_format = time_formats::zone_name_format; + + template + const typename time_facet::char_type* + time_facet::zone_abbrev_format = time_formats::zone_abbrev_format; + + template + const typename time_facet::char_type* + time_facet::zone_iso_extended_format =time_formats::zone_iso_extended_format; + + template + const typename time_facet::char_type* + time_facet::posix_zone_string_format =time_formats::posix_zone_string_format; + + template + const typename time_facet::char_type* + time_facet::zone_iso_format = time_formats::zone_iso_format; + + template + const typename time_facet::char_type* + time_facet::seconds_format = time_formats::seconds_format; + + template + const typename time_facet::char_type* + time_facet::standard_format = time_formats::standard_format; + + template + const typename time_facet::char_type* + time_facet::duration_seperator = time_formats::duration_seperator; + + template + const typename time_facet::char_type* + time_facet::negative_sign = time_formats::negative_sign; + + template + const typename time_facet::char_type* + time_facet::positive_sign = time_formats::positive_sign; + + template + const typename time_facet::char_type* + time_facet::duration_sign_negative_only = time_formats::duration_sign_negative_only; + + template + const typename time_facet::char_type* + time_facet::duration_sign_always = time_formats::duration_sign_always; + + template + const typename time_facet::char_type* + time_facet::iso_time_format_specifier = time_formats::iso_time_format_specifier; + + template + const typename time_facet::char_type* + time_facet::iso_time_format_extended_specifier = time_formats::iso_time_format_extended_specifier; + + template + const typename time_facet::char_type* + time_facet::default_time_format = + time_formats::default_time_format; + + template + const typename time_facet::char_type* + time_facet::default_time_duration_format = + time_formats::default_time_duration_format; + + + //! Facet for format-based input. + /*! + */ + template > > + class time_input_facet : + public boost::date_time::date_input_facet { + public: + typedef typename time_type::date_type date_type; + typedef typename time_type::time_duration_type time_duration_type; + typedef typename time_duration_type::fractional_seconds_type fracional_seconds_type; + typedef boost::date_time::period period_type; + typedef boost::date_time::date_input_facet base_type; + typedef typename base_type::duration_type date_duration_type; + typedef typename base_type::year_type year_type; + typedef typename base_type::month_type month_type; + typedef typename base_type::day_type day_type; + typedef typename base_type::string_type string_type; + typedef typename string_type::const_iterator const_itr; + typedef typename base_type::char_type char_type; + typedef typename base_type::format_date_parser_type format_date_parser_type; + typedef typename base_type::period_parser_type period_parser_type; + typedef typename base_type::special_values_parser_type special_values_parser_type; + typedef typename base_type::date_gen_parser_type date_gen_parser_type; + typedef typename base_type::special_values_parser_type::match_results match_results; + + static const char_type* fractional_seconds_format; // f + static const char_type* fractional_seconds_or_none_format; // F + static const char_type* seconds_with_fractional_seconds_format; // s + static const char_type* seconds_format; // S + static const char_type* standard_format; // x X + static const char_type* zone_abbrev_format; // z + static const char_type* zone_name_format; // Z + static const char_type* zone_iso_format; // q + static const char_type* zone_iso_extended_format; // Q + static const char_type* duration_seperator; + static const char_type* iso_time_format_specifier; + static const char_type* iso_time_format_extended_specifier; + static const char_type* default_time_input_format; + static const char_type* default_time_duration_format; + static std::locale::id id; + + //! Constructor that takes a format string for a ptime + explicit time_input_facet(const string_type& format, ::size_t a_ref = 0) + : base_type(format, a_ref), + m_time_duration_format(default_time_duration_format) + { } + + explicit time_input_facet(const string_type& format, + const format_date_parser_type& date_parser, + const special_values_parser_type& sv_parser, + const period_parser_type& per_parser, + const date_gen_parser_type& date_gen_parser, + ::size_t a_ref = 0) + : base_type(format, + date_parser, + sv_parser, + per_parser, + date_gen_parser, + a_ref), + m_time_duration_format(default_time_duration_format) + {} + + //! sets default formats for ptime, local_date_time, and time_duration + explicit time_input_facet(::size_t a_ref = 0) + : base_type(default_time_input_format, a_ref), + m_time_duration_format(default_time_duration_format) + { } + + //! Set the format for time_duration + void time_duration_format(const char_type* const format) { + m_time_duration_format = format; + } + virtual void set_iso_format() + { + this->m_format = iso_time_format_specifier; + } + virtual void set_iso_extended_format() + { + this->m_format = iso_time_format_extended_specifier; + } + + InItrT get(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, + period_type& p) const + { + p = this->m_period_parser.get_period(sitr, + stream_end, + a_ios, + p, + time_duration_type::unit(), + *this); + return sitr; + } + + //default ptime format is YYYY-Mon-DD HH:MM:SS[.fff...][ zzz] + //default time_duration format is %H:%M:%S%F HH:MM:SS[.fff...] + + InItrT get(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, + time_duration_type& td) const + { + // skip leading whitespace + while((sitr != stream_end) && std::isspace(*sitr)) { ++sitr; } + + bool use_current_char = false; + + // num_get will consume the +/-, we may need a copy if special_value + char_type c = '\0'; + if((sitr != stream_end) && (*sitr == '-' || *sitr == '+')) { + c = *sitr; + } + + long hour = 0; + long min = 0; + long sec = 0; + typename time_duration_type::fractional_seconds_type frac(0); + + typedef std::num_get num_get; + if(!std::has_facet(a_ios.getloc())) { + num_get* ng = new num_get(); + std::locale loc = std::locale(a_ios.getloc(), ng); + a_ios.imbue(loc); + } + + const_itr itr(m_time_duration_format.begin()); + while (itr != m_time_duration_format.end() && (sitr != stream_end)) { + if (*itr == '%') { + itr++; + if (*itr != '%') { + switch(*itr) { + case 'H': + { + match_results mr; + hour = fixed_string_to_int(sitr, stream_end, mr, 2); + if(hour == -1){ + return check_special_value(sitr, stream_end, td, c); + } + break; + } + case 'M': + { + match_results mr; + min = fixed_string_to_int(sitr, stream_end, mr, 2); + if(min == -1){ + return check_special_value(sitr, stream_end, td, c); + } + break; + } + case 'S': + { + match_results mr; + sec = fixed_string_to_int(sitr, stream_end, mr, 2); + if(sec == -1){ + return check_special_value(sitr, stream_end, td, c); + } + break; + } + case 's': + { + match_results mr; + sec = fixed_string_to_int(sitr, stream_end, mr, 2); + if(sec == -1){ + return check_special_value(sitr, stream_end, td, c); + } + // %s is the same as %S%f so we drop through into %f + //break; + } + case 'f': + { + // check for decimal, check special_values if missing + if(*sitr == '.') { + ++sitr; + parse_frac_type(sitr, stream_end, frac); + // sitr will point to next expected char after this parsing + // is complete so no need to advance it + use_current_char = true; + } + else { + return check_special_value(sitr, stream_end, td, c); + } + break; + } + case 'F': + { + // check for decimal, skip if missing + if(*sitr == '.') { + ++sitr; + parse_frac_type(sitr, stream_end, frac); + // sitr will point to next expected char after this parsing + // is complete so no need to advance it + use_current_char = true; + } + else { + // nothing was parsed so we don't want to advance sitr + use_current_char = true; + } + break; + } + default: + {} // ignore what we don't understand? + }// switch + } + else { // itr == '%', second consecutive + sitr++; + } + + itr++; //advance past format specifier + } + else { //skip past chars in format and in buffer + itr++; + // set use_current_char when sitr is already + // pointing at the next character to process + if (use_current_char) { + use_current_char = false; + } + else { + sitr++; + } + } + } + + td = time_duration_type(hour, min, sec, frac); + return sitr; + } + + + //! Parses a time object from the input stream + InItrT get(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, + time_type& t) const + { + string_type tz_str; + return get(sitr, stream_end, a_ios, t, tz_str, false); + } + //! Expects a time_zone in the input stream + InItrT get_local_time(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, + time_type& t, + string_type& tz_str) const + { + return get(sitr, stream_end, a_ios, t, tz_str, true); + } + + protected: + + InItrT get(InItrT& sitr, + InItrT& stream_end, + std::ios_base& a_ios, + time_type& t, + string_type& tz_str, + bool time_is_local) const + { + // skip leading whitespace + while((sitr != stream_end) && std::isspace(*sitr)) { ++sitr; } + + bool use_current_char = false; + bool use_current_format_char = false; // used whith two character flags + + // num_get will consume the +/-, we may need a copy if special_value + char_type c = '\0'; + if((sitr != stream_end) && (*sitr == '-' || *sitr == '+')) { + c = *sitr; + } + + // time elements + long hour = 0; + long min = 0; + long sec = 0; + typename time_duration_type::fractional_seconds_type frac(0); + // date elements + short day_of_year(0); + /* Initialized the following to their minimum values. These intermediate + * objects are used so we get specific exceptions when part of the input + * is unparsable. + * Ex: "205-Jan-15" will throw a bad_year, "2005-Jsn-15"- bad_month, etc.*/ + year_type t_year(1400); + month_type t_month(1); + day_type t_day(1); + + typedef std::num_get num_get; + if(!std::has_facet(a_ios.getloc())) { + num_get* ng = new num_get(); + std::locale loc = std::locale(a_ios.getloc(), ng); + a_ios.imbue(loc); + } + + const_itr itr(this->m_format.begin()); + while (itr != this->m_format.end() && (sitr != stream_end)) { + if (*itr == '%') { + itr++; + if (*itr != '%') { + // the cases are grouped by date & time flags - not alphabetical order + switch(*itr) { + // date flags + case 'Y': + case 'y': + { + char_type cs[3] = { '%', *itr }; + string_type s(cs); + match_results mr; + try { + t_year = this->m_parser.parse_year(sitr, stream_end, s, mr); + } + catch(std::out_of_range bad_year) { // base class for bad_year exception + if(this->m_sv_parser.match(sitr, stream_end, mr)) { + t = time_type(static_cast(mr.current_match)); + return sitr; + } + else { + throw; // rethrow bad_year + } + } + break; + } + case 'B': + case 'b': + case 'm': + { + char_type cs[3] = { '%', *itr }; + string_type s(cs); + match_results mr; + try { + t_month = this->m_parser.parse_month(sitr, stream_end, s, mr); + } + catch(std::out_of_range bad_month) { // base class for bad_month exception + if(this->m_sv_parser.match(sitr, stream_end, mr)) { + t = time_type(static_cast(mr.current_match)); + return sitr; + } + else { + throw; // rethrow bad_year + } + } + // did m_parser already advance sitr to next char? + if(mr.has_remaining()) { + use_current_char = true; + } + break; + } + case 'a': + case 'A': + case 'w': + { + // weekday is not used in construction but we need to get it out of the stream + char_type cs[3] = { '%', *itr }; + string_type s(cs); + match_results mr; + typename date_type::day_of_week_type wd(0); + try { + wd = this->m_parser.parse_weekday(sitr, stream_end, s, mr); + } + catch(std::out_of_range bad_weekday) { // base class for bad_weekday exception + if(this->m_sv_parser.match(sitr, stream_end, mr)) { + t = time_type(static_cast(mr.current_match)); + return sitr; + } + else { + throw; // rethrow bad_weekday + } + } + // did m_parser already advance sitr to next char? + if(mr.has_remaining()) { + use_current_char = true; + } + break; + } + case 'j': + { + // code that gets julian day (from format_date_parser) + match_results mr; + day_of_year = fixed_string_to_int(sitr, stream_end, mr, 3); + if(day_of_year == -1) { + if(this->m_sv_parser.match(sitr, stream_end, mr)) { + t = time_type(static_cast(mr.current_match)); + return sitr; + } + } + // these next two lines are so we get an exception with bad input + typedef typename time_type::date_type::day_of_year_type day_of_year_type; + day_of_year_type t_day_of_year(day_of_year); + break; + } + case 'd': + { + try { + t_day = this->m_parser.parse_day_of_month(sitr, stream_end); + } + catch(std::out_of_range bad_day_of_month) { // base class for exception + match_results mr; + if(this->m_sv_parser.match(sitr, stream_end, mr)) { + t = time_type(static_cast(mr.current_match)); + return sitr; + } + else { + throw; // rethrow bad_year + } + } + break; + } + // time flags + case 'H': + { + match_results mr; + hour = fixed_string_to_int(sitr, stream_end, mr, 2); + if(hour == -1){ + return check_special_value(sitr, stream_end, t, c); + } + break; + } + case 'M': + { + match_results mr; + min = fixed_string_to_int(sitr, stream_end, mr, 2); + if(min == -1){ + return check_special_value(sitr, stream_end, t, c); + } + break; + } + case 'S': + { + match_results mr; + sec = fixed_string_to_int(sitr, stream_end, mr, 2); + if(sec == -1){ + return check_special_value(sitr, stream_end, t, c); + } + break; + } + case 's': + { + match_results mr; + sec = fixed_string_to_int(sitr, stream_end, mr, 2); + if(sec == -1){ + return check_special_value(sitr, stream_end, t, c); + } + // %s is the same as %S%f so we drop through into %f + //break; + } + case 'f': + { + // check for decimal, check SV if missing + if(*sitr == '.') { + ++sitr; + parse_frac_type(sitr, stream_end, frac); + // sitr will point to next expected char after this parsing + // is complete so no need to advance it + use_current_char = true; + } + else { + return check_special_value(sitr, stream_end, t, c); + } + break; + } + case 'F': + { + // check for decimal, skip if missing + if(*sitr == '.') { + ++sitr; + parse_frac_type(sitr, stream_end, frac); + // sitr will point to next expected char after this parsing + // is complete so no need to advance it + use_current_char = true; + } + else { + // nothing was parsed so we don't want to advance sitr + use_current_char = true; + } + break; + } + // time_zone flags + //case 'q': + //case 'Q': + //case 'z': + case 'Z': + { + if(time_is_local) { // skip if 't' is a ptime + ++itr; + if(*itr == 'P') { + // skip leading whitespace + while((sitr != stream_end) && std::isspace(*sitr)) { ++sitr; } + // parse zone + while((sitr != stream_end) && (!std::isspace(*sitr))) { + tz_str += *sitr; + ++sitr; + } + } + else { + use_current_format_char = true; + } + + } + else { + // nothing was parsed so we don't want to advance sitr + use_current_char = true; + } + + break; + } + default: + {} // ignore what we don't understand? + }// switch + } + else { // itr == '%', second consecutive + sitr++; + } + + if(use_current_format_char) { + use_current_format_char = false; + } + else { + itr++; //advance past format specifier + } + + } + else { //skip past chars in format and in buffer + itr++; + // set use_current_char when sitr is already + // pointing at the next character to process + if (use_current_char) { + use_current_char = false; + } + else { + sitr++; + } + } + } + + date_type d(not_a_date_time); + if (day_of_year > 0) { + d = date_type(static_cast(t_year-1),12,31) + date_duration_type(day_of_year); + } + else { + d = date_type(t_year, t_month, t_day); + } + + time_duration_type td(hour, min, sec, frac); + t = time_type(d, td); + return sitr; + } + + //! Helper function to check for special_value + /*! First character may have been consumed during original parse + * attempt. Parameter 'c' should be a copy of that character. + * Throws ios_base::failure if parse fails. */ + template + inline + InItrT check_special_value(InItrT& sitr,InItrT& stream_end, temporal_type& tt, char_type c='\0') const + { + match_results mr; + if((c == '-' || c == '+') && (*sitr != c)) { // was the first character consumed? + mr.cache += c; + } + this->m_sv_parser.match(sitr, stream_end, mr); + if(mr.current_match == match_results::PARSE_ERROR) { + std::string tmp = convert_string_type(mr.cache); + throw std::ios_base::failure("Parse failed. No match found for '" + tmp + "'"); + } + tt = temporal_type(static_cast(mr.current_match)); + return sitr; + } + + //! Helper function for parsing a fractional second type from the stream + void parse_frac_type(InItrT& sitr, + InItrT& stream_end, + fracional_seconds_type& frac) const + { + string_type cache; + while((sitr != stream_end) && std::isdigit(*sitr)) { + cache += *sitr; + ++sitr; + } + if(cache.size() > 0) { + unsigned short precision = time_duration_type::num_fractional_digits(); + // input may be only the first few decimal places + if(cache.size() < precision) { + frac = lexical_cast(cache); + frac = decimal_adjust(frac, static_cast(precision - cache.size())); + } + else { + // if input has too many decimal places, drop excess digits + frac = lexical_cast(cache.substr(0, precision)); + } + } + } + + private: + string_type m_time_duration_format; + + //! Helper function to adjust trailing zeros when parsing fractional digits + template + inline + int_type decimal_adjust(int_type val, const unsigned short places) const + { + unsigned long factor = 1; + for(int i = 0; i < places; ++i){ + factor *= 10; // shift decimal to the right + } + return val * factor; + } + + }; + +template + std::locale::id time_input_facet::id; + +template + const typename time_input_facet::char_type* + time_input_facet::fractional_seconds_format = time_formats::fractional_seconds_format; + + template + const typename time_input_facet::char_type* + time_input_facet::fractional_seconds_or_none_format = time_formats::fractional_seconds_or_none_format; + + template + const typename time_input_facet::char_type* + time_input_facet::seconds_with_fractional_seconds_format = time_formats::seconds_with_fractional_seconds_format; + + template + const typename time_input_facet::char_type* + time_input_facet::seconds_format = time_formats::seconds_format; + + template + const typename time_input_facet::char_type* + time_input_facet::standard_format = time_formats::standard_format; + + template + const typename time_input_facet::char_type* + time_input_facet::zone_abbrev_format = time_formats::zone_abbrev_format; + + template + const typename time_input_facet::char_type* + time_input_facet::zone_name_format = time_formats::zone_name_format; + + template + const typename time_input_facet::char_type* + time_input_facet::zone_iso_format = time_formats::zone_iso_format; + + template + const typename time_input_facet::char_type* + time_input_facet::zone_iso_extended_format = time_formats::zone_iso_extended_format; + + template + const typename time_input_facet::char_type* + time_input_facet::duration_seperator = time_formats::duration_seperator; + + template + const typename time_input_facet::char_type* + time_input_facet::iso_time_format_specifier = time_formats::iso_time_format_specifier; + + template + const typename time_input_facet::char_type* + time_input_facet::iso_time_format_extended_specifier = time_formats::iso_time_format_extended_specifier; + + template + const typename time_input_facet::char_type* + time_input_facet::default_time_input_format = time_formats::default_time_input_format; + + template + const typename time_input_facet::char_type* + time_input_facet::default_time_duration_format = time_formats::default_time_duration_format; + + +} } // namespaces + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_formatting_streams.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_formatting_streams.hpp new file mode 100644 index 0000000000..8ff2ef0890 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_formatting_streams.hpp @@ -0,0 +1,119 @@ +#ifndef DATE_TIME_TIME_FORMATTING_STREAMS_HPP___ +#define DATE_TIME_TIME_FORMATTING_STREAMS_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/date_formatting_locales.hpp" +#include "boost/date_time/time_resolution_traits.hpp" + +#ifndef BOOST_DATE_TIME_NO_LOCALE + +namespace boost { +namespace date_time { + + + //! Put a time type into a stream using appropriate facets + template + class ostream_time_duration_formatter + { + public: + typedef std::basic_ostream ostream_type; + typedef typename time_duration_type::fractional_seconds_type fractional_seconds_type; + + //! Put time into an ostream + static void duration_put(const time_duration_type& td, + ostream_type& os) + { + if(td.is_special()) { + os << td.get_rep(); + } + else { + charT fill_char = '0'; + if(td.is_negative()) { + os << '-'; + } + os << std::setw(2) << std::setfill(fill_char) + << absolute_value(td.hours()) << ":"; + os << std::setw(2) << std::setfill(fill_char) + << absolute_value(td.minutes()) << ":"; + os << std::setw(2) << std::setfill(fill_char) + << absolute_value(td.seconds()); + fractional_seconds_type frac_sec = + absolute_value(td.fractional_seconds()); + if (frac_sec != 0) { + os << "." + << std::setw(time_duration_type::num_fractional_digits()) + << std::setfill(fill_char) + << frac_sec; + } + } // else + } // duration_put + }; //class ostream_time_duration_formatter + + //! Put a time type into a stream using appropriate facets + template + class ostream_time_formatter + { + public: + typedef std::basic_ostream ostream_type; + typedef typename time_type::date_type date_type; + typedef typename time_type::time_duration_type time_duration_type; + typedef ostream_time_duration_formatter duration_formatter; + + //! Put time into an ostream + static void time_put(const time_type& t, + ostream_type& os) + { + date_type d = t.date(); + os << d; + if(!d.is_infinity() && !d.is_not_a_date()) + { + os << " "; //TODO: fix the separator here. + duration_formatter::duration_put(t.time_of_day(), os); + } + + } // time_to_ostream + }; //class ostream_time_formatter + + + //! Put a time period into a stream using appropriate facets + template + class ostream_time_period_formatter + { + public: + typedef std::basic_ostream ostream_type; + typedef typename time_period_type::point_type time_type; + typedef ostream_time_formatter time_formatter; + + //! Put time into an ostream + static void period_put(const time_period_type& tp, + ostream_type& os) + { + os << '['; //TODO: facet or manipulator for periods? + time_formatter::time_put(tp.begin(), os); + os << '/'; //TODO: facet or manipulator for periods? + time_formatter::time_put(tp.last(), os); + os << ']'; + + } // period_put + + }; //class ostream_time_period_formatter + + + +} } //namespace date_time + +#endif //BOOST_DATE_TIME_NO_LOCALE + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_iterator.hpp new file mode 100644 index 0000000000..2258a3308e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_iterator.hpp @@ -0,0 +1,52 @@ +#ifndef DATE_TIME_TIME_ITERATOR_HPP___ +#define DATE_TIME_TIME_ITERATOR_HPP___ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +namespace boost { +namespace date_time { + + + //! Simple time iterator skeleton class + template + class time_itr { + public: + typedef typename time_type::time_duration_type time_duration_type; + time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}; + time_itr& operator++() + { + current_ = current_ + offset_; + return *this; + } + time_itr& operator--() + { + current_ = current_ - offset_; + return *this; + } + time_type operator*() {return current_;}; + time_type* operator->() {return ¤t_;}; + bool operator< (const time_type& t) {return current_ < t;}; + bool operator<= (const time_type& t) {return current_ <= t;}; + bool operator!= (const time_type& t) {return current_ != t;}; + bool operator== (const time_type& t) {return current_ == t;}; + bool operator> (const time_type& t) {return current_ > t;}; + bool operator>= (const time_type& t) {return current_ >= t;}; + + private: + time_type current_; + time_duration_type offset_; + }; + + + +} }//namespace date_time + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_parsing.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_parsing.hpp new file mode 100644 index 0000000000..dfccf6a1df --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_parsing.hpp @@ -0,0 +1,321 @@ +#ifndef _DATE_TIME_TIME_PARSING_HPP___ +#define _DATE_TIME_TIME_PARSING_HPP___ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/tokenizer.hpp" +#include "boost/lexical_cast.hpp" +#include "boost/date_time/date_parsing.hpp" +#include "boost/cstdint.hpp" +#include + +namespace boost { +namespace date_time { + + //! computes exponential math like 2^8 => 256, only works with positive integers + //Not general purpose, but needed b/c std::pow is not available + //everywehere. Hasn't been tested with negatives and zeros + template + inline + int_type power(int_type base, int_type exponent) + { + int_type result = 1; + for(int i = 0; i < exponent; ++i){ + result *= base; + } + return result; + } + + //! Creates a time_duration object from a delimited string + /*! Expected format for string is "[-]h[h][:mm][:ss][.fff]". + * If the number of fractional digits provided is greater than the + * precision of the time duration type then the extra digits are + * truncated. + * + * A negative duration will be created if the first character in + * string is a '-', all other '-' will be treated as delimiters. + * Accepted delimiters are "-:,.". + */ + template + inline + time_duration + str_from_delimited_time_duration(const std::basic_string& s) + { + unsigned short min=0, sec =0; + int hour =0; + bool is_neg = (s.at(0) == '-'); + boost::int64_t fs=0; + int pos = 0; + + typedef typename std::basic_string::traits_type traits_type; + typedef boost::char_separator char_separator_type; + typedef boost::tokenizer::const_iterator, + std::basic_string > tokenizer; + typedef typename boost::tokenizer::const_iterator, + typename std::basic_string >::iterator tokenizer_iterator; + + char_type sep_chars[5] = {'-',':',',','.'}; + char_separator_type sep(sep_chars); + tokenizer tok(s,sep); + for(tokenizer_iterator beg=tok.begin(); beg!=tok.end();++beg){ + switch(pos) { + case 0: { + hour = boost::lexical_cast(*beg); + break; + } + case 1: { + min = boost::lexical_cast(*beg); + break; + } + case 2: { + sec = boost::lexical_cast(*beg); + break; + }; + case 3: { + int digits = static_cast(beg->length()); + //Works around a bug in MSVC 6 library that does not support + //operator>> thus meaning lexical_cast will fail to compile. +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + // msvc wouldn't compile 'time_duration::num_fractional_digits()' + // (required template argument list) as a workaround a temp + // time_duration object was used + time_duration td(hour,min,sec,fs); + int precision = td.num_fractional_digits(); + // _atoi64 is an MS specific function + if(digits >= precision) { + // drop excess digits + fs = _atoi64(beg->substr(0, precision).c_str()); + } + else { + fs = _atoi64(beg->c_str()); + } +#else + int precision = time_duration::num_fractional_digits(); + if(digits >= precision) { + // drop excess digits + fs = boost::lexical_cast(beg->substr(0, precision)); + } + else { + fs = boost::lexical_cast(*beg); + } +#endif + if(digits < precision){ + // trailing zeros get dropped from the string, + // "1:01:01.1" would yield .000001 instead of .100000 + // the power() compensates for the missing decimal places + fs *= power(10, precision - digits); + } + + break; + } + }//switch + pos++; + } + if(is_neg) { + return -time_duration(hour, min, sec, fs); + } + else { + return time_duration(hour, min, sec, fs); + } + } + + //! Creates a time_duration object from a delimited string + /*! Expected format for string is "[-]h[h][:mm][:ss][.fff]". + * If the number of fractional digits provided is greater than the + * precision of the time duration type then the extra digits are + * truncated. + * + * A negative duration will be created if the first character in + * string is a '-', all other '-' will be treated as delimiters. + * Accepted delimiters are "-:,.". + */ + template + inline + time_duration + parse_delimited_time_duration(const std::string& s) + { + return str_from_delimited_time_duration(s); + } + + //! Utility function to split appart string + inline + bool + split(const std::string& s, + char sep, + std::string& first, + std::string& second) + { + int sep_pos = static_cast(s.find(sep)); + first = s.substr(0,sep_pos); + second = s.substr(sep_pos+1); + return true; + } + + + template + inline + time_type + parse_delimited_time(const std::string& s, char sep) + { + typedef typename time_type::time_duration_type time_duration; + typedef typename time_type::date_type date_type; + + //split date/time on a unique delimiter char such as ' ' or 'T' + std::string date_string, tod_string; + split(s, sep, date_string, tod_string); + //call parse_date with first string + date_type d = parse_date(date_string); + //call parse_time_duration with remaining string + time_duration td = parse_delimited_time_duration(tod_string); + //construct a time + return time_type(d, td); + + } + + //! Parse time duration part of an iso time of form: [-]hhmmss[.fff...] (eg: 120259.123 is 12 hours, 2 min, 59 seconds, 123000 microseconds) + template + inline + time_duration + parse_undelimited_time_duration(const std::string& s) + { + int precision = 0; + { + // msvc wouldn't compile 'time_duration::num_fractional_digits()' + // (required template argument list) as a workaround, a temp + // time_duration object was used + time_duration tmp(0,0,0,1); + precision = tmp.num_fractional_digits(); + } + // 'precision+1' is so we grab all digits, plus the decimal + int offsets[] = {2,2,2, precision+1}; + int pos = 0, sign = 0; + int hours = 0; + short min=0, sec=0; + boost::int64_t fs=0; + // increment one position if the string was "signed" + if(s.at(sign) == '-') + { + ++sign; + } + // stlport choked when passing s.substr() to tokenizer + // using a new string fixed the error + std::string remain = s.substr(sign); + /* We do not want the offset_separator to wrap the offsets, we + * will never want to process more than: + * 2 char, 2 char, 2 char, frac_sec length. + * We *do* want the offset_separator to give us a partial for the + * last characters if there were not enough provided in the input string. */ + bool wrap_off = false; + bool ret_part = true; + boost::offset_separator osf(offsets, offsets+4, wrap_off, ret_part); + typedef boost::tokenizer::const_iterator, + std::basic_string > tokenizer; + typedef boost::tokenizer::const_iterator, + std::basic_string >::iterator tokenizer_iterator; + tokenizer tok(remain, osf); + for(tokenizer_iterator ti=tok.begin(); ti!=tok.end();++ti){ + switch(pos) { + case 0: + { + hours = boost::lexical_cast(*ti); + break; + } + case 1: + { + min = boost::lexical_cast(*ti); + break; + } + case 2: + { + sec = boost::lexical_cast(*ti); + break; + } + case 3: + { + std::string char_digits(ti->substr(1)); // digits w/no decimal + int digits = static_cast(char_digits.length()); + + //Works around a bug in MSVC 6 library that does not support + //operator>> thus meaning lexical_cast will fail to compile. +#if (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) // 1200 == VC++ 6.0 + // _atoi64 is an MS specific function + if(digits >= precision) { + // drop excess digits + fs = _atoi64(char_digits.substr(0, precision).c_str()); + } + else if(digits == 0) { + fs = 0; // just in case _atoi64 doesn't like an empty string + } + else { + fs = _atoi64(char_digits.c_str()); + } +#else + if(digits >= precision) { + // drop excess digits + fs = boost::lexical_cast(char_digits.substr(0, precision)); + } + else if(digits == 0) { + fs = 0; // lexical_cast doesn't like empty strings + } + else { + fs = boost::lexical_cast(char_digits); + } +#endif + if(digits < precision){ + // trailing zeros get dropped from the string, + // "1:01:01.1" would yield .000001 instead of .100000 + // the power() compensates for the missing decimal places + fs *= power(10, precision - digits); + } + + break; + } + }; + pos++; + } + if(sign) { + return -time_duration(hours, min, sec, fs); + } + else { + return time_duration(hours, min, sec, fs); + } + } + + //! Parse time string of form YYYYMMDDThhmmss where T is delimeter between date and time + template + inline + time_type + parse_iso_time(const std::string& s, char sep) + { + typedef typename time_type::time_duration_type time_duration; + typedef typename time_type::date_type date_type; + + //split date/time on a unique delimiter char such as ' ' or 'T' + std::string date_string, tod_string; + split(s, sep, date_string, tod_string); + //call parse_date with first string + date_type d = parse_undelimited_date(date_string); + //call parse_time_duration with remaining string + time_duration td = parse_undelimited_time_duration(tod_string); + //construct a time + return time_type(d, td); + } + + + +} }//namespace date_time + + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_resolution_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_resolution_traits.hpp new file mode 100644 index 0000000000..14879117a6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_resolution_traits.hpp @@ -0,0 +1,140 @@ +#ifndef DATE_TIME_TIME_RESOLUTION_TRAITS_HPP +#define DATE_TIME_TIME_RESOLUTION_TRAITS_HPP + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include "boost/date_time/time_defs.hpp" +#include "boost/date_time/int_adapter.hpp" +#include "boost/cstdint.hpp" + +namespace boost { +namespace date_time { + + //! Simple function to calculate absolute value of a numeric type + template + // JDG [7/6/02 made a template], + // moved here from time_duration.hpp 2003-Sept-4. + inline T absolute_value(T x) + { + return x < 0 ? -x : x; + } + + //! traits struct for time_resolution_traits implementation type + struct time_resolution_traits_bi32_impl { + typedef boost::int32_t int_type; + typedef boost::int32_t impl_type; + static int_type as_number(impl_type i){ return i;} + //! Used to determine if implemented type is int_adapter or int + static bool is_adapted() { return false;} + }; + //! traits struct for time_resolution_traits implementation type + struct time_resolution_traits_adapted32_impl { + typedef boost::int32_t int_type; + typedef boost::date_time::int_adapter impl_type; + static int_type as_number(impl_type i){ return i.as_number();} + //! Used to determine if implemented type is int_adapter or int + static bool is_adapted() { return true;} + }; + //! traits struct for time_resolution_traits implementation type + struct time_resolution_traits_bi64_impl { + typedef boost::int64_t int_type; + typedef boost::int64_t impl_type; + static int_type as_number(impl_type i){ return i;} + //! Used to determine if implemented type is int_adapter or int + static bool is_adapted() { return false;} + }; + //! traits struct for time_resolution_traits implementation type + struct time_resolution_traits_adapted64_impl { + typedef boost::int64_t int_type; + typedef boost::date_time::int_adapter impl_type; + static int_type as_number(impl_type i){ return i.as_number();} + //! Used to determine if implemented type is int_adapter or int + static bool is_adapted() { return true;} + }; + + template + class time_resolution_traits { + public: + typedef typename frac_sec_type::int_type fractional_seconds_type; + typedef typename frac_sec_type::int_type tick_type; + typedef typename frac_sec_type::impl_type impl_type; + typedef v_type day_type; + typedef v_type hour_type; + typedef v_type min_type; + typedef v_type sec_type; + + // bring in function from frac_sec_type traits structs + static typename frac_sec_type::int_type as_number(typename frac_sec_type::impl_type i) + { + return frac_sec_type::as_number(i); + } + static bool is_adapted() + { + return frac_sec_type::is_adapted(); + } + + //Would like this to be frac_sec_type, but some compilers complain + BOOST_STATIC_CONSTANT(int, ticks_per_second = resolution_adjust); + // static const boost::int32_t ticks_per_second = resolution_adjust; + + static time_resolutions resolution() + { + return res; + } + static unsigned short num_fractional_digits() + { + return frac_digits; + } + static fractional_seconds_type res_adjust() + { + return resolution_adjust; + } + //! Any negative argument results in a negative tick_count + static tick_type to_tick_count(hour_type hours, + min_type minutes, + sec_type seconds, + fractional_seconds_type fs) + { + if(hours < 0 || minutes < 0 || seconds < 0 || fs < 0) + { + hours = absolute_value(hours); + minutes = absolute_value(minutes); + seconds = absolute_value(seconds); + fs = absolute_value(fs); + return (((((fractional_seconds_type(hours)*3600) + + (fractional_seconds_type(minutes)*60) + + seconds)*res_adjust()) + fs) * -1); + } + + return (((fractional_seconds_type(hours)*3600) + + (fractional_seconds_type(minutes)*60) + + seconds)*res_adjust()) + fs; + } + + }; + + typedef time_resolution_traits milli_res; + typedef time_resolution_traits micro_res; + typedef time_resolution_traits nano_res; + + +} } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_system_counted.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_system_counted.hpp new file mode 100644 index 0000000000..fa883907eb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_system_counted.hpp @@ -0,0 +1,254 @@ +#ifndef DATE_TIME_TIME_SYSTEM_COUNTED_HPP +#define DATE_TIME_TIME_SYSTEM_COUNTED_HPP + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + + +#include "boost/date_time/time_defs.hpp" +#include + + +namespace boost { +namespace date_time { + + //! Time representation that uses a single integer count + template + struct counted_time_rep + { + typedef typename config::int_type int_type; + typedef typename config::date_type date_type; + typedef typename config::impl_type impl_type; + typedef typename date_type::duration_type date_duration_type; + typedef typename date_type::calendar_type calendar_type; + typedef typename date_type::ymd_type ymd_type; + typedef typename config::time_duration_type time_duration_type; + typedef typename config::resolution_traits resolution_traits; + + counted_time_rep(const date_type& d, const time_duration_type& time_of_day) + : time_count_(1) + { + if(d.is_infinity() || d.is_not_a_date() || time_of_day.is_special()) { + time_count_ = time_of_day.get_rep() + d.day_count(); + //std::cout << time_count_ << std::endl; + } + else { + time_count_ = (d.day_number() * frac_sec_per_day()) + time_of_day.ticks(); + } + } + explicit counted_time_rep(int_type count) : + time_count_(count) + {} + explicit counted_time_rep(impl_type count) : + time_count_(count) + {} + date_type date() const + { + if(time_count_.is_special()) { + return date_type(time_count_.as_special()); + } + else { + typename calendar_type::date_int_type dc = day_count(); + //std::cout << "time_rep here:" << dc << std::endl; + ymd_type ymd = calendar_type::from_day_number(dc); + return date_type(ymd); + } + } + //int_type day_count() const + unsigned long day_count() const + { + /* resolution_traits::as_number returns a boost::int64_t & + * frac_sec_per_day is also a boost::int64_t so, naturally, + * the division operation returns a boost::int64_t. + * The static_cast to an unsigned long is ok (results in no data loss) + * because frac_sec_per_day is either the number of + * microseconds per day, or the number of nanoseconds per day. + * Worst case scenario: resolution_traits::as_number returns the + * maximum value an int64_t can hold and frac_sec_per_day + * is microseconds per day (lowest possible value). + * The division operation will then return a value of 106751991 - + * easily fitting in an unsigned long. + */ + return static_cast(resolution_traits::as_number(time_count_) / frac_sec_per_day()); + } + int_type time_count() const + { + return resolution_traits::as_number(time_count_); + } + int_type tod() const + { + return resolution_traits::as_number(time_count_) % frac_sec_per_day(); + } + static int_type frac_sec_per_day() + { + int_type seconds_per_day = 60*60*24; + int_type fractional_sec_per_sec(resolution_traits::res_adjust()); + return seconds_per_day*fractional_sec_per_sec; + } + bool is_pos_infinity()const + { + return impl_type::is_pos_inf(time_count_.as_number()); + } + bool is_neg_infinity()const + { + return impl_type::is_neg_inf(time_count_.as_number()); + } + bool is_not_a_date_time()const + { + return impl_type::is_not_a_number(time_count_.as_number()); + } + bool is_special()const + { + return time_count_.is_special(); + } + impl_type get_rep()const + { + return time_count_; + } + private: + impl_type time_count_; + }; + + //! An unadjusted time system implementation. + template + class counted_time_system + { + public: + typedef time_rep time_rep_type; + typedef typename time_rep_type::impl_type impl_type; + typedef typename time_rep_type::time_duration_type time_duration_type; + typedef typename time_duration_type::fractional_seconds_type fractional_seconds_type; + typedef typename time_rep_type::date_type date_type; + typedef typename time_rep_type::date_duration_type date_duration_type; + + + template static void unused_var(const T&) {} + + static time_rep_type get_time_rep(const date_type& day, + const time_duration_type& tod, + date_time::dst_flags dst=not_dst) + { + unused_var(dst); + return time_rep_type(day, tod); + } + + static time_rep_type get_time_rep(special_values sv) + { + switch (sv) { + case not_a_date_time: + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + case pos_infin: + return time_rep_type(date_type(pos_infin), + time_duration_type(pos_infin)); + case neg_infin: + return time_rep_type(date_type(neg_infin), + time_duration_type(neg_infin)); + case max_date_time: { + time_duration_type td = time_duration_type(24,0,0,0) - time_duration_type(0,0,0,1); + return time_rep_type(date_type(max_date_time), td); + } + case min_date_time: + return time_rep_type(date_type(min_date_time), time_duration_type(0,0,0,0)); + + default: + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + + } + + } + + static date_type get_date(const time_rep_type& val) + { + return val.date(); + } + static time_duration_type get_time_of_day(const time_rep_type& val) + { + if(val.is_special()) { + return time_duration_type(val.get_rep().as_special()); + } + else{ + return time_duration_type(0,0,0,val.tod()); + } + } + static std::string zone_name(const time_rep_type&) + { + return ""; + } + static bool is_equal(const time_rep_type& lhs, const time_rep_type& rhs) + { + return (lhs.time_count() == rhs.time_count()); + } + static bool is_less(const time_rep_type& lhs, const time_rep_type& rhs) + { + return (lhs.time_count() < rhs.time_count()); + } + static time_rep_type add_days(const time_rep_type& base, + const date_duration_type& dd) + { + if(base.is_special() || dd.is_special()) { + return(time_rep_type(base.get_rep() + dd.get_rep())); + } + else { + return time_rep_type(base.time_count() + (dd.days() * time_rep_type::frac_sec_per_day())); + } + } + static time_rep_type subtract_days(const time_rep_type& base, + const date_duration_type& dd) + { + if(base.is_special() || dd.is_special()) { + return(time_rep_type(base.get_rep() - dd.get_rep())); + } + else{ + return time_rep_type(base.time_count() - (dd.days() * time_rep_type::frac_sec_per_day())); + } + } + static time_rep_type subtract_time_duration(const time_rep_type& base, + const time_duration_type& td) + { + if(base.is_special() || td.is_special()) { + return(time_rep_type(base.get_rep() - td.get_rep())); + } + else { + return time_rep_type(base.time_count() - td.ticks()); + } + } + static time_rep_type add_time_duration(const time_rep_type& base, + time_duration_type td) + { + if(base.is_special() || td.is_special()) { + return(time_rep_type(base.get_rep() + td.get_rep())); + } + else { + return time_rep_type(base.time_count() + td.ticks()); + } + } + static time_duration_type subtract_times(const time_rep_type& lhs, + const time_rep_type& rhs) + { + if(lhs.is_special() || rhs.is_special()) { + return(time_duration_type( + impl_type::to_special((lhs.get_rep() - rhs.get_rep()).as_number()))); + } + else { + fractional_seconds_type fs = lhs.time_count() - rhs.time_count(); + return time_duration_type(0,0,0,fs); + } + } + + }; + + +} } //namespace date_time + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_system_split.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_system_split.hpp new file mode 100644 index 0000000000..a882b12541 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_system_split.hpp @@ -0,0 +1,213 @@ +#ifndef DATE_TIME_TIME_SYSTEM_SPLIT_HPP +#define DATE_TIME_TIME_SYSTEM_SPLIT_HPP + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include +#include "boost/date_time/compiler_config.hpp" +#include "boost/date_time/special_defs.hpp" + +namespace boost { +namespace date_time { + + //! An unadjusted time system implementation. +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) + template +#else + template +#endif + class split_timedate_system + { + public: + typedef typename config::time_rep_type time_rep_type; + typedef typename config::date_type date_type; + typedef typename config::time_duration_type time_duration_type; + typedef typename config::date_duration_type date_duration_type; + typedef typename config::int_type int_type; + typedef typename config::resolution_traits resolution_traits; + + //86400 is number of seconds in a day... +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) + typedef date_time::wrapping_int wrap_int_type; +#else + private: + BOOST_STATIC_CONSTANT(int_type, ticks_per_day = INT64_C(86400) * config::tick_per_second); + public: +# if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0X581) ) + typedef date_time::wrapping_int< split_timedate_system::int_type, split_timedate_system::ticks_per_day> wrap_int_type; +# else + typedef date_time::wrapping_int wrap_int_type; +#endif +#endif + + static time_rep_type get_time_rep(special_values sv) + { + switch (sv) { + case not_a_date_time: + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + case pos_infin: + return time_rep_type(date_type(pos_infin), + time_duration_type(pos_infin)); + case neg_infin: + return time_rep_type(date_type(neg_infin), + time_duration_type(neg_infin)); + case max_date_time: { + time_duration_type td = time_duration_type(24,0,0,0) - time_duration_type(0,0,0,1); + return time_rep_type(date_type(max_date_time), td); + } + case min_date_time: + return time_rep_type(date_type(min_date_time), time_duration_type(0,0,0,0)); + + default: + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + + } + + } + + static time_rep_type get_time_rep(const date_type& day, + const time_duration_type& tod, + date_time::dst_flags dst=not_dst) + { + if(day.is_special() || tod.is_special()) { + if(day.is_not_a_date() || tod.is_not_a_date_time()) { + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + } + else if(day.is_pos_infinity()) { + if(tod.is_neg_infinity()) { + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + } + else { + return time_rep_type(day, time_duration_type(pos_infin)); + } + } + else if(day.is_neg_infinity()) { + if(tod.is_pos_infinity()) { + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + } + else { + return time_rep_type(day, time_duration_type(neg_infin)); + } + } + else if(tod.is_pos_infinity()) { + if(day.is_neg_infinity()) { + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + } + else { + return time_rep_type(date_type(pos_infin), tod); + } + } + else if(tod.is_neg_infinity()) { + if(day.is_pos_infinity()) { + return time_rep_type(date_type(not_a_date_time), + time_duration_type(not_a_date_time)); + } + else { + return time_rep_type(date_type(neg_infin), tod); + } + } + } + return time_rep_type(day, tod); + } + static date_type get_date(const time_rep_type& val) + { + return date_type(val.day); + } + static time_duration_type get_time_of_day(const time_rep_type& val) + { + return time_duration_type(val.time_of_day); + } + static std::string zone_name(const time_rep_type&) + { + return ""; + } + static bool is_equal(const time_rep_type& lhs, const time_rep_type& rhs) + { + return ((lhs.day == rhs.day) && (lhs.time_of_day == rhs.time_of_day)); + } + static bool is_less(const time_rep_type& lhs, const time_rep_type& rhs) + { + if (lhs.day < rhs.day) return true; + if (lhs.day > rhs.day) return false; + return (lhs.time_of_day < rhs.time_of_day); + } + static time_rep_type add_days(const time_rep_type& base, + const date_duration_type& dd) + { + return time_rep_type(base.day+dd, base.time_of_day); + } + static time_rep_type subtract_days(const time_rep_type& base, + const date_duration_type& dd) + { + return split_timedate_system::get_time_rep(base.day-dd, base.time_of_day); + } + static time_rep_type subtract_time_duration(const time_rep_type& base, + const time_duration_type& td) + { + if(base.day.is_special() || td.is_special()) + { + return split_timedate_system::get_time_rep(base.day, -td); + } + if (td.is_negative()) { + time_duration_type td1 = td.invert_sign(); + return add_time_duration(base,td1); + } + + //std::cout << td.ticks() << std::endl; + wrap_int_type day_offset(base.time_of_day.ticks()); + date_duration_type day_overflow(static_cast(day_offset.subtract(td.ticks()))); +// std::cout << "sub: " << base.time_of_day.ticks() << "|" +// << day_offset.as_int() << "|" +// << day_overflow.days() << std::endl; + return time_rep_type(base.day-day_overflow, + time_duration_type(0,0,0,day_offset.as_int())); + } + static time_rep_type add_time_duration(const time_rep_type& base, + time_duration_type td) + { + if(base.day.is_special() || td.is_special()) { + return split_timedate_system::get_time_rep(base.day, td); + } + if (td.is_negative()) { + time_duration_type td1 = td.invert_sign(); + return subtract_time_duration(base,td1); + } + wrap_int_type day_offset(base.time_of_day.ticks()); + typename date_duration_type::duration_rep_type doff = day_offset.add(td.ticks()); +// std::cout << "day overflow: " << doff << std::endl; +// std::cout << "ticks: " << td.ticks() << std::endl; + date_duration_type day_overflow(doff); +// std::cout << "base: " << to_simple_string(base.day) << std::endl; +// std::cout << "overflow " << day_overflow.days() << std::endl; + return time_rep_type(base.day+day_overflow, + time_duration_type(0,0,0,day_offset.as_int())); + } + static time_duration_type subtract_times(const time_rep_type& lhs, + const time_rep_type& rhs) + { + date_duration_type dd = lhs.day - rhs.day; + time_duration_type td(dd.days()*24,0,0); //days * 24 hours + time_duration_type td2 = lhs.time_of_day - rhs.time_of_day; + return td+td2; + // return time_rep_type(base.day-dd, base.time_of_day); + } + + }; + +} } //namespace date_time + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_zone_base.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_zone_base.hpp new file mode 100644 index 0000000000..0d3cb903e6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_zone_base.hpp @@ -0,0 +1,99 @@ +#ifndef _DATE_TIME_TIME_ZONE_BASE__ +#define _DATE_TIME_TIME_ZONE_BASE__ + +/* Copyright (c) 2003-2005 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +#include +#include + +namespace boost { +namespace date_time { + + + + //! Interface class for dynamic time zones. + /*! This class represents the base interface for all timezone + * representations. Subclasses may provide different systems + * for identifying a particular zone. For example some may + * provide a geographical based zone construction while others + * may specify the offset from GMT. Another possible implementation + * would be to convert from POSIX timezone strings. Regardless of + * the construction technique, this is the interface that these + * time zone types must provide. + * + * Note that this class is intended to be used as a shared + * resource (hence the derivation from boost::counted_base. + */ + template + class time_zone_base { + public: + typedef CharT char_type; + typedef std::basic_string string_type; + typedef std::basic_ostringstream stringstream_type; + typedef typename time_type::date_type::year_type year_type; + typedef typename time_type::time_duration_type time_duration_type; + + time_zone_base() {}; + virtual ~time_zone_base() {}; + //!String for the timezone when in daylight savings (eg: EDT) + virtual string_type dst_zone_abbrev() const=0; + //!String for the zone when not in daylight savings (eg: EST) + virtual string_type std_zone_abbrev() const=0; + //!String for the timezone when in daylight savings (eg: Eastern Daylight Time) + virtual string_type dst_zone_name() const=0; + //!String for the zone when not in daylight savings (eg: Eastern Standard Time) + virtual string_type std_zone_name() const=0; + //! True if zone uses daylight savings adjustments otherwise false + virtual bool has_dst() const=0; + //! Local time that DST starts -- undefined if has_dst is false + virtual time_type dst_local_start_time(year_type y) const=0; + //! Local time that DST ends -- undefined if has_dst is false + virtual time_type dst_local_end_time(year_type y) const=0; + //! Base offset from UTC for zone (eg: -07:30:00) + virtual time_duration_type base_utc_offset() const=0; + //! Adjustment forward or back made while DST is in effect + virtual time_duration_type dst_offset() const=0; + //! Returns a POSIX time_zone string for this object + virtual string_type to_posix_string() const =0; + + private: + + }; + + + //! Structure which holds the time offsets associated with daylight savings time + /*! + *@param time_duration_type A type used to represent the offset + */ + template + class dst_adjustment_offsets + { + public: + dst_adjustment_offsets(const time_duration_type& dst_adjust, + const time_duration_type& dst_start_offset, + const time_duration_type& dst_end_offset) : + dst_adjust_(dst_adjust), + dst_start_offset_(dst_start_offset), + dst_end_offset_(dst_end_offset) + {} + + //! Amount DST adjusts the clock eg: plus one hour + time_duration_type dst_adjust_; + //! Time past midnight on start transition day that dst starts + time_duration_type dst_start_offset_; + //! Time past midnight on end transition day that dst ends + time_duration_type dst_end_offset_; + }; + + +} } //namespace date_time + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_zone_names.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_zone_names.hpp new file mode 100644 index 0000000000..05260c7162 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/time_zone_names.hpp @@ -0,0 +1,98 @@ +#ifndef DATE_TIME_TIME_ZONE_NAMES_HPP__ +#define DATE_TIME_TIME_ZONE_NAMES_HPP__ + +/* Copyright (c) 2002-2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include + +namespace boost { +namespace date_time { + + template + struct default_zone_names { + public: + typedef CharT char_type; + static const char_type standard_name[9]; + static const char_type standard_abbrev[11]; + static const char_type non_dst_identifier[7]; + }; + template + const typename default_zone_names::char_type + default_zone_names::standard_name[9] = + {'s','t','d','_','n','a','m','e'}; + + template + const typename default_zone_names::char_type + default_zone_names::standard_abbrev[11] = + {'s','t','d','_','a','b','b','r','e','v'}; + + template + const typename default_zone_names::char_type + default_zone_names::non_dst_identifier[7] = + {'n','o','-','d','s','t'}; + + //! Base type that holds various string names for timezone output. + /*! Class that holds various types of strings used for timezones. + * For example, for the western United States there is the full + * name: Pacific Standard Time and the abbreviated name: PST. + * During daylight savings there are additional names: + * Pacific Daylight Time and PDT. + *@parm CharT Allows class to support different character types + */ + template + class time_zone_names_base + { + public: + typedef std::basic_string string_type; + time_zone_names_base() : + std_zone_name_(default_zone_names::standard_name), + std_zone_abbrev_(default_zone_names::standard_abbrev), + dst_zone_name_(default_zone_names::non_dst_identifier), + dst_zone_abbrev_(default_zone_names::non_dst_identifier) + {} + time_zone_names_base(const string_type& std_zone_name_str, + const string_type& std_zone_abbrev_str, + const string_type& dst_zone_name_str, + const string_type& dst_zone_abbrev_str) : + std_zone_name_(std_zone_name_str), + std_zone_abbrev_(std_zone_abbrev_str), + dst_zone_name_(dst_zone_name_str), + dst_zone_abbrev_(dst_zone_abbrev_str) + {} + string_type dst_zone_abbrev() const + { + return dst_zone_abbrev_; + } + string_type std_zone_abbrev() const + { + return std_zone_abbrev_; + } + string_type dst_zone_name() const + { + return dst_zone_name_; + } + string_type std_zone_name() const + { + return std_zone_name_; + } + private: + string_type std_zone_name_; + string_type std_zone_abbrev_; + string_type dst_zone_name_; + string_type dst_zone_abbrev_; + + }; + + //! Specialization of timezone names for standard char. + //typedef time_zone_names_base time_zone_names; + +} } //namespace + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/tz_db_base.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/tz_db_base.hpp new file mode 100644 index 0000000000..ead3c20a44 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/tz_db_base.hpp @@ -0,0 +1,376 @@ +#ifndef DATE_TIME_TZ_DB_BASE_HPP__ +#define DATE_TIME_TZ_DB_BASE_HPP__ + +/* Copyright (c) 2003-2005 CrystalClear Software, Inc. + * Subject to the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +#include "boost/shared_ptr.hpp" +#include "boost/date_time/time_zone_names.hpp" +#include "boost/date_time/time_zone_base.hpp" +#include "boost/date_time/time_parsing.hpp" +#include "boost/tokenizer.hpp" +#include +#include +#include +#include +#include +#include + +namespace boost { + namespace date_time { + + //! Exception thrown when tz database cannot locate requested data file + class data_not_accessible : public std::logic_error + { + public: + data_not_accessible() : + std::logic_error(std::string("Unable to locate or access the required datafile.")) + {} + data_not_accessible(const std::string& filespec) : + std::logic_error(std::string("Unable to locate or access the required datafile. Filespec: " + filespec)) + {} + }; + + //! Exception thrown when tz database locates incorrect field structure in data file + class bad_field_count : public std::out_of_range + { + public: + bad_field_count(const std::string& s) : + std::out_of_range(s) + {} + }; + + //! Creates a database of time_zones from csv datafile + /*! The csv file containing the zone_specs used by the + * tz_db_base is intended to be customized by the + * library user. When customizing this file (or creating your own) the + * file must follow a specific format. + * + * This first line is expected to contain column headings and is therefore + * not processed by the tz_db_base. + * + * Each record (line) must have eleven fields. Some of those fields can + * be empty. Every field (even empty ones) must be enclosed in + * double-quotes. + * Ex: + * @code + * "America/Phoenix" <- string enclosed in quotes + * "" <- empty field + * @endcode + * + * Some fields represent a length of time. The format of these fields + * must be: + * @code + * "{+|-}hh:mm[:ss]" <- length-of-time format + * @endcode + * Where the plus or minus is mandatory and the seconds are optional. + * + * Since some time zones do not use daylight savings it is not always + * necessary for every field in a zone_spec to contain a value. All + * zone_specs must have at least ID and GMT offset. Zones that use + * daylight savings must have all fields filled except: + * STD ABBR, STD NAME, DST NAME. You should take note + * that DST ABBR is mandatory for zones that use daylight savings + * (see field descriptions for further details). + * + * ******* Fields and their description/details ********* + * + * ID: + * Contains the identifying string for the zone_spec. Any string will + * do as long as it's unique. No two ID's can be the same. + * + * STD ABBR: + * STD NAME: + * DST ABBR: + * DST NAME: + * These four are all the names and abbreviations used by the time + * zone being described. While any string will do in these fields, + * care should be taken. These fields hold the strings that will be + * used in the output of many of the local_time classes. + * Ex: + * @code + * time_zone nyc = tz_db.time_zone_from_region("America/New_York"); + * local_time ny_time(date(2004, Aug, 30), IS_DST, nyc); + * cout << ny_time.to_long_string() << endl; + * // 2004-Aug-30 00:00:00 Eastern Daylight Time + * cout << ny_time.to_short_string() << endl; + * // 2004-Aug-30 00:00:00 EDT + * @endcode + * + * NOTE: The exact format/function names may vary - see local_time + * documentation for further details. + * + * GMT offset: + * This is the number of hours added to utc to get the local time + * before any daylight savings adjustments are made. Some examples + * are: America/New_York offset -5 hours, & Africa/Cairo offset +2 hours. + * The format must follow the length-of-time format described above. + * + * DST adjustment: + * The amount of time added to gmt_offset when daylight savings is in + * effect. The format must follow the length-of-time format described + * above. + * + * DST Start Date rule: + * This is a specially formatted string that describes the day of year + * in which the transition take place. It holds three fields of it's own, + * separated by semicolons. + * The first field indicates the "nth" weekday of the month. The possible + * values are: 1 (first), 2 (second), 3 (third), 4 (fourth), 5 (fifth), + * and -1 (last). + * The second field indicates the day-of-week from 0-6 (Sun=0). + * The third field indicates the month from 1-12 (Jan=1). + * + * Examples are: "-1;5;9"="Last Friday of September", + * "2;1;3"="Second Monday of March" + * + * Start time: + * Start time is the number of hours past midnight, on the day of the + * start transition, the transition takes place. More simply put, the + * time of day the transition is made (in 24 hours format). The format + * must follow the length-of-time format described above with the + * exception that it must always be positive. + * + * DST End date rule: + * See DST Start date rule. The difference here is this is the day + * daylight savings ends (transition to STD). + * + * End time: + * Same as Start time. + */ + template + class tz_db_base { + public: + /* Having CharT as a template parameter created problems + * with posix_time::duration_from_string. Templatizing + * duration_from_string was not possible at this time, however, + * it should be possible in the future (when poor compilers get + * fixed or stop being used). + * Since this class was designed to use CharT as a parameter it + * is simply typedef'd here to ease converting in back to a + * parameter the future */ + typedef char char_type; + + typedef typename time_zone_type::base_type time_zone_base_type; + typedef typename time_zone_type::time_duration_type time_duration_type; + typedef time_zone_names_base time_zone_names; + typedef dst_adjustment_offsets dst_adjustment_offsets; + typedef std::basic_string string_type; + + //! Constructs an empty database + tz_db_base() {} + + //! Process csv data file, may throw exceptions + /*! May throw data_not_accessible, or bad_field_count exceptions */ + void load_from_file(const std::string& pathspec) + { + string_type in_str; + std::string buff; + + std::ifstream ifs(pathspec.c_str()); + if(!ifs){ + throw data_not_accessible(pathspec); + } + std::getline(ifs, buff); // first line is column headings + + while( std::getline(ifs, buff)) { + parse_string(buff); + } + } + + //! returns true if record successfully added to map + /*! Takes an id string in the form of "America/Phoenix", and a + * time_zone object for that region. The id string must be a unique + * name that does not already exist in the database. */ + bool add_record(const string_type& id, + boost::shared_ptr tz) + { + typename map_type::value_type p(id, tz); + return (m_zone_map.insert(p)).second; + } + + //! Returns a time_zone object built from the specs for the given region + /*! Returns a time_zone object built from the specs for the given + * region. If region does not exist a local_time::record_not_found + * exception will be thrown */ + boost::shared_ptr + time_zone_from_region(const string_type& region) const + { + // get the record + typename map_type::const_iterator record = m_zone_map.find(region); + if(record == m_zone_map.end()){ + return boost::shared_ptr(); //null pointer + } + return record->second; + } + + //! Returns a vector of strings holding the time zone regions in the database + std::vector region_list() const + { + typedef std::vector vector_type; + vector_type regions; + typename map_type::const_iterator itr = m_zone_map.begin(); + while(itr != m_zone_map.end()) { + regions.push_back(itr->first); + ++itr; + } + return regions; + } + + private: + typedef std::map > map_type; + map_type m_zone_map; + + // start and end rule are of the same type + typedef typename rule_type::start_rule::week_num week_num; + + /* TODO: mechanisms need to be put in place to handle different + * types of rule specs. parse_rules() only handles nth_kday + * rule types. */ + + //! parses rule specs for transition day rules + rule_type* parse_rules(const string_type& sr, const string_type& er) const + { + using namespace gregorian; + // start and end rule are of the same type, + // both are included here for readability + typedef typename rule_type::start_rule start_rule; + typedef typename rule_type::end_rule end_rule; + + // these are: [start|end] nth, day, month + int s_nth = 0, s_d = 0, s_m = 0; + int e_nth = 0, e_d = 0, e_m = 0; + split_rule_spec(s_nth, s_d, s_m, sr); + split_rule_spec(e_nth, e_d, e_m, er); + + typename start_rule::week_num s_wn, e_wn; + s_wn = get_week_num(s_nth); + e_wn = get_week_num(e_nth); + + + return new rule_type(start_rule(s_wn, s_d, s_m), + end_rule(e_wn, e_d, e_m)); + } + //! helper function for parse_rules() + week_num get_week_num(int nth) const + { + typedef typename rule_type::start_rule start_rule; + switch(nth){ + case 1: + return start_rule::first; + case 2: + return start_rule::second; + case 3: + return start_rule::third; + case 4: + return start_rule::fourth; + case 5: + case -1: + return start_rule::fifth; + default: + // shouldn't get here - add error handling later + break; + } + return start_rule::fifth; // silence warnings + } + + //! splits the [start|end]_date_rule string into 3 ints + void split_rule_spec(int& nth, int& d, int& m, string_type rule) const + { + typedef boost::char_separator > char_separator_type; + typedef boost::tokenizer::const_iterator, + std::basic_string > tokenizer; + typedef boost::tokenizer::const_iterator, + std::basic_string >::iterator tokenizer_iterator; + + const char_type sep_char[] = { ';', '\0'}; + char_separator_type sep(sep_char); + tokenizer tokens(rule, sep); // 3 fields + + tokenizer_iterator tok_iter = tokens.begin(); + nth = std::atoi(tok_iter->c_str()); ++tok_iter; + d = std::atoi(tok_iter->c_str()); ++tok_iter; + m = std::atoi(tok_iter->c_str()); + } + + + //! Take a line from the csv, turn it into a time_zone_type. + /*! Take a line from the csv, turn it into a time_zone_type, + * and add it to the map. Zone_specs in csv file are expected to + * have eleven fields that describe the time zone. Returns true if + * zone_spec successfully added to database */ + bool parse_string(string_type& s) + { + + std::vector result; + typedef boost::token_iterator_generator, string_type::const_iterator, string_type >::type token_iter_type; + + token_iter_type i = boost::make_token_iterator(s.begin(), s.end(),boost::escaped_list_separator()); + + token_iter_type end; + while (i != end) { + result.push_back(*i); + i++; + } + + enum db_fields { ID, STDABBR, STDNAME, DSTABBR, DSTNAME, GMTOFFSET, + DSTADJUST, START_DATE_RULE, START_TIME, END_DATE_RULE, + END_TIME, FIELD_COUNT }; + + //take a shot at fixing gcc 4.x error + const unsigned int expected_fields = static_cast(FIELD_COUNT); + if (result.size() != expected_fields) { + std::stringstream msg; + msg << "Expecting " << FIELD_COUNT << " fields, got " + << result.size() << " fields in line: " << s; + throw bad_field_count(msg.str()); + } + + // initializations + bool has_dst = true; + if(result[DSTABBR] == std::string()){ + has_dst = false; + } + + + // start building components of a time_zone + time_zone_names names(result[STDNAME], result[STDABBR], + result[DSTNAME], result[DSTABBR]); + + time_duration_type utc_offset = + str_from_delimited_time_duration(result[GMTOFFSET]); + + dst_adjustment_offsets adjust(time_duration_type(0,0,0), + time_duration_type(0,0,0), + time_duration_type(0,0,0)); + + boost::shared_ptr rules; + + if(has_dst){ + adjust = dst_adjustment_offsets( + str_from_delimited_time_duration(result[DSTADJUST]), + str_from_delimited_time_duration(result[START_TIME]), + str_from_delimited_time_duration(result[END_TIME]) + ); + + rules = + boost::shared_ptr(parse_rules(result[START_DATE_RULE], + result[END_DATE_RULE])); + } + string_type id(result[ID]); + boost::shared_ptr zone(new time_zone_type(names, utc_offset, adjust, rules)); + return (add_record(id, zone)); + + } + + }; + +} } // namespace + +#endif // DATE_TIME_TZ_DB_BASE_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/wrapping_int.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/wrapping_int.hpp new file mode 100644 index 0000000000..1457dc869a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/wrapping_int.hpp @@ -0,0 +1,163 @@ +#ifndef _DATE_TIME_WRAPPING_INT_HPP__ +#define _DATE_TIME_WRAPPING_INT_HPP__ + +/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland, Bart Garst + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + + +namespace boost { +namespace date_time { + +//! A wrapping integer used to support time durations (WARNING: only instantiate with a signed type) +/*! In composite date and time types this type is used to + * wrap at the day boundary. + * Ex: + * A wrapping_int will roll over after nine, and + * roll under below zero. This gives a range of [0,9] + * + * NOTE: it is strongly recommended that wrapping_int2 be used + * instead of wrapping_int as wrapping_int is to be depricated + * at some point soon. + * + * Also Note that warnings will occur if instantiated with an + * unsigned type. Only a signed type should be used! + */ +template +class wrapping_int { +public: + typedef int_type_ int_type; + //typedef overflow_type_ overflow_type; + static int_type wrap_value() {return wrap_val;} + //!Add, return true if wrapped + wrapping_int(int_type v) : value_(v) {}; + //! Explicit converion method + int_type as_int() const {return value_;} + operator int_type() const {return value_;} + //!Add, return number of wraps performed + /*! The sign of the returned value will indicate which direction the + * wraps went. Ex: add a negative number and wrapping under could occur, + * this would be indicated by a negative return value. If wrapping over + * took place, a positive value would be returned */ + int_type add(int_type v) + { + int_type remainder = static_cast(v % (wrap_val)); + int_type overflow = static_cast(v / (wrap_val)); + value_ = static_cast(value_ + remainder); + return calculate_wrap(overflow); + } + //! Subtract will return '+d' if wrapping under took place ('d' is the number of wraps) + /*! The sign of the returned value will indicate which direction the + * wraps went (positive indicates wrap under, negative indicates wrap over). + * Ex: subtract a negative number and wrapping over could + * occur, this would be indicated by a negative return value. If + * wrapping under took place, a positive value would be returned. */ + int_type subtract(int_type v) + { + int_type remainder = static_cast(v % (wrap_val)); + int_type underflow = static_cast(-(v / (wrap_val))); + value_ = static_cast(value_ - remainder); + return calculate_wrap(underflow) * -1; + } +private: + int_type value_; + + int_type calculate_wrap(int_type wrap) + { + if ((value_) >= wrap_val) + { + wrap++; + value_ -= (wrap_val); + } + else if(value_ < 0) + { + wrap--; + value_ += (wrap_val); + } + return wrap; + } + +}; + + +//! A wrapping integer used to wrap around at the top (WARNING: only instantiate with a signed type) +/*! Bad name, quick impl to fix a bug -- fix later!! + * This allows the wrap to restart at a value other than 0. + */ +template +class wrapping_int2 { +public: + typedef int_type_ int_type; + static int_type wrap_value() {return wrap_max;} + static int_type min_value() {return wrap_min;} + /*! If initializing value is out of range of [wrap_min, wrap_max], + * value will be initialized to closest of min or max */ + wrapping_int2(int_type v) : value_(v) { + if(value_ < wrap_min) + { + value_ = wrap_min; + } + if(value_ > wrap_max) + { + value_ = wrap_max; + } + } + //! Explicit converion method + int_type as_int() const {return value_;} + operator int_type() const {return value_;} + //!Add, return number of wraps performed + /*! The sign of the returned value will indicate which direction the + * wraps went. Ex: add a negative number and wrapping under could occur, + * this would be indicated by a negative return value. If wrapping over + * took place, a positive value would be returned */ + int_type add(int_type v) + { + int_type remainder = static_cast(v % (wrap_max - wrap_min + 1)); + int_type overflow = static_cast(v / (wrap_max - wrap_min + 1)); + value_ = static_cast(value_ + remainder); + return calculate_wrap(overflow); + } + //! Subtract will return '-d' if wrapping under took place ('d' is the number of wraps) + /*! The sign of the returned value will indicate which direction the + * wraps went. Ex: subtract a negative number and wrapping over could + * occur, this would be indicated by a positive return value. If + * wrapping under took place, a negative value would be returned */ + int_type subtract(int_type v) + { + int_type remainder = static_cast(v % (wrap_max - wrap_min + 1)); + int_type underflow = static_cast(-(v / (wrap_max - wrap_min + 1))); + value_ = static_cast(value_ - remainder); + return calculate_wrap(underflow); + } + +private: + int_type value_; + + int_type calculate_wrap(int_type wrap) + { + if ((value_) > wrap_max) + { + wrap++; + value_ -= (wrap_max - wrap_min + 1); + } + else if((value_) < wrap_min) + { + wrap--; + value_ += (wrap_max - wrap_min + 1); + } + return wrap; + } +}; + + + +} } //namespace date_time + + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/date_time/year_month_day.hpp b/deal.II/contrib/boost/include/boost-1.37.0/date_time/year_month_day.hpp new file mode 100644 index 0000000000..802ce42eb9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/date_time/year_month_day.hpp @@ -0,0 +1,45 @@ +#ifndef YearMonthDayBase_HPP__ +#define YearMonthDayBase_HPP__ + +/* Copyright (c) 2002,2003 CrystalClear Software, Inc. + * Use, modification and distribution is subject to the + * Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + * Author: Jeff Garland + * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + */ + +namespace boost { +namespace date_time { + + //! Allow rapid creation of ymd triples of different types + template + struct year_month_day_base { + year_month_day_base(YearType year, + MonthType month, + DayType day); + YearType year; + MonthType month; + DayType day; + typedef YearType year_type; + typedef MonthType month_type; + typedef DayType day_type; + }; + + + //! A basic constructor + template + inline + year_month_day_base::year_month_day_base(YearType y, + MonthType m, + DayType d) : + year(y), + month(m), + day(d) + {} + +} }//namespace date_time + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/algorithm.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/algorithm.hpp new file mode 100644 index 0000000000..252e9f461c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/algorithm.hpp @@ -0,0 +1,222 @@ +// (C) Copyright Jeremy Siek 2001. +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef BOOST_ALGORITHM_HPP +# define BOOST_ALGORITHM_HPP +# include +// Algorithms on sequences +// +// The functions in this file have not yet gone through formal +// review, and are subject to change. This is a work in progress. +// They have been checked into the detail directory because +// there are some graph algorithms that use these functions. + +#include +#include + +namespace boost { + + template + Iter1 begin(const std::pair& p) { return p.first; } + + template + Iter2 end(const std::pair& p) { return p.second; } + + template + typename boost::detail::iterator_traits::difference_type + size(const std::pair& p) { + return std::distance(p.first, p.second); + } + +#if 0 + // These seem to interfere with the std::pair overloads :( + template + typename Container::iterator + begin(Container& c) { return c.begin(); } + + template + typename Container::const_iterator + begin(const Container& c) { return c.begin(); } + + template + typename Container::iterator + end(Container& c) { return c.end(); } + + template + typename Container::const_iterator + end(const Container& c) { return c.end(); } + + template + typename Container::size_type + size(const Container& c) { return c.size(); } +#else + template + typename std::vector::iterator + begin(std::vector& c) { return c.begin(); } + + template + typename std::vector::const_iterator + begin(const std::vector& c) { return c.begin(); } + + template + typename std::vector::iterator + end(std::vector& c) { return c.end(); } + + template + typename std::vector::const_iterator + end(const std::vector& c) { return c.end(); } + + template + typename std::vector::size_type + size(const std::vector& c) { return c.size(); } +#endif + + template + void iota(ForwardIterator first, ForwardIterator last, T value) + { + for (; first != last; ++first, ++value) + *first = value; + } + template + void iota(Container& c, const T& value) + { + iota(begin(c), end(c), value); + } + + // Also do version with 2nd container? + template + OutIter copy(const Container& c, OutIter result) { + return std::copy(begin(c), end(c), result); + } + + template + bool equal(const Container1& c1, const Container2& c2) + { + if (size(c1) != size(c2)) + return false; + return std::equal(begin(c1), end(c1), begin(c2)); + } + + template + void sort(Container& c) { std::sort(begin(c), end(c)); } + + template + void sort(Container& c, const Predicate& p) { + std::sort(begin(c), end(c), p); + } + + template + void stable_sort(Container& c) { std::stable_sort(begin(c), end(c)); } + + template + void stable_sort(Container& c, const Predicate& p) { + std::stable_sort(begin(c), end(c), p); + } + + template + bool any_if(InputIterator first, InputIterator last, Predicate p) + { + return std::find_if(first, last, p) != last; + } + template + bool any_if(const Container& c, Predicate p) + { + return any_if(begin(c), end(c), p); + } + + template + bool container_contains(InputIterator first, InputIterator last, T value) + { + return std::find(first, last, value) != last; + } + template + bool container_contains(const Container& c, const T& value) + { + return container_contains(begin(c), end(c), value); + } + + template + std::size_t count(const Container& c, const T& value) + { + return std::count(begin(c), end(c), value); + } + + template + std::size_t count_if(const Container& c, Predicate p) + { + return std::count_if(begin(c), end(c), p); + } + + template + bool is_sorted(ForwardIterator first, ForwardIterator last) + { + if (first == last) + return true; + + ForwardIterator next = first; + for (++next; next != last; first = next, ++next) { + if (*next < *first) + return false; + } + + return true; + } + + template + bool is_sorted(ForwardIterator first, ForwardIterator last, + StrictWeakOrdering comp) + { + if (first == last) + return true; + + ForwardIterator next = first; + for (++next; next != last; first = next, ++next) { + if (comp(*next, *first)) + return false; + } + + return true; + } + + template + bool is_sorted(const Container& c) + { + return is_sorted(begin(c), end(c)); + } + + template + bool is_sorted(const Container& c, StrictWeakOrdering comp) + { + return is_sorted(begin(c), end(c), comp); + } + +} // namespace boost + +#endif // BOOST_ALGORITHM_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/allocator_utilities.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/allocator_utilities.hpp new file mode 100644 index 0000000000..91b0fa7b39 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/allocator_utilities.hpp @@ -0,0 +1,193 @@ +/* Copyright 2003-2008 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 Boost website at http://www.boost.org/ + */ + +#ifndef BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP +#define BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP + +#include /* keep it first to prevent nasty warns in MSVC */ +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ + +namespace detail{ + +/* Allocator adaption layer. Some stdlibs provide allocators without rebind + * and template ctors. These facilities are simulated with the external + * template class rebind_to and the aid of partial_std_allocator_wrapper. + */ + +namespace allocator{ + +/* partial_std_allocator_wrapper inherits the functionality of a std + * allocator while providing a templatized ctor and other bits missing + * in some stdlib implementation or another. + */ + +template +class partial_std_allocator_wrapper:public std::allocator +{ +public: + /* Oddly enough, STLport does not define std::allocator::value_type + * when configured to work without partial template specialization. + * No harm in supplying the definition here unconditionally. + */ + + typedef Type value_type; + + partial_std_allocator_wrapper(){}; + + template + partial_std_allocator_wrapper(const partial_std_allocator_wrapper&){} + + partial_std_allocator_wrapper(const std::allocator& x): + std::allocator(x) + { + }; + +#if defined(BOOST_DINKUMWARE_STDLIB) + /* Dinkumware guys didn't provide a means to call allocate() without + * supplying a hint, in disagreement with the standard. + */ + + Type* allocate(std::size_t n,const void* hint=0) + { + std::allocator& a=*this; + return a.allocate(n,hint); + } +#endif + +}; + +/* Detects whether a given allocator belongs to a defective stdlib not + * having the required member templates. + * Note that it does not suffice to check the Boost.Config stdlib + * macros, as the user might have passed a custom, compliant allocator. + * The checks also considers partial_std_allocator_wrapper to be + * a standard defective allocator. + */ + +#if defined(BOOST_NO_STD_ALLOCATOR)&&\ + (defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB)) + +template +struct is_partial_std_allocator +{ + BOOST_STATIC_CONSTANT(bool, + value= + (is_same< + std::allocator, + Allocator + >::value)|| + (is_same< + partial_std_allocator_wrapper< + BOOST_DEDUCED_TYPENAME Allocator::value_type>, + Allocator + >::value)); +}; + +#else + +template +struct is_partial_std_allocator +{ + BOOST_STATIC_CONSTANT(bool,value=false); +}; + +#endif + +/* rebind operations for defective std allocators */ + +template +struct partial_std_allocator_rebind_to +{ + typedef partial_std_allocator_wrapper type; +}; + +/* rebind operation in all other cases */ + +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) +/* Workaround for a problem in MSVC with dependent template typedefs + * when doing rebinding of allocators. + * Modeled after (thanks, Aleksey!) + */ + +template +struct rebinder +{ + template struct fake_allocator:Allocator{}; + template<> struct fake_allocator + { + template struct rebind{}; + }; + + template + struct result: + fake_allocator::value>:: + template rebind + { + }; +}; +#else +template +struct rebinder +{ + template + struct result + { + typedef typename Allocator::BOOST_NESTED_TEMPLATE + rebind::other other; + }; +}; +#endif + +template +struct compliant_allocator_rebind_to +{ + typedef typename rebinder:: + BOOST_NESTED_TEMPLATE result::other type; +}; + +/* rebind front-end */ + +template +struct rebind_to: + mpl::eval_if_c< + is_partial_std_allocator::value, + partial_std_allocator_rebind_to, + compliant_allocator_rebind_to + > +{ +}; + +/* allocator-independent versions of construct and destroy */ + +template +void construct(void* p,const Type& t) +{ + new (p) Type(t); +} + +template +void destroy(const Type* p) +{ + p->~Type(); +} + +} /* namespace boost::detail::allocator */ + +} /* namespace boost::detail */ + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count.hpp new file mode 100644 index 0000000000..c53a63bc24 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count.hpp @@ -0,0 +1,119 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/atomic_count.hpp - thread/SMP safe reference counter +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// +// typedef boost::detail::atomic_count; +// +// atomic_count a(n); +// +// (n is convertible to long) +// +// Effects: Constructs an atomic_count with an initial value of n +// +// a; +// +// Returns: (long) the current value of a +// +// ++a; +// +// Effects: Atomically increments the value of a +// Returns: nothing +// +// --a; +// +// Effects: Atomically decrements the value of a +// Returns: (long) zero if the new value of a is zero, +// unspecified non-zero value otherwise (usually the new value) +// +// Important note: when --a returns zero, it must act as a +// read memory barrier (RMB); i.e. the calling thread must +// have a synchronized view of the memory +// +// On Intel IA-32 (x86) memory is always synchronized, so this +// is not a problem. +// +// On many architectures the atomic instructions already act as +// a memory barrier. +// +// This property is necessary for proper reference counting, since +// a thread can update the contents of a shared object, then +// release its reference, and another thread may immediately +// release the last reference causing object destruction. +// +// The destructor needs to have a synchronized view of the +// object to perform proper cleanup. +// +// Original example by Alexander Terekhov: +// +// Given: +// +// - a mutable shared object OBJ; +// - two threads THREAD1 and THREAD2 each holding +// a private smart_ptr object pointing to that OBJ. +// +// t1: THREAD1 updates OBJ (thread-safe via some synchronization) +// and a few cycles later (after "unlock") destroys smart_ptr; +// +// t2: THREAD2 destroys smart_ptr WITHOUT doing any synchronization +// with respect to shared mutable object OBJ; OBJ destructors +// are called driven by smart_ptr interface... +// + +#include + +#ifndef BOOST_HAS_THREADS + +namespace boost +{ + +namespace detail +{ + +typedef long atomic_count; + +} + +} + +#elif defined(BOOST_AC_USE_PTHREADS) +# include + +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) +# include + +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +# include + +#elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) ) +# include + +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +# include + +#elif defined(BOOST_HAS_PTHREADS) + +# define BOOST_AC_USE_PTHREADS +# include + +#else + +// Use #define BOOST_DISABLE_THREADS to avoid the error +#error Unrecognized threading platform + +#endif + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_gcc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_gcc.hpp new file mode 100644 index 0000000000..1160e44dff --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_gcc.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED + +// +// boost/detail/atomic_count_gcc.hpp +// +// atomic_count for GNU libstdc++ v3 +// +// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2002 Lars Gullik Bjønnes +// Copyright 2003-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +#if defined(__GLIBCXX__) // g++ 3.4+ + +using __gnu_cxx::__atomic_add; +using __gnu_cxx::__exchange_and_add; + +#endif + +class atomic_count +{ +public: + + explicit atomic_count(long v) : value_(v) {} + + void operator++() + { + __atomic_add(&value_, 1); + } + + long operator--() + { + return __exchange_and_add(&value_, -1) - 1; + } + + operator long() const + { + return __exchange_and_add(&value_, 0); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable _Atomic_word value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_gcc_x86.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_gcc_x86.hpp new file mode 100644 index 0000000000..1312e8ce8f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_gcc_x86.hpp @@ -0,0 +1,84 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED + +// +// boost/detail/atomic_count_gcc_x86.hpp +// +// atomic_count for g++ on 486+/AMD64 +// +// Copyright 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ) : value_( static_cast< int >( v ) ) {} + + void operator++() + { + __asm__ + ( + "lock\n\t" + "incl %0": + "+m"( value_ ): // output (%0) + : // inputs + "cc" // clobbers + ); + } + + long operator--() + { + return atomic_exchange_and_add( &value_, -1 ) - 1; + } + + operator long() const + { + return atomic_exchange_and_add( &value_, 0 ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable int value_; + +private: + + static int atomic_exchange_and_add( int * pw, int dv ) + { + // int r = *pw; + // *pw += dv; + // return r; + + int r; + + __asm__ __volatile__ + ( + "lock\n\t" + "xadd %1, %0": + "+m"( *pw ), "=r"( r ): // outputs (%0, %1) + "1"( dv ): // inputs (%2 == %1) + "memory", "cc" // clobbers + ); + + return r; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_pthreads.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_pthreads.hpp new file mode 100644 index 0000000000..7ed055f7d6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_pthreads.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED + +// +// boost/detail/atomic_count_pthreads.hpp +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// +// 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 + +// +// The generic pthread_mutex-based implementation sometimes leads to +// inefficiencies. Example: a class with two atomic_count members +// can get away with a single mutex. +// +// Users can detect this situation by checking BOOST_AC_USE_PTHREADS. +// + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +private: + + class scoped_lock + { + public: + + scoped_lock(pthread_mutex_t & m): m_(m) + { + pthread_mutex_lock(&m_); + } + + ~scoped_lock() + { + pthread_mutex_unlock(&m_); + } + + private: + + pthread_mutex_t & m_; + }; + +public: + + explicit atomic_count(long v): value_(v) + { + pthread_mutex_init(&mutex_, 0); + } + + ~atomic_count() + { + pthread_mutex_destroy(&mutex_); + } + + void operator++() + { + scoped_lock lock(mutex_); + ++value_; + } + + long operator--() + { + scoped_lock lock(mutex_); + return --value_; + } + + operator long() const + { + scoped_lock lock(mutex_); + return value_; + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable pthread_mutex_t mutex_; + long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_solaris.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_solaris.hpp new file mode 100644 index 0000000000..8e2907fc76 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_solaris.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED + +// +// boost/detail/atomic_count_solaris.hpp +// based on: boost/detail/atomic_count_win32.hpp +// +// Copyright (c) 2001-2005 Peter Dimov +// Copyright (c) 2006 Michael van der Westhuizen +// +// 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 + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( uint32_t v ): value_( v ) + { + } + + long operator++() + { + return atomic_inc_32_nv( &value_ ); + } + + long operator--() + { + return atomic_dec_32_nv( &value_ ); + } + + operator uint32_t() const + { + return static_cast( value_ ); + } + +private: + + atomic_count( atomic_count const & ); + atomic_count & operator=( atomic_count const & ); + + uint32_t value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_sync.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_sync.hpp new file mode 100644 index 0000000000..676d3f98e4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_sync.hpp @@ -0,0 +1,61 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED + +// +// boost/detail/atomic_count_sync.hpp +// +// atomic_count for g++ 4.1+ +// +// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html +// +// Copyright 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ) : value_( v ) {} + + void operator++() + { + __sync_add_and_fetch( &value_, 1 ); + } + + long operator--() + { + return __sync_add_and_fetch( &value_, -1 ); + } + + operator long() const + { + return __sync_fetch_and_add( &value_, 0 ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_win32.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_win32.hpp new file mode 100644 index 0000000000..0de25377fa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/atomic_count_win32.hpp @@ -0,0 +1,63 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/atomic_count_win32.hpp +// +// Copyright (c) 2001-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ): value_( v ) + { + } + + long operator++() + { + return BOOST_INTERLOCKED_INCREMENT( &value_ ); + } + + long operator--() + { + return BOOST_INTERLOCKED_DECREMENT( &value_ ); + } + + operator long() const + { + return static_cast( value_ ); + } + +private: + + atomic_count( atomic_count const & ); + atomic_count & operator=( atomic_count const & ); + + long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/bad_weak_ptr.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/bad_weak_ptr.hpp new file mode 100644 index 0000000000..93ecec9b69 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/bad_weak_ptr.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED +#define BOOST_BAD_WEAK_PTR_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/bad_weak_ptr.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// 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 + +#ifdef __BORLANDC__ +# pragma warn -8026 // Functions with excep. spec. are not expanded inline +#endif + +namespace boost +{ + +// The standard library that comes with Borland C++ 5.5.1, 5.6.4 +// defines std::exception and its members as having C calling +// convention (-pc). When the definition of bad_weak_ptr +// is compiled with -ps, the compiler issues an error. +// Hence, the temporary #pragma option -pc below. + +#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +# pragma option push -pc +#endif + +class bad_weak_ptr: public std::exception +{ +public: + + virtual char const * what() const throw() + { + return "tr1::bad_weak_ptr"; + } +}; + +#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +# pragma option pop +#endif + +} // namespace boost + +#ifdef __BORLANDC__ +# pragma warn .8026 // Functions with excep. spec. are not expanded inline +#endif + +#endif // #ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/binary_search.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/binary_search.hpp new file mode 100644 index 0000000000..3dca9b6509 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/binary_search.hpp @@ -0,0 +1,216 @@ +// Copyright (c) 2000 David Abrahams. +// 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) 1994 +// Hewlett-Packard Company +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. Hewlett-Packard Company makes no +// representations about the suitability of this software for any +// purpose. It is provided "as is" without express or implied warranty. +// +// Copyright (c) 1996 +// Silicon Graphics Computer Systems, Inc. +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. Silicon Graphics makes no +// representations about the suitability of this software for any +// purpose. It is provided "as is" without express or implied warranty. +// +#ifndef BINARY_SEARCH_DWA_122600_H_ +# define BINARY_SEARCH_DWA_122600_H_ + +# include +# include + +namespace boost { namespace detail { + +template +ForwardIter lower_bound(ForwardIter first, ForwardIter last, + const Tp& val) +{ + typedef detail::iterator_traits traits; + + typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type half; + ForwardIter middle; + + while (len > 0) { + half = len >> 1; + middle = first; + std::advance(middle, half); + if (*middle < val) { + first = middle; + ++first; + len = len - half - 1; + } + else + len = half; + } + return first; +} + +template +ForwardIter lower_bound(ForwardIter first, ForwardIter last, + const Tp& val, Compare comp) +{ + typedef detail::iterator_traits traits; + + typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type half; + ForwardIter middle; + + while (len > 0) { + half = len >> 1; + middle = first; + std::advance(middle, half); + if (comp(*middle, val)) { + first = middle; + ++first; + len = len - half - 1; + } + else + len = half; + } + return first; +} + +template +ForwardIter upper_bound(ForwardIter first, ForwardIter last, + const Tp& val) +{ + typedef detail::iterator_traits traits; + + typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type half; + ForwardIter middle; + + while (len > 0) { + half = len >> 1; + middle = first; + std::advance(middle, half); + if (val < *middle) + len = half; + else { + first = middle; + ++first; + len = len - half - 1; + } + } + return first; +} + +template +ForwardIter upper_bound(ForwardIter first, ForwardIter last, + const Tp& val, Compare comp) +{ + typedef detail::iterator_traits traits; + + typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type half; + ForwardIter middle; + + while (len > 0) { + half = len >> 1; + middle = first; + std::advance(middle, half); + if (comp(val, *middle)) + len = half; + else { + first = middle; + ++first; + len = len - half - 1; + } + } + return first; +} + +template +std::pair +equal_range(ForwardIter first, ForwardIter last, const Tp& val) +{ + typedef detail::iterator_traits traits; + + typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type half; + ForwardIter middle, left, right; + + while (len > 0) { + half = len >> 1; + middle = first; + std::advance(middle, half); + if (*middle < val) { + first = middle; + ++first; + len = len - half - 1; + } + else if (val < *middle) + len = half; + else { + left = boost::detail::lower_bound(first, middle, val); + std::advance(first, len); + right = boost::detail::upper_bound(++middle, first, val); + return std::pair(left, right); + } + } + return std::pair(first, first); +} + +template +std::pair +equal_range(ForwardIter first, ForwardIter last, const Tp& val, + Compare comp) +{ + typedef detail::iterator_traits traits; + + typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type half; + ForwardIter middle, left, right; + + while (len > 0) { + half = len >> 1; + middle = first; + std::advance(middle, half); + if (comp(*middle, val)) { + first = middle; + ++first; + len = len - half - 1; + } + else if (comp(val, *middle)) + len = half; + else { + left = boost::detail::lower_bound(first, middle, val, comp); + std::advance(first, len); + right = boost::detail::upper_bound(++middle, first, val, comp); + return std::pair(left, right); + } + } + return std::pair(first, first); +} + +template +bool binary_search(ForwardIter first, ForwardIter last, + const Tp& val) { + ForwardIter i = boost::detail::lower_bound(first, last, val); + return i != last && !(val < *i); +} + +template +bool binary_search(ForwardIter first, ForwardIter last, + const Tp& val, + Compare comp) { + ForwardIter i = boost::detail::lower_bound(first, last, val, comp); + return i != last && !comp(val, *i); +} + +}} // namespace boost::detail + +#endif // BINARY_SEARCH_DWA_122600_H_ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/call_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/call_traits.hpp new file mode 100644 index 0000000000..6ad646ec60 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/call_traits.hpp @@ -0,0 +1,164 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// 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/utility for most recent version including documentation. + +// call_traits: defines typedefs for function usage +// (see libs/utility/call_traits.htm) + +/* Release notes: + 23rd July 2000: + Fixed array specialization. (JM) + Added Borland specific fixes for reference types + (issue raised by Steve Cleary). +*/ + +#ifndef BOOST_DETAIL_CALL_TRAITS_HPP +#define BOOST_DETAIL_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif +#include + +#include +#include +#include + +namespace boost{ + +namespace detail{ + +template +struct ct_imp2 +{ + typedef const T& param_type; +}; + +template +struct ct_imp2 +{ + typedef const T param_type; +}; + +template +struct ct_imp +{ + typedef const T& param_type; +}; + +template +struct ct_imp +{ + typedef typename ct_imp2::param_type param_type; +}; + +template +struct ct_imp +{ + typedef const T param_type; +}; + +} + +template +struct call_traits +{ +public: + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + // + // C++ Builder workaround: we should be able to define a compile time + // constant and pass that as a single template parameter to ct_imp, + // however compiler bugs prevent this - instead pass three bool's to + // ct_imp and add an extra partial specialisation + // of ct_imp to handle the logic. (JM) + typedef typename boost::detail::ct_imp< + T, + ::boost::is_pointer::value, + ::boost::is_arithmetic::value + >::param_type param_type; +}; + +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; + +#if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 ) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; + +template +struct call_traits< T * > +{ + typedef T * value_type; + typedef T * & reference; + typedef T * const & const_reference; + typedef T * const param_type; // hh removed const +}; +#endif +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +template +struct call_traits +{ +private: + typedef T array_type[N]; +public: + // degrades array to pointer: + typedef const T* value_type; + typedef array_type& reference; + typedef const array_type& const_reference; + typedef const T* const param_type; +}; + +template +struct call_traits +{ +private: + typedef const T array_type[N]; +public: + // degrades array to pointer: + typedef const T* value_type; + typedef array_type& reference; + typedef const array_type& const_reference; + typedef const T* const param_type; +}; +#endif + +} + +#endif // BOOST_DETAIL_CALL_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/catch_exceptions.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/catch_exceptions.hpp new file mode 100644 index 0000000000..b1a3c76b2a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/catch_exceptions.hpp @@ -0,0 +1,146 @@ +// boost/catch_exceptions.hpp -----------------------------------------------// + +// Copyright Beman Dawes 1995-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 documentation. + +// Revision History +// 13 Jun 01 report_exception() made inline. (John Maddock, Jesse Jones) +// 26 Feb 01 Numerous changes suggested during formal review. (Beman) +// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp. +// 22 Jan 01 Remove test_tools dependencies to reduce coupling. +// 5 Nov 00 Initial boost version (Beman Dawes) + +#ifndef BOOST_CATCH_EXCEPTIONS_HPP +#define BOOST_CATCH_EXCEPTIONS_HPP + +// header dependencies are deliberately restricted to the standard library +// to reduce coupling to other boost libraries. +#include // for string +#include // for bad_alloc +#include // for bad_cast, bad_typeid +#include // for exception, bad_exception +#include // for std exception hierarchy +#include // for exit codes +# if __GNUC__ != 2 || __GNUC_MINOR__ > 96 +# include // for ostream +# else +# include // workaround GNU missing ostream header +# endif + +# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551) +# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT +# endif + +#if defined(MPW_CPLUS) && (MPW_CPLUS <= 0x890) +# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT + namespace std { class bad_typeid { }; } +# endif + +namespace boost +{ + + namespace detail + { + // A separate reporting function was requested during formal review. + inline void report_exception( std::ostream & os, + const char * name, const char * info ) + { os << "\n** uncaught exception: " << name << " " << info << std::endl; } + } + + // catch_exceptions ------------------------------------------------------// + + template< class Generator > // Generator is function object returning int + int catch_exceptions( Generator function_object, + std::ostream & out, std::ostream & err ) + { + int result = 0; // quiet compiler warnings + bool exception_thrown = true; // avoid setting result for each excptn type + +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + result = function_object(); + exception_thrown = false; +#ifndef BOOST_NO_EXCEPTIONS + } + + // As a result of hard experience with strangely interleaved output + // under some compilers, there is a lot of use of endl in the code below + // where a simple '\n' might appear to do. + + // The rules for catch & arguments are a bit different from function + // arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't + // required, but it doesn't hurt and some programmers ask for it. + + catch ( const char * ex ) + { detail::report_exception( out, "", ex ); } + catch ( const std::string & ex ) + { detail::report_exception( out, "", ex.c_str() ); } + + // std:: exceptions + catch ( const std::bad_alloc & ex ) + { detail::report_exception( out, "std::bad_alloc:", ex.what() ); } + +# ifndef BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT + catch ( const std::bad_cast & ex ) + { detail::report_exception( out, "std::bad_cast:", ex.what() ); } + catch ( const std::bad_typeid & ex ) + { detail::report_exception( out, "std::bad_typeid:", ex.what() ); } +# else + catch ( const std::bad_cast & ) + { detail::report_exception( out, "std::bad_cast", "" ); } + catch ( const std::bad_typeid & ) + { detail::report_exception( out, "std::bad_typeid", "" ); } +# endif + + catch ( const std::bad_exception & ex ) + { detail::report_exception( out, "std::bad_exception:", ex.what() ); } + catch ( const std::domain_error & ex ) + { detail::report_exception( out, "std::domain_error:", ex.what() ); } + catch ( const std::invalid_argument & ex ) + { detail::report_exception( out, "std::invalid_argument:", ex.what() ); } + catch ( const std::length_error & ex ) + { detail::report_exception( out, "std::length_error:", ex.what() ); } + catch ( const std::out_of_range & ex ) + { detail::report_exception( out, "std::out_of_range:", ex.what() ); } + catch ( const std::range_error & ex ) + { detail::report_exception( out, "std::range_error:", ex.what() ); } + catch ( const std::overflow_error & ex ) + { detail::report_exception( out, "std::overflow_error:", ex.what() ); } + catch ( const std::underflow_error & ex ) + { detail::report_exception( out, "std::underflow_error:", ex.what() ); } + catch ( const std::logic_error & ex ) + { detail::report_exception( out, "std::logic_error:", ex.what() ); } + catch ( const std::runtime_error & ex ) + { detail::report_exception( out, "std::runtime_error:", ex.what() ); } + catch ( const std::exception & ex ) + { detail::report_exception( out, "std::exception:", ex.what() ); } + + catch ( ... ) + { detail::report_exception( out, "unknown exception", "" ); } +#endif // BOOST_NO_EXCEPTIONS + + if ( exception_thrown ) result = boost::exit_exception_failure; + + if ( result != 0 && result != exit_success ) + { + out << std::endl << "**** returning with error code " + << result << std::endl; + err + << "********** errors detected; see stdout for details ***********" + << std::endl; + } +#if !defined(BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE) + else { out << std::flush << "no errors detected" << std::endl; } +#endif + return result; + } // catch_exceptions + +} // boost + +#endif // BOOST_CATCH_EXCEPTIONS_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/compressed_pair.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/compressed_pair.hpp new file mode 100644 index 0000000000..3f326456ce --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/compressed_pair.hpp @@ -0,0 +1,443 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// 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/utility for most recent version including documentation. + +// compressed_pair: pair that "compresses" empty members +// (see libs/utility/compressed_pair.htm) +// +// JM changes 25 Jan 2004: +// For the case where T1 == T2 and both are empty, then first() and second() +// should return different objects. +// JM changes 25 Jan 2000: +// Removed default arguments from compressed_pair_switch to get +// C++ Builder 4 to accept them +// rewriten swap to get gcc and C++ builder to compile. +// added partial specialisations for case T1 == T2 to avoid duplicate constructor defs. + +#ifndef BOOST_DETAIL_COMPRESSED_PAIR_HPP +#define BOOST_DETAIL_COMPRESSED_PAIR_HPP + +#include + +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4512) +#endif +namespace boost +{ + +template +class compressed_pair; + + +// compressed_pair + +namespace details +{ + // JM altered 26 Jan 2000: + template + struct compressed_pair_switch; + + template + struct compressed_pair_switch + {static const int value = 0;}; + + template + struct compressed_pair_switch + {static const int value = 3;}; + + template + struct compressed_pair_switch + {static const int value = 1;}; + + template + struct compressed_pair_switch + {static const int value = 2;}; + + template + struct compressed_pair_switch + {static const int value = 4;}; + + template + struct compressed_pair_switch + {static const int value = 5;}; + + template class compressed_pair_imp; + +#ifdef __GNUC__ + // workaround for GCC (JM): + using std::swap; +#endif + // + // can't call unqualified swap from within classname::swap + // as Koenig lookup rules will find only the classname::swap + // member function not the global declaration, so use cp_swap + // as a forwarding function (JM): + template + inline void cp_swap(T& t1, T& t2) + { +#ifndef __GNUC__ + using std::swap; +#endif + swap(t1, t2); + } + + // 0 derive from neither + + template + class compressed_pair_imp + { + public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_imp() {} + + compressed_pair_imp(first_param_type x, second_param_type y) + : first_(x), second_(y) {} + + compressed_pair_imp(first_param_type x) + : first_(x) {} + + compressed_pair_imp(second_param_type y) + : second_(y) {} + + first_reference first() {return first_;} + first_const_reference first() const {return first_;} + + second_reference second() {return second_;} + second_const_reference second() const {return second_;} + + void swap(::boost::compressed_pair& y) + { + cp_swap(first_, y.first()); + cp_swap(second_, y.second()); + } + private: + first_type first_; + second_type second_; + }; + + // 1 derive from T1 + + template + class compressed_pair_imp + : protected ::boost::remove_cv::type + { + public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_imp() {} + + compressed_pair_imp(first_param_type x, second_param_type y) + : first_type(x), second_(y) {} + + compressed_pair_imp(first_param_type x) + : first_type(x) {} + + compressed_pair_imp(second_param_type y) + : second_(y) {} + + first_reference first() {return *this;} + first_const_reference first() const {return *this;} + + second_reference second() {return second_;} + second_const_reference second() const {return second_;} + + void swap(::boost::compressed_pair& y) + { + // no need to swap empty base class: + cp_swap(second_, y.second()); + } + private: + second_type second_; + }; + + // 2 derive from T2 + + template + class compressed_pair_imp + : protected ::boost::remove_cv::type + { + public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_imp() {} + + compressed_pair_imp(first_param_type x, second_param_type y) + : second_type(y), first_(x) {} + + compressed_pair_imp(first_param_type x) + : first_(x) {} + + compressed_pair_imp(second_param_type y) + : second_type(y) {} + + first_reference first() {return first_;} + first_const_reference first() const {return first_;} + + second_reference second() {return *this;} + second_const_reference second() const {return *this;} + + void swap(::boost::compressed_pair& y) + { + // no need to swap empty base class: + cp_swap(first_, y.first()); + } + + private: + first_type first_; + }; + + // 3 derive from T1 and T2 + + template + class compressed_pair_imp + : protected ::boost::remove_cv::type, + protected ::boost::remove_cv::type + { + public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_imp() {} + + compressed_pair_imp(first_param_type x, second_param_type y) + : first_type(x), second_type(y) {} + + compressed_pair_imp(first_param_type x) + : first_type(x) {} + + compressed_pair_imp(second_param_type y) + : second_type(y) {} + + first_reference first() {return *this;} + first_const_reference first() const {return *this;} + + second_reference second() {return *this;} + second_const_reference second() const {return *this;} + // + // no need to swap empty bases: + void swap(::boost::compressed_pair&) {} + }; + + // JM + // 4 T1 == T2, T1 and T2 both empty + // Originally this did not store an instance of T2 at all + // but that led to problems beause it meant &x.first() == &x.second() + // which is not true for any other kind of pair, so now we store an instance + // of T2 just in case the user is relying on first() and second() returning + // different objects (albeit both empty). + template + class compressed_pair_imp + : protected ::boost::remove_cv::type + { + public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_imp() {} + + compressed_pair_imp(first_param_type x, second_param_type y) + : first_type(x), m_second(y) {} + + compressed_pair_imp(first_param_type x) + : first_type(x), m_second(x) {} + + first_reference first() {return *this;} + first_const_reference first() const {return *this;} + + second_reference second() {return m_second;} + second_const_reference second() const {return m_second;} + + void swap(::boost::compressed_pair&) {} + private: + T2 m_second; + }; + + // 5 T1 == T2 and are not empty: //JM + + template + class compressed_pair_imp + { + public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_imp() {} + + compressed_pair_imp(first_param_type x, second_param_type y) + : first_(x), second_(y) {} + + compressed_pair_imp(first_param_type x) + : first_(x), second_(x) {} + + first_reference first() {return first_;} + first_const_reference first() const {return first_;} + + second_reference second() {return second_;} + second_const_reference second() const {return second_;} + + void swap(::boost::compressed_pair& y) + { + cp_swap(first_, y.first()); + cp_swap(second_, y.second()); + } + private: + first_type first_; + second_type second_; + }; + +} // details + +template +class compressed_pair + : private ::boost::details::compressed_pair_imp::type, typename remove_cv::type>::value, + ::boost::is_empty::value, + ::boost::is_empty::value>::value> +{ +private: + typedef details::compressed_pair_imp::type, typename remove_cv::type>::value, + ::boost::is_empty::value, + ::boost::is_empty::value>::value> base; +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair() : base() {} + compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} + explicit compressed_pair(first_param_type x) : base(x) {} + explicit compressed_pair(second_param_type y) : base(y) {} + + first_reference first() {return base::first();} + first_const_reference first() const {return base::first();} + + second_reference second() {return base::second();} + second_const_reference second() const {return base::second();} + + void swap(compressed_pair& y) { base::swap(y); } +}; + +// JM +// Partial specialisation for case where T1 == T2: +// +template +class compressed_pair + : private details::compressed_pair_imp::type, typename remove_cv::type>::value, + ::boost::is_empty::value, + ::boost::is_empty::value>::value> +{ +private: + typedef details::compressed_pair_imp::type, typename remove_cv::type>::value, + ::boost::is_empty::value, + ::boost::is_empty::value>::value> base; +public: + typedef T first_type; + typedef T second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair() : base() {} + compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} +#if !(defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) + explicit +#endif + compressed_pair(first_param_type x) : base(x) {} + + first_reference first() {return base::first();} + first_const_reference first() const {return base::first();} + + second_reference second() {return base::second();} + second_const_reference second() const {return base::second();} + + void swap(::boost::compressed_pair& y) { base::swap(y); } +}; + +template +inline +void +swap(compressed_pair& x, compressed_pair& y) +{ + x.swap(y); +} + +} // boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/dynamic_bitset.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/dynamic_bitset.hpp new file mode 100644 index 0000000000..281aa55cd6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/dynamic_bitset.hpp @@ -0,0 +1,229 @@ +// ----------------------------------------------------------- +// +// Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek +// Copyright (c) 2003-2006, 2008 Gennaro Prota +// +// 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_DETAIL_DYNAMIC_BITSET_HPP +#define BOOST_DETAIL_DYNAMIC_BITSET_HPP + +#include +#include "boost/config.hpp" +#include "boost/detail/workaround.hpp" + + +namespace boost { + + namespace detail { + namespace dynamic_bitset_impl { + + // Gives (read-)access to the object representation + // of an object of type T (3.9p4). CANNOT be used + // on a base sub-object + // + template + inline const unsigned char * object_representation (T* p) + { + return static_cast(static_cast(p)); + } + + template + struct shifter + { + static void left_shift(T & v) { + amount >= width ? (v = 0) + : (v >>= BOOST_DYNAMIC_BITSET_WRAP_CONSTANT(amount)); + } + }; + + // ------- count function implementation -------------- + + typedef unsigned char byte_type; + + // These two entities + // + // enum mode { access_by_bytes, access_by_blocks }; + // template struct mode_to_type {}; + // + // were removed, since the regression logs (as of 24 Aug 2008) + // showed that several compilers had troubles with recognizing + // + // const mode m = access_by_bytes + // + // as a constant expression + // + // * So, we'll use bool, instead of enum *. + // + template + struct value_to_type + { + value_to_type() {} + }; + const bool access_by_bytes = true; + const bool access_by_blocks = false; + + + // the table: wrapped in a class template, so + // that it is only instantiated if/when needed + // + template + struct count_table { static const byte_type table[]; }; + + template <> + struct count_table { /* no table */ }; + + + const unsigned int table_width = 8; + template + const byte_type count_table::table[] = + { + // Automatically generated by GPTableGen.exe v.1.0 + // + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 + }; + + + // overload for access by bytes + // + + template + inline std::size_t do_count(Iterator first, std::size_t length, + int /*dummy param*/, + value_to_type* ) + { + std::size_t num = 0; + if (length) + { + const byte_type * p = object_representation(&*first); + length *= sizeof(*first); + + do { + num += count_table<>::table[*p]; + ++p; + --length; + + } while (length); + } + + return num; + } + + + // overload for access by blocks + // + template + inline std::size_t do_count(Iterator first, std::size_t length, ValueType, + value_to_type*) + { + std::size_t num = 0; + while (length){ + + ValueType value = *first; + while (value) { + num += count_table<>::table[value & ((1u<>= table_width; + } + + ++first; + --length; + } + + return num; + } + + // ------------------------------------------------------- + + + // Some library implementations simply return a dummy + // value such as + // + // size_type(-1) / sizeof(T) + // + // from vector<>::max_size. This tries to get more + // meaningful info. + // + template + typename T::size_type vector_max_size_workaround(const T & v) { + + typedef typename T::allocator_type allocator_type; + + const typename allocator_type::size_type alloc_max = + v.get_allocator().max_size(); + const typename T::size_type container_max = v.max_size(); + + return alloc_max < container_max? + alloc_max : + container_max; + } + + // for static_asserts + template + struct allowed_block_type { + enum { value = T(-1) > 0 }; // ensure T has no sign + }; + + template <> + struct allowed_block_type { + enum { value = false }; + }; + + + template + struct is_numeric { + enum { value = false }; + }; + +# define BOOST_dynamic_bitset_is_numeric(x) \ + template<> \ + struct is_numeric< x > { \ + enum { value = true }; \ + } /**/ + + BOOST_dynamic_bitset_is_numeric(bool); + BOOST_dynamic_bitset_is_numeric(char); + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + BOOST_dynamic_bitset_is_numeric(wchar_t); +#endif + + BOOST_dynamic_bitset_is_numeric(signed char); + BOOST_dynamic_bitset_is_numeric(short int); + BOOST_dynamic_bitset_is_numeric(int); + BOOST_dynamic_bitset_is_numeric(long int); + + BOOST_dynamic_bitset_is_numeric(unsigned char); + BOOST_dynamic_bitset_is_numeric(unsigned short); + BOOST_dynamic_bitset_is_numeric(unsigned int); + BOOST_dynamic_bitset_is_numeric(unsigned long); + +#if defined(BOOST_HAS_LONG_LONG) + BOOST_dynamic_bitset_is_numeric(::boost::long_long_type); + BOOST_dynamic_bitset_is_numeric(::boost::ulong_long_type); +#endif + + // intentionally omitted + //BOOST_dynamic_bitset_is_numeric(float); + //BOOST_dynamic_bitset_is_numeric(double); + //BOOST_dynamic_bitset_is_numeric(long double); + +#undef BOOST_dynamic_bitset_is_numeric + + } // dynamic_bitset_impl + } // namespace detail + +} // namespace boost + +#endif // include guard + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/endian.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/endian.hpp new file mode 100644 index 0000000000..6936dba0f3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/endian.hpp @@ -0,0 +1,73 @@ +// Copyright 2005 Caleb Epstein +// Copyright 2006 John Maddock +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* + * Copyright notice reproduced from , from + * which this code was originally taken. + * + * Modified by Caleb Epstein to use with GNU libc and to + * defined the BOOST_ENDIAN macro. + */ + +#ifndef BOOST_DETAIL_ENDIAN_HPP +#define BOOST_DETAIL_ENDIAN_HPP + +// GNU libc offers the helpful header which defines +// __BYTE_ORDER + +#if defined (__GLIBC__) +# include +# if (__BYTE_ORDER == __LITTLE_ENDIAN) +# define BOOST_LITTLE_ENDIAN +# elif (__BYTE_ORDER == __BIG_ENDIAN) +# define BOOST_BIG_ENDIAN +# elif (__BYTE_ORDER == __PDP_ENDIAN) +# define BOOST_PDP_ENDIAN +# else +# error Unknown machine endianness detected. +# endif +# define BOOST_BYTE_ORDER __BYTE_ORDER +#elif defined(_BIG_ENDIAN) +# define BOOST_BIG_ENDIAN +# define BOOST_BYTE_ORDER 4321 +#elif defined(_LITTLE_ENDIAN) +# define BOOST_LITTLE_ENDIAN +# define BOOST_BYTE_ORDER 1234 +#elif defined(__sparc) || defined(__sparc__) \ + || defined(_POWER) || defined(__powerpc__) \ + || defined(__ppc__) || defined(__hpux) \ + || defined(_MIPSEB) || defined(_POWER) \ + || defined(__s390__) +# define BOOST_BIG_ENDIAN +# define BOOST_BYTE_ORDER 4321 +#elif defined(__i386__) || defined(__alpha__) \ + || defined(__ia64) || defined(__ia64__) \ + || defined(_M_IX86) || defined(_M_IA64) \ + || defined(_M_ALPHA) || defined(__amd64) \ + || defined(__amd64__) || defined(_M_AMD64) \ + || defined(__x86_64) || defined(__x86_64__) \ + || defined(_M_X64) + +# define BOOST_LITTLE_ENDIAN +# define BOOST_BYTE_ORDER 1234 +#else +# error The file boost/detail/endian.hpp needs to be set up for your CPU type. +#endif + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/has_default_constructor.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/has_default_constructor.hpp new file mode 100644 index 0000000000..319b30abcd --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/has_default_constructor.hpp @@ -0,0 +1,29 @@ + +// (C) Copyright Matthias Troyerk 2006. +// 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_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED +#define BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED + +#include + +namespace boost { namespace detail { + +/// type trait to check for a default constructor +/// +/// The default implementation just checks for a trivial constructor. +/// Using some compiler magic it might be possible to provide a better default + +template +struct has_default_constructor + : public has_trivial_constructor +{}; + +} } // namespace boost::detail + + +#endif // BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/identifier.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/identifier.hpp new file mode 100644 index 0000000000..688a664f7d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/identifier.hpp @@ -0,0 +1,89 @@ +// boost/identifier.hpp ----------------------------------------------------// + +// Copyright Beman Dawes 2006 + +// 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 documentation at http://www.boost.org/libs/utility + +#ifndef BOOST_IDENTIFIER_HPP +#define BOOST_IDENTIFIER_HPP + +#include +#include +#include + +namespace boost +{ + namespace detail + { + // class template identifier ---------------------------------------------// + + // Always used as a base class so that different instantiations result in + // different class types even if instantiated with the same value type T. + + // Expected usage is that T is often an integer type, best passed by + // value. There is no reason why T can't be a possibly larger class such as + // std::string, best passed by const reference. + + // This implementation uses pass by value, based on expected common uses. + + template + class identifier + { + public: + typedef T value_type; + + const value_type value() const { return m_value; } + void assign( value_type v ) { m_value = v; } + + bool operator==( const D & rhs ) const { return m_value == rhs.m_value; } + bool operator!=( const D & rhs ) const { return m_value != rhs.m_value; } + bool operator< ( const D & rhs ) const { return m_value < rhs.m_value; } + bool operator<=( const D & rhs ) const { return m_value <= rhs.m_value; } + bool operator> ( const D & rhs ) const { return m_value > rhs.m_value; } + bool operator>=( const D & rhs ) const { return m_value >= rhs.m_value; } + + typedef void (*unspecified_bool_type)(D); // without the D, unspecified_bool_type + static void unspecified_bool_true(D){} // conversion allows relational operators + // between different identifier types + + operator unspecified_bool_type() const { return m_value == value_type() ? 0 : unspecified_bool_true; } + bool operator!() const { return m_value == value_type(); } + + // constructors are protected so that class can only be used as a base class + protected: + identifier() {} + explicit identifier( value_type v ) : m_value(v) {} + + #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround + private: + #endif + T m_value; + }; + + //#ifndef BOOST_NO_SFINAE + + // template + // typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >, + // Ostream & >::type operator<<( Ostream & os, const Id & id ) + // { + // return os << id.value(); + // } + + // template + // typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >, + // Istream & >::type operator>>( Istream & is, Id & id ) + // { + // typename Id::value_type v; + // is >> v; + // id.value( v ); + // return is; + // } + //#endif + + } // namespace detail +} // namespace boost + +#endif // BOOST_IDENTIFIER_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/indirect_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/indirect_traits.hpp new file mode 100644 index 0000000000..f9c0cd6a04 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/indirect_traits.hpp @@ -0,0 +1,487 @@ +// Copyright David Abrahams 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef INDIRECT_TRAITS_DWA2002131_HPP +# define INDIRECT_TRAITS_DWA2002131_HPP +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include +# include + +# include +# include +# include +# include +# include +# include + +# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# include +# endif + +namespace boost { namespace detail { + +namespace indirect_traits { + +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct is_reference_to_const : mpl::false_ +{ +}; + +template +struct is_reference_to_const : mpl::true_ +{ +}; + +# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround +template +struct is_reference_to_const : mpl::true_ +{ +}; +# endif + +template +struct is_reference_to_function : mpl::false_ +{ +}; + +template +struct is_reference_to_function : is_function +{ +}; + +template +struct is_pointer_to_function : mpl::false_ +{ +}; + +// There's no such thing as a pointer-to-cv-function, so we don't need +// specializations for those +template +struct is_pointer_to_function : is_function +{ +}; + +template +struct is_reference_to_member_function_pointer_impl : mpl::false_ +{ +}; + +template +struct is_reference_to_member_function_pointer_impl + : is_member_function_pointer::type> +{ +}; + + +template +struct is_reference_to_member_function_pointer + : is_reference_to_member_function_pointer_impl +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) +}; + +template +struct is_reference_to_function_pointer_aux + : mpl::and_< + is_reference + , is_pointer_to_function< + typename remove_cv< + typename remove_reference::type + >::type + > + > +{ + // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those +}; + +template +struct is_reference_to_function_pointer + : mpl::if_< + is_reference_to_function + , mpl::false_ + , is_reference_to_function_pointer_aux + >::type +{ +}; + +template +struct is_reference_to_non_const + : mpl::and_< + is_reference + , mpl::not_< + is_reference_to_const + > + > +{ +}; + +template +struct is_reference_to_volatile : mpl::false_ +{ +}; + +template +struct is_reference_to_volatile : mpl::true_ +{ +}; + +# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround +template +struct is_reference_to_volatile : mpl::true_ +{ +}; +# endif + + +template +struct is_reference_to_pointer : mpl::false_ +{ +}; + +template +struct is_reference_to_pointer : mpl::true_ +{ +}; + +template +struct is_reference_to_pointer : mpl::true_ +{ +}; + +template +struct is_reference_to_pointer : mpl::true_ +{ +}; + +template +struct is_reference_to_pointer : mpl::true_ +{ +}; + +template +struct is_reference_to_class + : mpl::and_< + is_reference + , is_class< + typename remove_cv< + typename remove_reference::type + >::type + > + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) +}; + +template +struct is_pointer_to_class + : mpl::and_< + is_pointer + , is_class< + typename remove_cv< + typename remove_pointer::type + >::type + > + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T)) +}; + +# else + +using namespace boost::detail::is_function_ref_tester_; + +typedef char (&inner_yes_type)[3]; +typedef char (&inner_no_type)[2]; +typedef char (&outer_no_type)[1]; + +template +struct is_const_help +{ + typedef typename mpl::if_< + is_const + , inner_yes_type + , inner_no_type + >::type type; +}; + +template +struct is_volatile_help +{ + typedef typename mpl::if_< + is_volatile + , inner_yes_type + , inner_no_type + >::type type; +}; + +template +struct is_pointer_help +{ + typedef typename mpl::if_< + is_pointer + , inner_yes_type + , inner_no_type + >::type type; +}; + +template +struct is_class_help +{ + typedef typename mpl::if_< + is_class + , inner_yes_type + , inner_no_type + >::type type; +}; + +template +struct is_reference_to_function_aux +{ + static T t; + BOOST_STATIC_CONSTANT( + bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type)); + typedef mpl::bool_ type; + }; + +template +struct is_reference_to_function + : mpl::if_, is_reference_to_function_aux, mpl::bool_ >::type +{ +}; + +template +struct is_pointer_to_function_aux +{ + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type)); + typedef mpl::bool_ type; +}; + +template +struct is_pointer_to_function + : mpl::if_, is_pointer_to_function_aux, mpl::bool_ >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T)) +}; + +struct false_helper1 +{ + template + struct apply : mpl::false_ + { + }; +}; + +template +typename is_const_help::type reference_to_const_helper(V&); +outer_no_type +reference_to_const_helper(...); + +struct true_helper1 +{ + template + struct apply + { + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type)); + typedef mpl::bool_ type; + }; +}; + +template +struct is_reference_to_const_helper1 : true_helper1 +{ +}; + +template <> +struct is_reference_to_const_helper1 : false_helper1 +{ +}; + + +template +struct is_reference_to_const + : is_reference_to_const_helper1::value>::template apply +{ +}; + + +template +struct is_reference_to_non_const_helper1 +{ + template + struct apply + { + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type)); + + typedef mpl::bool_ type; + }; +}; + +template <> +struct is_reference_to_non_const_helper1 : false_helper1 +{ +}; + + +template +struct is_reference_to_non_const + : is_reference_to_non_const_helper1::value>::template apply +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T)) +}; + + +template +typename is_volatile_help::type reference_to_volatile_helper(V&); +outer_no_type +reference_to_volatile_helper(...); + +template +struct is_reference_to_volatile_helper1 +{ + template + struct apply + { + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type)); + typedef mpl::bool_ type; + }; +}; + +template <> +struct is_reference_to_volatile_helper1 : false_helper1 +{ +}; + + +template +struct is_reference_to_volatile + : is_reference_to_volatile_helper1::value>::template apply +{ +}; + +template +typename is_pointer_help::type reference_to_pointer_helper(V&); +outer_no_type reference_to_pointer_helper(...); + +template +struct reference_to_pointer_impl +{ + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type)) + ); + + typedef mpl::bool_ type; +}; + +template +struct is_reference_to_pointer + : mpl::eval_if, reference_to_pointer_impl, mpl::false_>::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T)) +}; + +template +struct is_reference_to_function_pointer + : mpl::eval_if, is_pointer_to_function_aux, mpl::false_>::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T)) +}; + + +template +struct is_member_function_pointer_help + : mpl::if_, inner_yes_type, inner_no_type> +{}; + +template +typename is_member_function_pointer_help::type member_function_pointer_helper(V&); +outer_no_type member_function_pointer_helper(...); + +template +struct is_pointer_to_member_function_aux +{ + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type)); + typedef mpl::bool_ type; +}; + +template +struct is_reference_to_member_function_pointer + : mpl::if_< + is_reference + , is_pointer_to_member_function_aux + , mpl::bool_ + >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) +}; + +template +typename is_class_help::type reference_to_class_helper(V const volatile&); +outer_no_type reference_to_class_helper(...); + +template +struct is_reference_to_class +{ + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = (is_reference::value + & (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type))) + ); + typedef mpl::bool_ type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) +}; + +template +typename is_class_help::type pointer_to_class_helper(V const volatile*); +outer_no_type pointer_to_class_helper(...); + +template +struct is_pointer_to_class +{ + static T t; + BOOST_STATIC_CONSTANT( + bool, value + = (is_pointer::value + && sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type)) + ); + typedef mpl::bool_ type; +}; +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} + +using namespace indirect_traits; + +}} // namespace boost::python::detail + +#endif // INDIRECT_TRAITS_DWA2002131_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/interlocked.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/interlocked.hpp new file mode 100644 index 0000000000..b6c8d75001 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/interlocked.hpp @@ -0,0 +1,130 @@ +#ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED +#define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/interlocked.hpp +// +// Copyright 2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined( BOOST_USE_WINDOWS_H ) + +# include + +# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer + +#elif defined(_WIN32_WCE) + +// under Windows CE we still have old-style Interlocked* functions + +extern "C" long __cdecl InterlockedIncrement( long* ); +extern "C" long __cdecl InterlockedDecrement( long* ); +extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); +extern "C" long __cdecl InterlockedExchange( long*, long ); +extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); + +# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long*)(dest),(long)(exchange))) + +#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) + +extern "C" long __cdecl _InterlockedIncrement( long volatile * ); +extern "C" long __cdecl _InterlockedDecrement( long volatile * ); +extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long); + +# pragma intrinsic( _InterlockedIncrement ) +# pragma intrinsic( _InterlockedDecrement ) +# pragma intrinsic( _InterlockedCompareExchange ) +# pragma intrinsic( _InterlockedExchange ) +# pragma intrinsic( _InterlockedExchangeAdd ) + +# if defined(_M_IA64) || defined(_M_AMD64) + +extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* ); +extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); + +# pragma intrinsic( _InterlockedCompareExchangePointer ) +# pragma intrinsic( _InterlockedExchangePointer ) + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer + +# else + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) + +# endif + +# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +namespace boost +{ + +namespace detail +{ + +extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); +extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); +extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); + +} // namespace detail + +} // namespace boost + +# define BOOST_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) + +#else + +# error "Interlocked intrinsics not available" + +#endif + +#endif // #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/is_function_ref_tester.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/is_function_ref_tester.hpp new file mode 100644 index 0000000000..5f367ea818 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/is_function_ref_tester.hpp @@ -0,0 +1,135 @@ + +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, +// Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED +#define BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED + +#include "boost/type_traits/detail/yes_no_type.hpp" +#include "boost/type_traits/config.hpp" + +#if defined(BOOST_TT_PREPROCESSING_MODE) +# include "boost/preprocessor/iterate.hpp" +# include "boost/preprocessor/enum_params.hpp" +# include "boost/preprocessor/comma_if.hpp" +#endif + +namespace boost { +namespace detail { +namespace is_function_ref_tester_ { + +template +boost::type_traits::no_type BOOST_TT_DECL is_function_ref_tester(T& ...); + +#if !defined(BOOST_TT_PREPROCESSING_MODE) +// preprocessor-generated part, don't edit by hand! + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23), int); + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(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), int); + +#else + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3, (0, 25, "boost/type_traits/detail/is_function_ref_tester.hpp")) +#include BOOST_PP_ITERATE() + +#endif // BOOST_TT_PREPROCESSING_MODE + +} // namespace detail +} // namespace python +} // namespace boost + +#endif // BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED + +///// iteration + +#else +#define i BOOST_PP_FRAME_ITERATION(1) + +template +boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i,T)), int); + +#undef i +#endif // BOOST_PP_IS_ITERATING diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/is_incrementable.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/is_incrementable.hpp new file mode 100644 index 0000000000..cb7d7a7b59 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/is_incrementable.hpp @@ -0,0 +1,124 @@ +// Copyright David Abrahams 2004. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef IS_INCREMENTABLE_DWA200415_HPP +# define IS_INCREMENTABLE_DWA200415_HPP + +# include +# include +# include +# include +# include + +// Must be the last include +# include + +namespace boost { namespace detail { + +// is_incrementable metafunction +// +// Requires: Given x of type T&, if the expression ++x is well-formed +// it must have complete type; otherwise, it must neither be ambiguous +// nor violate access. + +// This namespace ensures that ADL doesn't mess things up. +namespace is_incrementable_ +{ + // a type returned from operator++ when no increment is found in the + // type's own namespace + struct tag {}; + + // any soaks up implicit conversions and makes the following + // operator++ less-preferred than any other such operator that + // might be found via ADL. + struct any { template any(T const&); }; + + // This is a last-resort operator++ for when none other is found +# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 + +} + +namespace is_incrementable_2 +{ + is_incrementable_::tag operator++(is_incrementable_::any const&); + is_incrementable_::tag operator++(is_incrementable_::any const&,int); +} +using namespace is_incrementable_2; + +namespace is_incrementable_ +{ + +# else + + tag operator++(any const&); + tag operator++(any const&,int); + +# endif + +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ + || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# define BOOST_comma(a,b) (a) +# else + // In case an operator++ is found that returns void, we'll use ++x,0 + tag operator,(tag,int); +# define BOOST_comma(a,b) (a,b) +# endif + + // two check overloads help us identify which operator++ was picked + char (& check(tag) )[2]; + + template + char check(T const&); + + + template + struct impl + { + static typename boost::remove_cv::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1 + ); + }; + + template + struct postfix_impl + { + static typename boost::remove_cv::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1 + ); + }; +} + +# undef BOOST_comma + +template +struct is_incrementable +BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl::value) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl::value) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T)) +}; + +template +struct is_postfix_incrementable +BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl::value) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl::value) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T)) +}; + +} // namespace detail + +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable) +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable) + +} // namespace boost + +# include + +#endif // IS_INCREMENTABLE_DWA200415_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/is_xxx.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/is_xxx.hpp new file mode 100644 index 0000000000..cb64fb32b8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/is_xxx.hpp @@ -0,0 +1,61 @@ +// Copyright David Abrahams 2005. Distributed under the Boost +// Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_DETAIL_IS_XXX_DWA20051011_HPP +# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP + +# include +# include +# include + +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +# include +# include + +# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ +template \ +struct is_##name \ +{ \ + typedef char yes; \ + typedef char (&no)[2]; \ + \ + static typename add_reference::type dummy; \ + \ + struct helpers \ + { \ + template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \ + static yes test( \ + qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \ + ); \ + \ + template \ + static no test(U&, ...); \ + }; \ + \ + BOOST_STATIC_CONSTANT( \ + bool, value \ + = !is_reference::value \ + & (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \ + \ + typedef mpl::bool_ type; \ +}; + +# else + +# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ +template \ +struct is_##name : mpl::false_ \ +{ \ +}; \ + \ +template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \ +struct is_##name< \ + qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \ +> \ + : mpl::true_ \ +{ \ +}; + +# endif + +#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/iterator.hpp new file mode 100644 index 0000000000..5bb9c6269c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/iterator.hpp @@ -0,0 +1,494 @@ +// (C) Copyright David Abrahams 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Boost versions of +// +// std::iterator_traits<>::iterator_category +// std::iterator_traits<>::difference_type +// std::distance() +// +// ...for all compilers and iterators +// +// Additionally, if X is a pointer +// std::iterator_traits::pointer + +// Otherwise, if partial specialization is supported or X is not a pointer +// std::iterator_traits::value_type +// std::iterator_traits::pointer +// std::iterator_traits::reference +// +// See http://www.boost.org for most recent version including documentation. + +// Revision History +// 04 Mar 2001 - More attempted fixes for Intel C++ (David Abrahams) +// 03 Mar 2001 - Put all implementation into namespace +// boost::detail::iterator_traits_. Some progress made on fixes +// for Intel compiler. (David Abrahams) +// 02 Mar 2001 - Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few +// places. (Jeremy Siek) +// 19 Feb 2001 - Improved workarounds for stock MSVC6; use yes_type and +// no_type from type_traits.hpp; stopped trying to remove_cv +// before detecting is_pointer, in honor of the new type_traits +// semantics. (David Abrahams) +// 13 Feb 2001 - Make it work with nearly all standard-conforming iterators +// under raw VC6. The one category remaining which will fail is +// that of iterators derived from std::iterator but not +// boost::iterator and which redefine difference_type. +// 11 Feb 2001 - Clean away code which can never be used (David Abrahams) +// 09 Feb 2001 - Always have a definition for each traits member, even if it +// can't be properly deduced. These will be incomplete types in +// some cases (undefined), but it helps suppress MSVC errors +// elsewhere (David Abrahams) +// 07 Feb 2001 - Support for more of the traits members where possible, making +// this useful as a replacement for std::iterator_traits when +// used as a default template parameter. +// 06 Feb 2001 - Removed useless #includes of standard library headers +// (David Abrahams) + +#ifndef ITERATOR_DWA122600_HPP_ +# define ITERATOR_DWA122600_HPP_ + +# include +# include + +// STLPort 4.0 and betas have a bug when debugging is enabled and there is no +// partial specialization: instead of an iterator_category typedef, the standard +// container iterators have _Iterator_category. +// +// Also, whether debugging is enabled or not, there is a broken specialization +// of std::iterator which has no +// typedefs but iterator_category. +# if defined(__SGI_STL_PORT) + +# if (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && defined(__STL_DEBUG) +# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +# endif + +# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION + +# endif // STLPort <= 4.1b4 && no partial specialization + +# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \ + && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_MSVC_STD_ITERATOR) + +namespace boost { namespace detail { + +// Define a new template so it can be specialized +template +struct iterator_traits + : std::iterator_traits +{}; +using std::distance; + +}} // namespace boost::detail + +# else + +# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_MSVC_STD_ITERATOR) + +// This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS + +namespace boost { namespace detail { + +// Rogue Wave Standard Library fools itself into thinking partial +// specialization is missing on some platforms (e.g. Sun), so fails to +// supply iterator_traits! +template +struct iterator_traits +{ + typedef typename Iterator::value_type value_type; + typedef typename Iterator::reference reference; + typedef typename Iterator::pointer pointer; + typedef typename Iterator::difference_type difference_type; + typedef typename Iterator::iterator_category iterator_category; +}; + +template +struct iterator_traits +{ + typedef T value_type; + typedef T& reference; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + typedef std::random_access_iterator_tag iterator_category; +}; + +template +struct iterator_traits +{ + typedef T value_type; + typedef T const& reference; + typedef T const* pointer; + typedef std::ptrdiff_t difference_type; + typedef std::random_access_iterator_tag iterator_category; +}; + +}} // namespace boost::detail + +# else + +# include +# include +# include + +# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# include +# include +# endif +# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION +# include +# endif + +# include +# include +# include + +// should be the last #include +# include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { namespace detail { + +BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) +BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer) +BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category) + +// is_mutable_iterator -- +// +// A metafunction returning true iff T is a mutable iterator type +// with a nested value_type. Will only work portably with iterators +// whose operator* returns a reference, but that seems to be OK for +// the iterators supplied by Dinkumware. Some input iterators may +// compile-time if they arrive here, and if the compiler is strict +// about not taking the address of an rvalue. + +// This one detects ordinary mutable iterators - the result of +// operator* is convertible to the value_type. +template +type_traits::yes_type is_mutable_iterator_helper(T const*, BOOST_DEDUCED_TYPENAME T::value_type*); + +// Since you can't take the address of an rvalue, the guts of +// is_mutable_iterator_impl will fail if we use &*t directly. This +// makes sure we can still work with non-lvalue iterators. +template T* mutable_iterator_lvalue_helper(T& x); +int mutable_iterator_lvalue_helper(...); + + +// This one detects output iterators such as ostream_iterator which +// return references to themselves. +template +type_traits::yes_type is_mutable_iterator_helper(T const*, T const*); + +type_traits::no_type is_mutable_iterator_helper(...); + +template +struct is_mutable_iterator_impl +{ + static T t; + + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + detail::is_mutable_iterator_helper( + (T*)0 + , mutable_iterator_lvalue_helper(*t) // like &*t + )) + == sizeof(type_traits::yes_type) + ); +}; + +BOOST_TT_AUX_BOOL_TRAIT_DEF1( + is_mutable_iterator,T,::boost::detail::is_mutable_iterator_impl::value) + + +// is_full_iterator_traits -- +// +// A metafunction returning true iff T has all the requisite nested +// types to satisfy the requirements for a fully-conforming +// iterator_traits implementation. +template +struct is_full_iterator_traits_impl +{ + enum { value = + has_value_type::value + & has_reference::value + & has_pointer::value + & has_difference_type::value + & has_iterator_category::value + }; +}; + +BOOST_TT_AUX_BOOL_TRAIT_DEF1( + is_full_iterator_traits,T,::boost::detail::is_full_iterator_traits_impl::value) + + +# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +BOOST_MPL_HAS_XXX_TRAIT_DEF(_Iterator_category) + +// is_stlport_40_debug_iterator -- +// +// A metafunction returning true iff T has all the requisite nested +// types to satisfy the requirements of an STLPort 4.0 debug iterator +// iterator_traits implementation. +template +struct is_stlport_40_debug_iterator_impl +{ + enum { value = + has_value_type::value + & has_reference::value + & has_pointer::value + & has_difference_type::value + & has__Iterator_category::value + }; +}; + +BOOST_TT_AUX_BOOL_TRAIT_DEF1( + is_stlport_40_debug_iterator,T,::boost::detail::is_stlport_40_debug_iterator_impl::value) + +template +struct stlport_40_debug_iterator_traits +{ + typedef typename T::value_type value_type; + typedef typename T::reference reference; + typedef typename T::pointer pointer; + typedef typename T::difference_type difference_type; + typedef typename T::_Iterator_category iterator_category; +}; +# endif // BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF + +template struct pointer_iterator_traits; + +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct pointer_iterator_traits +{ + typedef typename remove_const::type value_type; + typedef T* pointer; + typedef T& reference; + typedef std::random_access_iterator_tag iterator_category; + typedef std::ptrdiff_t difference_type; +}; +# else + +// In case of no template partial specialization, and if T is a +// pointer, iterator_traits::value_type can still be computed. For +// some basic types, remove_pointer is manually defined in +// type_traits/broken_compiler_spec.hpp. For others, do it yourself. + +template class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee; + +template +struct pointer_value_type + : mpl::if_< + is_same::type> + , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

+ , typename remove_const< + typename remove_pointer

::type + >::type + > +{ +}; + + +template +struct pointer_reference + : mpl::if_< + is_same::type> + , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

+ , typename remove_pointer

::type& + > +{ +}; + +template +struct pointer_iterator_traits +{ + typedef T pointer; + typedef std::random_access_iterator_tag iterator_category; + typedef std::ptrdiff_t difference_type; + + typedef typename pointer_value_type::type value_type; + typedef typename pointer_reference::type reference; +}; + +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +// We'll sort iterator types into one of these classifications, from which we +// can determine the difference_type, pointer, reference, and value_type +template +struct standard_iterator_traits +{ + typedef typename Iterator::difference_type difference_type; + typedef typename Iterator::value_type value_type; + typedef typename Iterator::pointer pointer; + typedef typename Iterator::reference reference; + typedef typename Iterator::iterator_category iterator_category; +}; + +template +struct msvc_stdlib_mutable_traits + : std::iterator_traits +{ + typedef typename std::iterator_traits::distance_type difference_type; + typedef typename std::iterator_traits::value_type* pointer; + typedef typename std::iterator_traits::value_type& reference; +}; + +template +struct msvc_stdlib_const_traits + : std::iterator_traits +{ + typedef typename std::iterator_traits::distance_type difference_type; + typedef const typename std::iterator_traits::value_type* pointer; + typedef const typename std::iterator_traits::value_type& reference; +}; + +# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION +template +struct is_bad_output_iterator + : is_base_and_derived< + std::iterator + , Iterator> +{ +}; + +struct bad_output_iterator_traits +{ + typedef void value_type; + typedef void difference_type; + typedef std::output_iterator_tag iterator_category; + typedef void pointer; + typedef void reference; +}; +# endif + +// If we're looking at an MSVC6 (old Dinkumware) ``standard'' +// iterator, this will generate an appropriate traits class. +template +struct msvc_stdlib_iterator_traits + : mpl::if_< + is_mutable_iterator + , msvc_stdlib_mutable_traits + , msvc_stdlib_const_traits + >::type +{}; + +template +struct non_pointer_iterator_traits + : mpl::if_< + // if the iterator contains all the right nested types... + is_full_iterator_traits + // Use a standard iterator_traits implementation + , standard_iterator_traits +# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF + // Check for STLPort 4.0 broken _Iterator_category type + , mpl::if_< + is_stlport_40_debug_iterator + , stlport_40_debug_iterator_traits +# endif + // Otherwise, assume it's a Dinkum iterator + , msvc_stdlib_iterator_traits +# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF + >::type +# endif + >::type +{ +}; + +template +struct iterator_traits_aux + : mpl::if_< + is_pointer + , pointer_iterator_traits + , non_pointer_iterator_traits + >::type +{ +}; + +template +struct iterator_traits +{ + // Explicit forwarding from base class needed to keep MSVC6 happy + // under some circumstances. + private: +# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION + typedef + typename mpl::if_< + is_bad_output_iterator + , bad_output_iterator_traits + , iterator_traits_aux + >::type base; +# else + typedef iterator_traits_aux base; +# endif + public: + typedef typename base::value_type value_type; + typedef typename base::pointer pointer; + typedef typename base::reference reference; + typedef typename base::difference_type difference_type; + typedef typename base::iterator_category iterator_category; +}; + +// This specialization cuts off ETI (Early Template Instantiation) for MSVC. +template <> struct iterator_traits +{ + typedef int value_type; + typedef int pointer; + typedef int reference; + typedef int difference_type; + typedef int iterator_category; +}; + +}} // namespace boost::detail + +# endif // workarounds + +namespace boost { namespace detail { + +namespace iterator_traits_ +{ + template + struct distance_select + { + static Difference execute(Iterator i1, const Iterator i2, ...) + { + Difference result = 0; + while (i1 != i2) + { + ++i1; + ++result; + } + return result; + } + + static Difference execute(Iterator i1, const Iterator i2, std::random_access_iterator_tag*) + { + return i2 - i1; + } + }; +} // namespace boost::detail::iterator_traits_ + +template +inline typename iterator_traits::difference_type +distance(Iterator first, Iterator last) +{ + typedef typename iterator_traits::difference_type diff_t; + typedef typename ::boost::detail::iterator_traits::iterator_category iterator_category; + + return iterator_traits_::distance_select::execute( + first, last, (iterator_category*)0); +} + +}} + +# endif + + +# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION + +#endif // ITERATOR_DWA122600_HPP_ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/lcast_precision.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/lcast_precision.hpp new file mode 100644 index 0000000000..d40ca21eb3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/lcast_precision.hpp @@ -0,0 +1,184 @@ +// Copyright Alexander Nasonov & Paul A. Bristow 2006. + +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED +#define BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED + +#include +#include +#include + +#include +#include + +#ifndef BOOST_NO_IS_ABSTRACT +// Fix for SF:1358600 - lexical_cast & pure virtual functions & VC 8 STL +#include +#include +#endif + +#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || \ + (defined(BOOST_MSVC) && (BOOST_MSVC<1310)) + +#define BOOST_LCAST_NO_COMPILE_TIME_PRECISION +#endif + +#ifdef BOOST_LCAST_NO_COMPILE_TIME_PRECISION +#include +#else +#include +#endif + +namespace boost { namespace detail { + +class lcast_abstract_stub {}; + +#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION +// Calculate an argument to pass to std::ios_base::precision from +// lexical_cast. See alternative implementation for broken standard +// libraries in lcast_get_precision below. Keep them in sync, please. +template +struct lcast_precision +{ +#ifdef BOOST_NO_IS_ABSTRACT + typedef std::numeric_limits limits; // No fix for SF:1358600. +#else + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::is_abstract + , std::numeric_limits + , std::numeric_limits + >::type limits; +#endif + + BOOST_STATIC_CONSTANT(bool, use_default_precision = + !limits::is_specialized || limits::is_exact + ); + + BOOST_STATIC_CONSTANT(bool, is_specialized_bin = + !use_default_precision && + limits::radix == 2 && limits::digits > 0 + ); + + BOOST_STATIC_CONSTANT(bool, is_specialized_dec = + !use_default_precision && + limits::radix == 10 && limits::digits10 > 0 + ); + + BOOST_STATIC_CONSTANT(std::streamsize, streamsize_max = + boost::integer_traits::const_max + ); + + BOOST_STATIC_CONSTANT(unsigned int, precision_dec = limits::digits10 + 1U); + + BOOST_STATIC_ASSERT(!is_specialized_dec || + precision_dec <= streamsize_max + 0UL + ); + + BOOST_STATIC_CONSTANT(unsigned long, precision_bin = + 2UL + limits::digits * 30103UL / 100000UL + ); + + BOOST_STATIC_ASSERT(!is_specialized_bin || + (limits::digits + 0UL < ULONG_MAX / 30103UL && + precision_bin > limits::digits10 + 0UL && + precision_bin <= streamsize_max + 0UL) + ); + + BOOST_STATIC_CONSTANT(std::streamsize, value = + is_specialized_bin ? precision_bin + : is_specialized_dec ? precision_dec : 6 + ); +}; +#endif + +template +inline std::streamsize lcast_get_precision(T* = 0) +{ +#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION + return lcast_precision::value; +#else // Follow lcast_precision algorithm at run-time: + +#ifdef BOOST_NO_IS_ABSTRACT + typedef std::numeric_limits limits; // No fix for SF:1358600. +#else + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::is_abstract + , std::numeric_limits + , std::numeric_limits + >::type limits; +#endif + + bool const use_default_precision = + !limits::is_specialized || limits::is_exact; + + if(!use_default_precision) + { // Includes all built-in floating-point types, float, double ... + // and UDT types for which digits (significand bits) is defined (not zero) + + bool const is_specialized_bin = + limits::radix == 2 && limits::digits > 0; + bool const is_specialized_dec = + limits::radix == 10 && limits::digits10 > 0; + std::streamsize const streamsize_max = + (boost::integer_traits::max)(); + + if(is_specialized_bin) + { // Floating-point types with + // limits::digits defined by the specialization. + + unsigned long const digits = limits::digits; + unsigned long const precision = 2UL + digits * 30103UL / 100000UL; + // unsigned long is selected because it is at least 32-bits + // and thus ULONG_MAX / 30103UL is big enough for all types. + BOOST_ASSERT( + digits < ULONG_MAX / 30103UL && + precision > limits::digits10 + 0UL && + precision <= streamsize_max + 0UL + ); + return precision; + } + else if(is_specialized_dec) + { // Decimal Floating-point type, most likely a User Defined Type + // rather than a real floating-point hardware type. + unsigned int const precision = limits::digits10 + 1U; + BOOST_ASSERT(precision <= streamsize_max + 0UL); + return precision; + } + } + + // Integral type (for which precision has no effect) + // or type T for which limits is NOT specialized, + // so assume stream precision remains the default 6 decimal digits. + // Warning: if your User-defined Floating-point type T is NOT specialized, + // then you may lose accuracy by only using 6 decimal digits. + // To avoid this, you need to specialize T with either + // radix == 2 and digits == the number of significand bits, + // OR + // radix = 10 and digits10 == the number of decimal digits. + + return 6; +#endif +} + +template +inline void lcast_set_precision(std::ios_base& stream, T*) +{ + stream.precision(lcast_get_precision()); +} + +template +inline void lcast_set_precision(std::ios_base& stream, Source*, Target*) +{ + std::streamsize const s = lcast_get_precision((Source*)0); + std::streamsize const t = lcast_get_precision((Target*)0); + stream.precision(s > t ? s : t); +} + +}} + +#endif // BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_mutex.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_mutex.hpp new file mode 100644 index 0000000000..e740d7f69f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_mutex.hpp @@ -0,0 +1,42 @@ +#ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED +#define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lightweight_mutex.hpp - lightweight mutex +// +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// 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) +// +// typedef boost::detail::lightweight_mutex; +// +// boost::detail::lightweight_mutex is a header-only implementation of +// a subset of the Mutex concept requirements: +// +// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex +// +// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. +// + +#include + +#if !defined(BOOST_HAS_THREADS) +# include +#elif defined(BOOST_HAS_PTHREADS) +# include +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +# include +#else +// Use #define BOOST_DISABLE_THREADS to avoid the error +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_test.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_test.hpp new file mode 100644 index 0000000000..b651e0e335 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_test.hpp @@ -0,0 +1,75 @@ +#ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED +#define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lightweight_test.hpp - lightweight test library +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// +// BOOST_TEST(expression) +// BOOST_ERROR(message) +// +// int boost::report_errors() +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline int & test_errors() +{ + static int x = 0; + return x; +} + +inline void test_failed_impl(char const * expr, char const * file, int line, char const * function) +{ + std::cerr << file << "(" << line << "): test '" << expr << "' failed in function '" << function << "'" << std::endl; + ++test_errors(); +} + +inline void error_impl(char const * msg, char const * file, int line, char const * function) +{ + std::cerr << file << "(" << line << "): " << msg << " in function '" << function << "'" << std::endl; + ++test_errors(); +} + +} // namespace detail + +inline int report_errors() +{ + int errors = detail::test_errors(); + + if(errors == 0) + { + std::cerr << "No errors detected." << std::endl; + return 0; + } + else + { + std::cerr << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl; + return 1; + } +} + +} // namespace boost + +#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)) +#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) + +#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_thread.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_thread.hpp new file mode 100644 index 0000000000..6fe70a613d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/lightweight_thread.hpp @@ -0,0 +1,135 @@ +#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED +#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/detail/lightweight_thread.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +// pthread_create, pthread_join + +#if defined( BOOST_HAS_PTHREADS ) + +#include + +#else + +#include +#include + +typedef HANDLE pthread_t; + +int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg ) +{ + HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 ); + + if( h != 0 ) + { + *thread = h; + return 0; + } + else + { + return EAGAIN; + } +} + +int pthread_join( pthread_t thread, void ** /*value_ptr*/ ) +{ + ::WaitForSingleObject( thread, INFINITE ); + ::CloseHandle( thread ); + return 0; +} + +#endif + +// template int lw_thread_create( pthread_t & pt, F f ); + +namespace boost +{ + +namespace detail +{ + +class lw_abstract_thread +{ +public: + + virtual ~lw_abstract_thread() {} + virtual void run() = 0; +}; + +#if defined( BOOST_HAS_PTHREADS ) + +extern "C" void * lw_thread_routine( void * pv ) +{ + std::auto_ptr pt( static_cast( pv ) ); + + pt->run(); + + return 0; +} + +#else + +unsigned __stdcall lw_thread_routine( void * pv ) +{ + std::auto_ptr pt( static_cast( pv ) ); + + pt->run(); + + return 0; +} + +#endif + +template class lw_thread_impl: public lw_abstract_thread +{ +public: + + explicit lw_thread_impl( F f ): f_( f ) + { + } + + void run() + { + f_(); + } + +private: + + F f_; +}; + +template int lw_thread_create( pthread_t & pt, F f ) +{ + std::auto_ptr p( new lw_thread_impl( f ) ); + + int r = pthread_create( &pt, 0, lw_thread_routine, p.get() ); + + if( r == 0 ) + { + p.release(); + } + + return r; +} + +} // namespace detail +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/limits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/limits.hpp new file mode 100644 index 0000000000..6f018dfaca --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/limits.hpp @@ -0,0 +1,449 @@ +// Copyright 2001 John Maddock +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is not portable code. Parts of numeric_limits<> are + * inherently machine-dependent, and this file is written for the MIPS + * architecture and the SGI MIPSpro C++ compiler. Parts of it (in + * particular, some of the characteristics of floating-point types) + * are almost certainly incorrect for any other platform. + */ + +/* The above comment is almost certainly out of date. This file works + * on systems other than SGI MIPSpro C++ now. + */ + +/* + * Revision history: + * 21 Sep 2001: + * Only include if BOOST_NO_CWCHAR is defined. (Darin Adler) + * 10 Aug 2001: + * Added MIPS (big endian) to the big endian family. (Jens Maurer) + * 13 Apr 2001: + * Added powerpc to the big endian family. (Jeremy Siek) + * 5 Apr 2001: + * Added sparc (big endian) processor support (John Maddock). + * Initial sub: + * Modified by Jens Maurer for gcc 2.95 on x86. + */ + +#ifndef BOOST_SGI_CPP_LIMITS +#define BOOST_SGI_CPP_LIMITS + +#include +#include +#include +#include + +#ifndef BOOST_NO_CWCHAR +#include // for WCHAR_MIN and WCHAR_MAX +#endif + +namespace std { + +enum float_round_style { + round_indeterminate = -1, + round_toward_zero = 0, + round_to_nearest = 1, + round_toward_infinity = 2, + round_toward_neg_infinity = 3 +}; + +enum float_denorm_style { + denorm_indeterminate = -1, + denorm_absent = 0, + denorm_present = 1 +}; + +// The C++ standard (section 18.2.1) requires that some of the members of +// numeric_limits be static const data members that are given constant- +// initializers within the class declaration. On compilers where the +// BOOST_NO_INCLASS_MEMBER_INITIALIZATION macro is defined, it is impossible to write +// a standard-conforming numeric_limits class. +// +// There are two possible workarounds: either initialize the data +// members outside the class, or change them from data members to +// enums. Neither workaround is satisfactory: the former makes it +// impossible to use the data members in constant-expressions, and the +// latter means they have the wrong type and that it is impossible to +// take their addresses. We choose the former workaround. + +#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ + enum { __mem_name = __mem_value } +#else /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */ +# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ + static const __mem_type __mem_name = __mem_value +#endif /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */ + +// Base class for all specializations of numeric_limits. +template +class _Numeric_limits_base { +public: + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false); + + static __number min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); } + static __number max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); } + + BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, 0); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, 0); + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, false); + + BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 0); + + static __number epsilon() throw() { return __number(); } + static __number round_error() throw() { return __number(); } + + BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, 0); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, 0); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0); + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, + has_denorm, + denorm_absent); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); + + static __number infinity() throw() { return __number(); } + static __number quiet_NaN() throw() { return __number(); } + static __number signaling_NaN() throw() { return __number(); } + static __number denorm_min() throw() { return __number(); } + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, false); + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); + BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, + round_style, + round_toward_zero); +}; + +// Base class for integers. + +template +class _Integer_limits : public _Numeric_limits_base<_Int> +{ +public: + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); + + static _Int min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imin; } + static _Int max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imax; } + + BOOST_STL_DECLARE_LIMITS_MEMBER(int, + digits, + (__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT) + - (__imin == 0 ? 0 : 1) + : __idigits); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000); + // log 2 = 0.301029995664... + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, true); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2); + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, true); +}; + +#if defined(BOOST_BIG_ENDIAN) + + template + struct float_helper{ + static Number get_word() throw() { + // sizeof(long double) == 16 + const unsigned int _S_word[4] = { Word, 0, 0, 0 }; + return *reinterpret_cast(&_S_word); + } +}; + +#else + + template + struct float_helper{ + static Number get_word() throw() { + // sizeof(long double) == 12, but only 10 bytes significant + const unsigned int _S_word[4] = { 0, 0, 0, Word }; + return *reinterpret_cast( + reinterpret_cast(&_S_word)+16- + (sizeof(Number) == 12 ? 10 : sizeof(Number))); + } +}; + +#endif + +// Base class for floating-point numbers. +template +class _Floating_limits : public _Numeric_limits_base<__number> +{ +public: + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); + + BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, __Digits); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10); + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true); + + BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2); + + BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, __MinExp); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, __MaxExp); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10); + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, true); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true); + BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, + has_denorm, + denorm_indeterminate); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); + + + static __number infinity() throw() { + return float_helper<__number, __InfinityWord>::get_word(); + } + static __number quiet_NaN() throw() { + return float_helper<__number,__QNaNWord>::get_word(); + } + static __number signaling_NaN() throw() { + return float_helper<__number,__SNaNWord>::get_word(); + } + + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false /* was: true */ ); + BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); + + BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle); +}; + +// Class numeric_limits + +// The unspecialized class. + +template +class numeric_limits : public _Numeric_limits_base {}; + +// Specializations for all built-in integral types. + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<> +class numeric_limits +#if !defined(WCHAR_MAX) || !defined(WCHAR_MIN) +#if defined(_WIN32) || defined(__CYGWIN__) + : public _Integer_limits +#elif defined(__hppa) +// wchar_t has "unsigned int" as the underlying type + : public _Integer_limits +#else +// assume that wchar_t has "int" as the underlying type + : public _Integer_limits +#endif +#else +// we have WCHAR_MIN and WCHAR_MAX defined, so use it + : public _Integer_limits +#endif +{}; +#endif + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +template<> +class numeric_limits + : public _Integer_limits +{}; + +#ifdef __GNUC__ + +// Some compilers have long long, but don't define the +// LONGLONG_MIN and LONGLONG_MAX macros in limits.h. This +// assumes that long long is 64 bits. +#if !defined(LONGLONG_MAX) && !defined(ULONGLONG_MAX) + +# define ULONGLONG_MAX 0xffffffffffffffffLLU +# define LONGLONG_MAX 0x7fffffffffffffffLL + +#endif + +#if !defined(LONGLONG_MIN) +# define LONGLONG_MIN (-LONGLONG_MAX - 1) +#endif + + +#if !defined(ULONGLONG_MIN) +# define ULONGLONG_MIN 0 +#endif + +#endif /* __GNUC__ */ + +// Specializations for all built-in floating-point type. + +template<> class numeric_limits + : public _Floating_limits +{ +public: + static float min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MIN; } + static float denorm_min() throw() { return FLT_MIN; } + static float max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MAX; } + static float epsilon() throw() { return FLT_EPSILON; } + static float round_error() throw() { return 0.5f; } // Units: ulps. +}; + +template<> class numeric_limits + : public _Floating_limits +{ +public: + static double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MIN; } + static double denorm_min() throw() { return DBL_MIN; } + static double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MAX; } + static double epsilon() throw() { return DBL_EPSILON; } + static double round_error() throw() { return 0.5; } // Units: ulps. +}; + +template<> class numeric_limits + : public _Floating_limits +{ +public: + static long double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MIN; } + static long double denorm_min() throw() { return LDBL_MIN; } + static long double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MAX; } + static long double epsilon() throw() { return LDBL_EPSILON; } + static long double round_error() throw() { return 4; } // Units: ulps. +}; + +} // namespace std + +#endif /* BOOST_SGI_CPP_LIMITS */ + +// Local Variables: +// mode:C++ +// End: + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_nop.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_nop.hpp new file mode 100644 index 0000000000..c73ab68f5e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_nop.hpp @@ -0,0 +1,37 @@ +#ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED +#define BOOST_DETAIL_LWM_NOP_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_nop.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +public: + + typedef lightweight_mutex scoped_lock; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_pthreads.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_pthreads.hpp new file mode 100644 index 0000000000..a5bf75bde7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_pthreads.hpp @@ -0,0 +1,86 @@ +#ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED +#define BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_pthreads.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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 + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +private: + + pthread_mutex_t m_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { + +// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init + +#if defined(__hpux) && defined(_DECTHREADS_) + pthread_mutex_init(&m_, pthread_mutexattr_default); +#else + pthread_mutex_init(&m_, 0); +#endif + } + + ~lightweight_mutex() + { + pthread_mutex_destroy(&m_); + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + pthread_mutex_t & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + scoped_lock(lightweight_mutex & m): m_(m.m_) + { + pthread_mutex_lock(&m_); + } + + ~scoped_lock() + { + pthread_mutex_unlock(&m_); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_win32_cs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_win32_cs.hpp new file mode 100644 index 0000000000..8142069e67 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/lwm_win32_cs.hpp @@ -0,0 +1,108 @@ +#ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED +#define BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_win32_cs.hpp +// +// Copyright (c) 2002, 2003 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#ifdef BOOST_USE_WINDOWS_H +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#ifndef BOOST_USE_WINDOWS_H + +struct critical_section +{ + struct critical_section_debug * DebugInfo; + long LockCount; + long RecursionCount; + void * OwningThread; + void * LockSemaphore; +#if defined(_WIN64) + unsigned __int64 SpinCount; +#else + unsigned long SpinCount; +#endif +}; + +extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(critical_section *); +extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(critical_section *); +extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(critical_section *); +extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(critical_section *); + +#else + +typedef ::CRITICAL_SECTION critical_section; + +#endif // #ifndef BOOST_USE_WINDOWS_H + +class lightweight_mutex +{ +private: + + critical_section cs_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { + InitializeCriticalSection(&cs_); + } + + ~lightweight_mutex() + { + DeleteCriticalSection(&cs_); + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + lightweight_mutex & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + explicit scoped_lock(lightweight_mutex & m): m_(m) + { + EnterCriticalSection(&m_.cs_); + } + + ~scoped_lock() + { + LeaveCriticalSection(&m_.cs_); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/named_template_params.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/named_template_params.hpp new file mode 100644 index 0000000000..e7cb079433 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/named_template_params.hpp @@ -0,0 +1,177 @@ +// (C) Copyright Jeremy Siek 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) + +// Revision History: + +// 04 Oct 2001 David Abrahams +// Changed name of "bind" to "select" to avoid problems with MSVC. + +#ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP +#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP + +#include +#include // for is_reference +#if defined(__BORLANDC__) +#include +#endif + +namespace boost { + namespace detail { + + struct default_argument { }; + + struct dummy_default_gen { + template + struct select { + typedef default_argument type; + }; + }; + + // This class template is a workaround for MSVC. + template struct default_generator { + typedef detail::dummy_default_gen type; + }; + + template struct is_default { + enum { value = false }; + typedef type_traits::no_type type; + }; + template <> struct is_default { + enum { value = true }; + typedef type_traits::yes_type type; + }; + + struct choose_default { + template + struct select { + typedef typename default_generator::type Gen; + typedef typename Gen::template select::type type; + }; + }; + struct choose_arg { + template + struct select { + typedef Arg type; + }; + }; + +#if defined(__BORLANDC__) + template + struct choose_arg_or_default { typedef choose_arg type; }; + template <> + struct choose_arg_or_default { + typedef choose_default type; + }; +#else + template + struct choose_arg_or_default { typedef choose_arg type; }; + template <> + struct choose_arg_or_default { + typedef choose_default type; + }; +#endif + + template + class resolve_default { +#if defined(__BORLANDC__) + typedef typename choose_arg_or_default::type>::type Selector; +#else + // This usually works for Borland, but I'm seeing weird errors in + // iterator_adaptor_test.cpp when using this method. + enum { is_def = is_default::value }; + typedef typename choose_arg_or_default::type Selector; +#endif + public: + typedef typename Selector + ::template select::type type; + }; + + // To differentiate an unnamed parameter from a traits generator + // we use is_convertible. + struct named_template_param_base { }; + + template + struct is_named_param_list { + enum { value = is_convertible::value }; + }; + + struct choose_named_params { + template struct select { typedef Prev type; }; + }; + struct choose_default_arg { + template struct select { + typedef detail::default_argument type; + }; + }; + + template struct choose_default_dispatch_; + template <> struct choose_default_dispatch_ { + typedef choose_named_params type; + }; + template <> struct choose_default_dispatch_ { + typedef choose_default_arg type; + }; + // The use of inheritance here is a Solaris Forte 6 workaround. + template struct choose_default_dispatch + : public choose_default_dispatch_ { }; + + template + struct choose_default_argument { + enum { is_named = is_named_param_list::value }; + typedef typename choose_default_dispatch::type Selector; + typedef typename Selector::template select::type type; + }; + + // This macro assumes that there is a class named default_##TYPE + // defined before the application of the macro. This class should + // have a single member class template named "select" with two + // template parameters: the type of the class being created (e.g., + // the iterator_adaptor type when creating iterator adaptors) and + // a traits class. The select class should have a single typedef + // named "type" that produces the default for TYPE. See + // boost/iterator_adaptors.hpp for an example usage. Also, + // applications of this macro must be placed in namespace + // boost::detail. + +#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \ + struct get_##TYPE##_from_named { \ + template \ + struct select { \ + typedef typename NamedParams::traits NamedTraits; \ + typedef typename NamedTraits::TYPE TYPE; \ + typedef typename resolve_default::type type; \ + }; \ + }; \ + struct pass_thru_##TYPE { \ + template struct select { \ + typedef typename resolve_default::type type; \ + };\ + }; \ + template \ + struct get_##TYPE##_dispatch { }; \ + template <> struct get_##TYPE##_dispatch<1> { \ + typedef get_##TYPE##_from_named type; \ + }; \ + template <> struct get_##TYPE##_dispatch<0> { \ + typedef pass_thru_##TYPE type; \ + }; \ + template \ + class get_##TYPE { \ + enum { is_named = is_named_param_list::value }; \ + typedef typename get_##TYPE##_dispatch::type Selector; \ + public: \ + typedef typename Selector::template select::type type; \ + }; \ + template <> struct default_generator { \ + typedef default_##TYPE type; \ + } + + + } // namespace detail +} // namespace boost + +#endif // BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/no_exceptions_support.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/no_exceptions_support.hpp new file mode 100644 index 0000000000..d94e35834f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/no_exceptions_support.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ +#define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +//---------------------------------------------------------------------- +// (C) Copyright 2004 Pavel Vozenilek. +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// +// This file contains helper macros used when exception support may be +// disabled (as indicated by macro BOOST_NO_EXCEPTIONS). +// +// Before picking up these macros you may consider using RAII techniques +// to deal with exceptions - their syntax can be always the same with +// or without exception support enabled. +// + +/* Example of use: + +void foo() { + BOOST_TRY { + ... + } BOOST_CATCH(const std::bad_alloc&) { + ... + BOOST_RETHROW + } BOOST_CATCH(const std::exception& e) { + ... + } + BOOST_CATCH_END +} + +With exception support enabled it will expand into: + +void foo() { + { try { + ... + } catch (const std::bad_alloc&) { + ... + throw; + } catch (const std::exception& e) { + ... + } + } +} + +With exception support disabled it will expand into: + +void foo() { + { if(true) { + ... + } else if (false) { + ... + } else if (false) { + ... + } + } +} +*/ +//---------------------------------------------------------------------- + +#include +#include + +#if !(defined BOOST_NO_EXCEPTIONS) +# define BOOST_TRY { try +# define BOOST_CATCH(x) catch(x) +# define BOOST_RETHROW throw; +# define BOOST_CATCH_END } +#else +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# define BOOST_TRY { if ("") +# define BOOST_CATCH(x) else if (!"") +# else +# define BOOST_TRY { if (true) +# define BOOST_CATCH(x) else if (false) +# endif +# define BOOST_RETHROW +# define BOOST_CATCH_END } +#endif + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/none_t.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/none_t.hpp new file mode 100644 index 0000000000..76ba97a02f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/none_t.hpp @@ -0,0 +1,28 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// +// 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/lib/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_DETAIL_NONE_T_17SEP2003_HPP +#define BOOST_DETAIL_NONE_T_17SEP2003_HPP + +namespace boost { + +namespace detail { + +struct none_helper{}; + +typedef int none_helper::*none_t ; + +} // namespace detail + +} // namespace boost + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/numeric_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/numeric_traits.hpp new file mode 100644 index 0000000000..6325d70cb0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/numeric_traits.hpp @@ -0,0 +1,191 @@ +// (C) Copyright David Abrahams 2001, Howard Hinnant 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) +// +// Template class numeric_traits -- +// +// Supplies: +// +// typedef difference_type -- a type used to represent the difference +// between any two values of Number. +// +// Support: +// 1. Not all specializations are supplied +// +// 2. Use of specializations that are not supplied will cause a +// compile-time error +// +// 3. Users are free to specialize numeric_traits for any type. +// +// 4. Right now, specializations are only supplied for integer types. +// +// 5. On implementations which do not supply compile-time constants in +// std::numeric_limits<>, only specializations for built-in integer types +// are supplied. +// +// 6. Handling of numbers whose range of representation is at least as +// great as boost::intmax_t can cause some differences to be +// unrepresentable in difference_type: +// +// Number difference_type +// ------ --------------- +// signed Number +// unsigned intmax_t +// +// template typename numeric_traits::difference_type +// numeric_distance(Number x, Number y) +// computes (y - x), attempting to avoid overflows. +// + +// See http://www.boost.org for most recent version including documentation. + +// Revision History +// 11 Feb 2001 - Use BOOST_STATIC_CONSTANT (David Abrahams) +// 11 Feb 2001 - Rolled back ineffective Borland-specific code +// (David Abrahams) +// 10 Feb 2001 - Rolled in supposed Borland fixes from John Maddock, but +// not seeing any improvement yet (David Abrahams) +// 06 Feb 2001 - Factored if_true out into boost/detail/select_type.hpp +// (David Abrahams) +// 23 Jan 2001 - Fixed logic of difference_type selection, which was +// completely wack. In the process, added digit_traits<> +// to compute the number of digits in intmax_t even when +// not supplied by numeric_limits<>. (David Abrahams) +// 21 Jan 2001 - Created (David Abrahams) + +#ifndef BOOST_NUMERIC_TRAITS_HPP_DWA20001901 +# define BOOST_NUMERIC_TRAITS_HPP_DWA20001901 + +# include +# include +# include +# include +# include +# include + +namespace boost { namespace detail { + + // Template class is_signed -- determine whether a numeric type is signed + // Requires that T is constructable from the literals -1 and 0. Compile-time + // error results if that requirement is not met (and thus signedness is not + // likely to have meaning for that type). + template + struct is_signed + { +#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0))); +#else + BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits::is_signed); +#endif + }; + +# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + // digit_traits - compute the number of digits in a built-in integer + // type. Needed for implementations on which numeric_limits is not specialized + // for intmax_t (e.g. VC6). + template struct digit_traits_select; + + // numeric_limits is specialized; just select that version of digits + template <> struct digit_traits_select + { + template struct traits + { + BOOST_STATIC_CONSTANT(int, digits = std::numeric_limits::digits); + }; + }; + + // numeric_limits is not specialized; compute digits from sizeof(T) + template <> struct digit_traits_select + { + template struct traits + { + BOOST_STATIC_CONSTANT(int, digits = ( + sizeof(T) * std::numeric_limits::digits + - (is_signed::value ? 1 : 0)) + ); + }; + }; + + // here's the "usable" template + template struct digit_traits + { + typedef digit_traits_select< + ::std::numeric_limits::is_specialized> selector; + typedef typename selector::template traits traits; + BOOST_STATIC_CONSTANT(int, digits = traits::digits); + }; +#endif + + // Template class integer_traits -- traits of various integer types + // This should probably be rolled into boost::integer_traits one day, but I + // need it to work without + template + struct integer_traits + { +# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + private: + typedef Integer integer_type; + typedef std::numeric_limits x; +# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + // for some reason, MSVC asserts when it shouldn't unless we make these + // local definitions + BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer); + BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized); + + BOOST_STATIC_ASSERT(is_integer); + BOOST_STATIC_ASSERT(is_specialized); +# endif + public: + typedef typename + if_true<(int(x::is_signed) + && (!int(x::is_bounded) + // digits is the number of no-sign bits + || (int(x::digits) + 1 >= digit_traits::digits)))>::template then< + Integer, + + typename if_true<(int(x::digits) + 1 < digit_traits::digits)>::template then< + signed int, + + typename if_true<(int(x::digits) + 1 < digit_traits::digits)>::template then< + signed long, + + // else + intmax_t + >::type>::type>::type difference_type; +#else + BOOST_STATIC_ASSERT(boost::is_integral::value); + + typedef typename + if_true<(sizeof(Integer) >= sizeof(intmax_t))>::template then< + + typename if_true<(is_signed::value)>::template then< + Integer, + intmax_t + >::type, + + typename if_true<(sizeof(Integer) < sizeof(std::ptrdiff_t))>::template then< + std::ptrdiff_t, + intmax_t + >::type + >::type difference_type; +# endif + }; + + // Right now, only supports integers, but should be expanded. + template + struct numeric_traits + { + typedef typename integer_traits::difference_type difference_type; + }; + + template + typename numeric_traits::difference_type numeric_distance(Number x, Number y) + { + typedef typename numeric_traits::difference_type difference_type; + return difference_type(y) - difference_type(x); + } +}} + +#endif // BOOST_NUMERIC_TRAITS_HPP_DWA20001901 diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/ob_call_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/ob_call_traits.hpp new file mode 100644 index 0000000000..eb4df7a30f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/ob_call_traits.hpp @@ -0,0 +1,168 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// 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/utility for most recent version including documentation. +// +// Crippled version for crippled compilers: +// see libs/utility/call_traits.htm +// + +/* Release notes: + 01st October 2000: + Fixed call_traits on VC6, using "poor man's partial specialisation", + using ideas taken from "Generative programming" by Krzysztof Czarnecki + & Ulrich Eisenecker. +*/ + +#ifndef BOOST_OB_CALL_TRAITS_HPP +#define BOOST_OB_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ + +#ifdef BOOST_MSVC6_MEMBER_TEMPLATES +// +// use member templates to emulate +// partial specialisation: +// +namespace detail{ + +template +struct standard_call_traits +{ + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef const T& param_type; +}; +template +struct simple_call_traits +{ + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef const T param_type; +}; +template +struct reference_call_traits +{ + typedef T value_type; + typedef T reference; + typedef T const_reference; + typedef T param_type; +}; + +template +struct call_traits_chooser +{ + template + struct rebind + { + typedef standard_call_traits type; + }; +}; + +template <> +struct call_traits_chooser +{ + template + struct rebind + { + typedef simple_call_traits type; + }; +}; + +template <> +struct call_traits_chooser +{ + template + struct rebind + { + typedef reference_call_traits type; + }; +}; + +template +struct call_traits_sizeof_chooser2 +{ + template + struct small_rebind + { + typedef simple_call_traits small_type; + }; +}; + +template<> +struct call_traits_sizeof_chooser2 +{ + template + struct small_rebind + { + typedef standard_call_traits small_type; + }; +}; + +template <> +struct call_traits_chooser +{ + template + struct rebind + { + enum { sizeof_choice = (sizeof(T) <= sizeof(void*)) }; + typedef call_traits_sizeof_chooser2<(sizeof(T) <= sizeof(void*))> chooser; + typedef typename chooser::template small_rebind bound_type; + typedef typename bound_type::small_type type; + }; +}; + +} // namespace detail +template +struct call_traits +{ +private: + typedef detail::call_traits_chooser< + ::boost::is_pointer::value, + ::boost::is_arithmetic::value, + ::boost::is_reference::value + > chooser; + typedef typename chooser::template rebind bound_type; + typedef typename bound_type::type call_traits_type; +public: + typedef typename call_traits_type::value_type value_type; + typedef typename call_traits_type::reference reference; + typedef typename call_traits_type::const_reference const_reference; + typedef typename call_traits_type::param_type param_type; +}; + +#else +// +// sorry call_traits is completely non-functional +// blame your broken compiler: +// + +template +struct call_traits +{ + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef const T& param_type; +}; + +#endif // member templates + +} + +#endif // BOOST_OB_CALL_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/ob_compressed_pair.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/ob_compressed_pair.hpp new file mode 100644 index 0000000000..727acab6da --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/ob_compressed_pair.hpp @@ -0,0 +1,510 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// 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/utility for most recent version including documentation. +// see libs/utility/compressed_pair.hpp +// +/* Release notes: + 20 Jan 2001: + Fixed obvious bugs (David Abrahams) + 07 Oct 2000: + Added better single argument constructor support. + 03 Oct 2000: + Added VC6 support (JM). + 23rd July 2000: + Additional comments added. (JM) + Jan 2000: + Original version: this version crippled for use with crippled compilers + - John Maddock Jan 2000. +*/ + + +#ifndef BOOST_OB_COMPRESSED_PAIR_HPP +#define BOOST_OB_COMPRESSED_PAIR_HPP + +#include +#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_SAME_TRAITS_HPP +#include +#endif +#ifndef BOOST_CALL_TRAITS_HPP +#include +#endif + +namespace boost +{ +#ifdef BOOST_MSVC6_MEMBER_TEMPLATES +// +// use member templates to emulate +// partial specialisation. Note that due to +// problems with overload resolution with VC6 +// each of the compressed_pair versions that follow +// have one template single-argument constructor +// in place of two specific constructors: +// + +template +class compressed_pair; + +namespace detail{ + +template +struct best_conversion_traits +{ + typedef char one; + typedef char (&two)[2]; + static A a; + static one test(T1); + static two test(T2); + + enum { value = sizeof(test(a)) }; +}; + +template +struct init_one; + +template <> +struct init_one<1> +{ + template + static void init(const A& a, T1* p1, T2*) + { + *p1 = a; + } +}; + +template <> +struct init_one<2> +{ + template + static void init(const A& a, T1*, T2* p2) + { + *p2 = a; + } +}; + + +// T1 != T2, both non-empty +template +class compressed_pair_0 +{ +private: + T1 _first; + T2 _second; +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_0() : _first(), _second() {} + compressed_pair_0(first_param_type x, second_param_type y) : _first(x), _second(y) {} + template + explicit compressed_pair_0(const A& val) + { + init_one::value>::init(val, &_first, &_second); + } + compressed_pair_0(const ::boost::compressed_pair& x) + : _first(x.first()), _second(x.second()) {} + +#if 0 + compressed_pair_0& operator=(const compressed_pair_0& x) { + cout << "assigning compressed pair 0" << endl; + _first = x._first; + _second = x._second; + cout << "finished assigning compressed pair 0" << endl; + return *this; + } +#endif + + first_reference first() { return _first; } + first_const_reference first() const { return _first; } + + second_reference second() { return _second; } + second_const_reference second() const { return _second; } + + void swap(compressed_pair_0& y) + { + using std::swap; + swap(_first, y._first); + swap(_second, y._second); + } +}; + +// T1 != T2, T2 empty +template +class compressed_pair_1 : T2 +{ +private: + T1 _first; +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_1() : T2(), _first() {} + compressed_pair_1(first_param_type x, second_param_type y) : T2(y), _first(x) {} + + template + explicit compressed_pair_1(const A& val) + { + init_one::value>::init(val, &_first, static_cast(this)); + } + + compressed_pair_1(const ::boost::compressed_pair& x) + : T2(x.second()), _first(x.first()) {} + +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + // Total weirdness. If the assignment to _first is moved after + // the call to the inherited operator=, then this breaks graph/test/graph.cpp + // by way of iterator_adaptor. + compressed_pair_1& operator=(const compressed_pair_1& x) { + _first = x._first; + T2::operator=(x); + return *this; + } +#endif + + first_reference first() { return _first; } + first_const_reference first() const { return _first; } + + second_reference second() { return *this; } + second_const_reference second() const { return *this; } + + void swap(compressed_pair_1& y) + { + // no need to swap empty base class: + using std::swap; + swap(_first, y._first); + } +}; + +// T1 != T2, T1 empty +template +class compressed_pair_2 : T1 +{ +private: + T2 _second; +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_2() : T1(), _second() {} + compressed_pair_2(first_param_type x, second_param_type y) : T1(x), _second(y) {} + template + explicit compressed_pair_2(const A& val) + { + init_one::value>::init(val, static_cast(this), &_second); + } + compressed_pair_2(const ::boost::compressed_pair& x) + : T1(x.first()), _second(x.second()) {} + +#if 0 + compressed_pair_2& operator=(const compressed_pair_2& x) { + cout << "assigning compressed pair 2" << endl; + T1::operator=(x); + _second = x._second; + cout << "finished assigning compressed pair 2" << endl; + return *this; + } +#endif + first_reference first() { return *this; } + first_const_reference first() const { return *this; } + + second_reference second() { return _second; } + second_const_reference second() const { return _second; } + + void swap(compressed_pair_2& y) + { + // no need to swap empty base class: + using std::swap; + swap(_second, y._second); + } +}; + +// T1 != T2, both empty +template +class compressed_pair_3 : T1, T2 +{ +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_3() : T1(), T2() {} + compressed_pair_3(first_param_type x, second_param_type y) : T1(x), T2(y) {} + template + explicit compressed_pair_3(const A& val) + { + init_one::value>::init(val, static_cast(this), static_cast(this)); + } + compressed_pair_3(const ::boost::compressed_pair& x) + : T1(x.first()), T2(x.second()) {} + + first_reference first() { return *this; } + first_const_reference first() const { return *this; } + + second_reference second() { return *this; } + second_const_reference second() const { return *this; } + + void swap(compressed_pair_3& y) + { + // no need to swap empty base classes: + } +}; + +// T1 == T2, and empty +template +class compressed_pair_4 : T1 +{ +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_4() : T1() {} + compressed_pair_4(first_param_type x, second_param_type y) : T1(x), m_second(y) {} + // only one single argument constructor since T1 == T2 + explicit compressed_pair_4(first_param_type x) : T1(x), m_second(x) {} + compressed_pair_4(const ::boost::compressed_pair& x) + : T1(x.first()), m_second(x.second()) {} + + first_reference first() { return *this; } + first_const_reference first() const { return *this; } + + second_reference second() { return m_second; } + second_const_reference second() const { return m_second; } + + void swap(compressed_pair_4& y) + { + // no need to swap empty base classes: + } +private: + T2 m_second; +}; + +// T1 == T2, not empty +template +class compressed_pair_5 +{ +private: + T1 _first; + T2 _second; +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair_5() : _first(), _second() {} + compressed_pair_5(first_param_type x, second_param_type y) : _first(x), _second(y) {} + // only one single argument constructor since T1 == T2 + explicit compressed_pair_5(first_param_type x) : _first(x), _second(x) {} + compressed_pair_5(const ::boost::compressed_pair& c) + : _first(c.first()), _second(c.second()) {} + + first_reference first() { return _first; } + first_const_reference first() const { return _first; } + + second_reference second() { return _second; } + second_const_reference second() const { return _second; } + + void swap(compressed_pair_5& y) + { + using std::swap; + swap(_first, y._first); + swap(_second, y._second); + } +}; + +template +struct compressed_pair_chooser +{ + template + struct rebind + { + typedef compressed_pair_0 type; + }; +}; + +template <> +struct compressed_pair_chooser +{ + template + struct rebind + { + typedef compressed_pair_1 type; + }; +}; + +template <> +struct compressed_pair_chooser +{ + template + struct rebind + { + typedef compressed_pair_2 type; + }; +}; + +template <> +struct compressed_pair_chooser +{ + template + struct rebind + { + typedef compressed_pair_3 type; + }; +}; + +template <> +struct compressed_pair_chooser +{ + template + struct rebind + { + typedef compressed_pair_4 type; + }; +}; + +template <> +struct compressed_pair_chooser +{ + template + struct rebind + { + typedef compressed_pair_5 type; + }; +}; + +template +struct compressed_pair_traits +{ +private: + typedef compressed_pair_chooser::value, is_empty::value, is_same::value> chooser; + typedef typename chooser::template rebind bound_type; +public: + typedef typename bound_type::type type; +}; + +} // namespace detail + +template +class compressed_pair : public detail::compressed_pair_traits::type +{ +private: + typedef typename detail::compressed_pair_traits::type base_type; +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair() : base_type() {} + compressed_pair(first_param_type x, second_param_type y) : base_type(x, y) {} + template + explicit compressed_pair(const A& x) : base_type(x){} + + first_reference first() { return base_type::first(); } + first_const_reference first() const { return base_type::first(); } + + second_reference second() { return base_type::second(); } + second_const_reference second() const { return base_type::second(); } +}; + +template +inline void swap(compressed_pair& x, compressed_pair& y) +{ + x.swap(y); +} + +#else +// no partial specialisation, no member templates: + +template +class compressed_pair +{ +private: + T1 _first; + T2 _second; +public: + typedef T1 first_type; + typedef T2 second_type; + typedef typename call_traits::param_type first_param_type; + typedef typename call_traits::param_type second_param_type; + typedef typename call_traits::reference first_reference; + typedef typename call_traits::reference second_reference; + typedef typename call_traits::const_reference first_const_reference; + typedef typename call_traits::const_reference second_const_reference; + + compressed_pair() : _first(), _second() {} + compressed_pair(first_param_type x, second_param_type y) : _first(x), _second(y) {} + explicit compressed_pair(first_param_type x) : _first(x), _second() {} + // can't define this in case T1 == T2: + // explicit compressed_pair(second_param_type y) : _first(), _second(y) {} + + first_reference first() { return _first; } + first_const_reference first() const { return _first; } + + second_reference second() { return _second; } + second_const_reference second() const { return _second; } + + void swap(compressed_pair& y) + { + using std::swap; + swap(_first, y._first); + swap(_second, y._second); + } +}; + +template +inline void swap(compressed_pair& x, compressed_pair& y) +{ + x.swap(y); +} + +#endif + +} // boost + +#endif // BOOST_OB_COMPRESSED_PAIR_HPP + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/quick_allocator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/quick_allocator.hpp new file mode 100644 index 0000000000..ddb0a7616c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/quick_allocator.hpp @@ -0,0 +1,198 @@ +#ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED +#define BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/quick_allocator.hpp +// +// Copyright (c) 2003 David Abrahams +// Copyright (c) 2003 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#include +#include +#include + +#include // ::operator new, ::operator delete +#include // std::size_t + +namespace boost +{ + +namespace detail +{ + +template union freeblock +{ + typedef typename boost::type_with_alignment::type aligner_type; + aligner_type aligner; + char bytes[size]; + freeblock * next; +}; + +template struct allocator_impl +{ + typedef freeblock block; + + // It may seem odd to use such small pages. + // + // However, on a typical Windows implementation that uses + // the OS allocator, "normal size" pages interact with the + // "ordinary" operator new, slowing it down dramatically. + // + // 512 byte pages are handled by the small object allocator, + // and don't interfere with ::new. + // + // The other alternative is to use much bigger pages (1M.) + // + // It is surprisingly easy to hit pathological behavior by + // varying the page size. g++ 2.96 on Red Hat Linux 7.2, + // for example, passionately dislikes 496. 512 seems OK. + +#if defined(BOOST_QA_PAGE_SIZE) + + enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; + +#else + + enum { items_per_page = 512 / size }; // 1048560 / size + +#endif + +#ifdef BOOST_HAS_THREADS + + static lightweight_mutex & mutex() + { + static lightweight_mutex m; + return m; + } + + static lightweight_mutex * mutex_init; + +#endif + + static block * free; + static block * page; + static unsigned last; + + static inline void * alloc() + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + // "Listen to me carefully: there is no memory leak" + // -- Scott Meyers, Eff C++ 2nd Ed Item 10 + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + + static inline void * alloc(std::size_t n) + { + if(n != size) // class-specific new called for a derived object + { + return ::operator new(n); + } + else + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + } + + static inline void dealloc(void * pv) + { + if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast(pv); + pb->next = free; + free = pb; + } + } + + static inline void dealloc(void * pv, std::size_t n) + { + if(n != size) // class-specific delete called for a derived object + { + ::operator delete(pv); + } + else if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast(pv); + pb->next = free; + free = pb; + } + } +}; + +#ifdef BOOST_HAS_THREADS + +template + lightweight_mutex * allocator_impl::mutex_init = &allocator_impl::mutex(); + +#endif + +template + freeblock * allocator_impl::free = 0; + +template + freeblock * allocator_impl::page = 0; + +template + unsigned allocator_impl::last = allocator_impl::items_per_page; + +template +struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/reference_content.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/reference_content.hpp new file mode 100644 index 0000000000..daf56a8b19 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/reference_content.hpp @@ -0,0 +1,141 @@ +//----------------------------------------------------------------------------- +// boost detail/reference_content.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2003 +// Eric Friedman +// +// 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_DETAIL_REFERENCE_CONTENT_HPP +#define BOOST_DETAIL_REFERENCE_CONTENT_HPP + +#include "boost/config.hpp" + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +# include "boost/mpl/bool.hpp" +# include "boost/type_traits/has_nothrow_copy.hpp" +#else +# include "boost/mpl/if.hpp" +# include "boost/type_traits/is_reference.hpp" +#endif + +#include "boost/mpl/void.hpp" + +namespace boost { + +namespace detail { + +/////////////////////////////////////////////////////////////////////////////// +// (detail) class template reference_content +// +// Non-Assignable wrapper for references. +// +template +class reference_content +{ +private: // representation + + RefT content_; + +public: // structors + + ~reference_content() + { + } + + reference_content(RefT r) + : content_( r ) + { + } + + reference_content(const reference_content& operand) + : content_( operand.content_ ) + { + } + +private: // non-Assignable + + reference_content& operator=(const reference_content&); + +public: // queries + + RefT get() const + { + return content_; + } + +}; + +/////////////////////////////////////////////////////////////////////////////// +// (detail) metafunction make_reference_content +// +// Wraps with reference_content if specified type is reference. +// + +template struct make_reference_content; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct make_reference_content +{ + typedef T type; +}; + +template +struct make_reference_content< T& > +{ + typedef reference_content type; +}; + +#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct make_reference_content + : mpl::if_< + is_reference + , reference_content + , T + > +{ +}; + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround + +template <> +struct make_reference_content< mpl::void_ > +{ + template + struct apply + : make_reference_content + { + }; + + typedef mpl::void_ type; +}; + +} // namespace detail + +/////////////////////////////////////////////////////////////////////////////// +// reference_content type traits specializations +// + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct has_nothrow_copy< + ::boost::detail::reference_content< T& > + > + : mpl::true_ +{ +}; + +#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +} // namespace boost + +#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/select_type.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/select_type.hpp new file mode 100644 index 0000000000..c13946f338 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/select_type.hpp @@ -0,0 +1,36 @@ +// (C) Copyright David Abrahams 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 for most recent version including documentation. + +// Revision History +// 09 Feb 01 Applied John Maddock's Borland patch Moving +// specialization to unspecialized template (David Abrahams) +// 06 Feb 01 Created (David Abrahams) + +#ifndef SELECT_TYPE_DWA20010206_HPP +# define SELECT_TYPE_DWA20010206_HPP + +namespace boost { namespace detail { + + // Template class if_true -- select among 2 types based on a bool constant expression + // Usage: + // typename if_true<(bool_const_expression)>::template then::type + + // HP aCC cannot deal with missing names for template value parameters + template struct if_true + { + template + struct then { typedef T type; }; + }; + + template <> + struct if_true + { + template + struct then { typedef F type; }; + }; +}} +#endif // SELECT_TYPE_DWA20010206_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_array_nmt.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_array_nmt.hpp new file mode 100644 index 0000000000..13ca6aca15 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_array_nmt.hpp @@ -0,0 +1,151 @@ +#ifndef BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED +#define BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED + +// +// detail/shared_array_nmt.hpp - shared_array.hpp without member templates +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation. +// + +#include +#include +#include +#include + +#include // for std::ptrdiff_t +#include // for std::swap +#include // for std::less +#include // for std::bad_alloc + +namespace boost +{ + +template class shared_array +{ +private: + + typedef detail::atomic_count count_type; + +public: + + typedef T element_type; + + explicit shared_array(T * p = 0): px(p) + { +#ifndef BOOST_NO_EXCEPTIONS + + try // prevent leak if new throws + { + pn = new count_type(1); + } + catch(...) + { + boost::checked_array_delete(p); + throw; + } + +#else + + pn = new count_type(1); + + if(pn == 0) + { + boost::checked_array_delete(p); + boost::throw_exception(std::bad_alloc()); + } + +#endif + } + + ~shared_array() + { + if(--*pn == 0) + { + boost::checked_array_delete(px); + delete pn; + } + } + + shared_array(shared_array const & r) : px(r.px) // never throws + { + pn = r.pn; + ++*pn; + } + + shared_array & operator=(shared_array const & r) + { + shared_array(r).swap(*this); + return *this; + } + + void reset(T * p = 0) + { + BOOST_ASSERT(p == 0 || p != px); + shared_array(p).swap(*this); + } + + T * get() const // never throws + { + return px; + } + + T & operator[](std::ptrdiff_t i) const // never throws + { + BOOST_ASSERT(px != 0); + BOOST_ASSERT(i >= 0); + return px[i]; + } + + long use_count() const // never throws + { + return *pn; + } + + bool unique() const // never throws + { + return *pn == 1; + } + + void swap(shared_array & other) // never throws + { + std::swap(px, other.px); + std::swap(pn, other.pn); + } + +private: + + T * px; // contained pointer + count_type * pn; // ptr to reference counter + +}; // shared_array + +template inline bool operator==(shared_array const & a, shared_array const & b) +{ + return a.get() == b.get(); +} + +template inline bool operator!=(shared_array const & a, shared_array const & b) +{ + return a.get() != b.get(); +} + +template inline bool operator<(shared_array const & a, shared_array const & b) +{ + return std::less()(a.get(), b.get()); +} + +template void swap(shared_array & a, shared_array & b) +{ + a.swap(b); +} + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_count.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_count.hpp new file mode 100644 index 0000000000..8f1377701e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_count.hpp @@ -0,0 +1,412 @@ +#ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED +#define BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/shared_count.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#ifdef __BORLANDC__ +# pragma warn -8027 // Functions containing try are not expanded inline +#endif + +#include +#include +#include +#include +#include +#include +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including directly: +#include // std::auto_ptr +#include // std::less +#include // std::bad_alloc + +namespace boost +{ + +namespace detail +{ + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +int const shared_count_id = 0x2C35F101; +int const weak_count_id = 0x298C38A4; + +#endif + +struct sp_nothrow_tag {}; + +class weak_count; + +class shared_count +{ +private: + + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class weak_count; + +public: + + shared_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + } + + template explicit shared_count( Y * p ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_p( p ); + } + catch(...) + { + boost::checked_delete( p ); + throw; + } + +#else + + pi_ = new sp_counted_impl_p( p ); + + if( pi_ == 0 ) + { + boost::checked_delete( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif + } + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + template shared_count( Y * p, D d ): pi_(0) +#else + template shared_count( P p, D d ): pi_(0) +#endif +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + typedef Y* P; +#endif +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_pd(p, d); + } + catch(...) + { + d(p); // delete p + throw; + } + +#else + + pi_ = new sp_counted_impl_pd(p, d); + + if(pi_ == 0) + { + d(p); // delete p + boost::throw_exception(std::bad_alloc()); + } + +#endif + } + + template shared_count( P p, D d, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda impl_type; + typedef typename A::template rebind< impl_type >::other A2; + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + catch(...) + { + d( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + + if( pi_ != 0 ) + { + new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + else + { + d( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif + } + +#ifndef BOOST_NO_AUTO_PTR + + // auto_ptr is special cased to provide the strong guarantee + + template + explicit shared_count( std::auto_ptr & r ): pi_( new sp_counted_impl_p( r.get() ) ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifdef BOOST_NO_EXCEPTIONS + + if( pi_ == 0 ) + { + boost::throw_exception(std::bad_alloc()); + } + +#endif + + r.release(); + } + +#endif + + ~shared_count() // nothrow + { + if( pi_ != 0 ) pi_->release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + shared_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if( pi_ != 0 ) pi_->add_ref_copy(); + } + + explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 + shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 + + shared_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if( tmp != 0 ) tmp->add_ref_copy(); + if( pi_ != 0 ) pi_->release(); + pi_ = tmp; + } + + return *this; + } + + void swap(shared_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + bool unique() const // nothrow + { + return use_count() == 1; + } + + bool empty() const // nothrow + { + return pi_ == 0; + } + + friend inline bool operator==(shared_count const & a, shared_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(shared_count const & a, shared_count const & b) + { + return std::less()( a.pi_, b.pi_ ); + } + + void * get_deleter( sp_typeinfo const & ti ) const + { + return pi_? pi_->get_deleter( ti ): 0; + } +}; + + +class weak_count +{ +private: + + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class shared_count; + +public: + + weak_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + } + + weak_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + weak_count(weak_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + ~weak_count() // nothrow + { + if(pi_ != 0) pi_->weak_release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + weak_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } + + return *this; + } + + weak_count & operator= (weak_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } + + return *this; + } + + void swap(weak_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + friend inline bool operator==(weak_count const & a, weak_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(weak_count const & a, weak_count const & b) + { + return std::less()(a.pi_, b.pi_); + } +}; + +inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if( pi_ == 0 || !pi_->add_ref_lock() ) + { + boost::throw_exception( boost::bad_weak_ptr() ); + } +} + +inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if( pi_ != 0 && !pi_->add_ref_lock() ) + { + pi_ = 0; + } +} + +} // namespace detail + +} // namespace boost + +#ifdef __BORLANDC__ +# pragma warn .8027 // Functions containing try are not expanded inline +#endif + +#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_ptr_nmt.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_ptr_nmt.hpp new file mode 100644 index 0000000000..0780e305b5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/shared_ptr_nmt.hpp @@ -0,0 +1,182 @@ +#ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED +#define BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED + +// +// detail/shared_ptr_nmt.hpp - shared_ptr.hpp without member templates +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation. +// + +#include +#include +#include +#include + +#ifndef BOOST_NO_AUTO_PTR +# include // for std::auto_ptr +#endif + +#include // for std::swap +#include // for std::less +#include // for std::bad_alloc + +namespace boost +{ + +template class shared_ptr +{ +private: + + typedef detail::atomic_count count_type; + +public: + + typedef T element_type; + typedef T value_type; + + explicit shared_ptr(T * p = 0): px(p) + { +#ifndef BOOST_NO_EXCEPTIONS + + try // prevent leak if new throws + { + pn = new count_type(1); + } + catch(...) + { + boost::checked_delete(p); + throw; + } + +#else + + pn = new count_type(1); + + if(pn == 0) + { + boost::checked_delete(p); + boost::throw_exception(std::bad_alloc()); + } + +#endif + } + + ~shared_ptr() + { + if(--*pn == 0) + { + boost::checked_delete(px); + delete pn; + } + } + + shared_ptr(shared_ptr const & r): px(r.px) // never throws + { + pn = r.pn; + ++*pn; + } + + shared_ptr & operator=(shared_ptr const & r) + { + shared_ptr(r).swap(*this); + return *this; + } + +#ifndef BOOST_NO_AUTO_PTR + + explicit shared_ptr(std::auto_ptr & r) + { + pn = new count_type(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } + + shared_ptr & operator=(std::auto_ptr & r) + { + shared_ptr(r).swap(*this); + return *this; + } + +#endif + + void reset(T * p = 0) + { + BOOST_ASSERT(p == 0 || p != px); + shared_ptr(p).swap(*this); + } + + T & operator*() const // never throws + { + BOOST_ASSERT(px != 0); + return *px; + } + + T * operator->() const // never throws + { + BOOST_ASSERT(px != 0); + return px; + } + + T * get() const // never throws + { + return px; + } + + long use_count() const // never throws + { + return *pn; + } + + bool unique() const // never throws + { + return *pn == 1; + } + + void swap(shared_ptr & other) // never throws + { + std::swap(px, other.px); + std::swap(pn, other.pn); + } + +private: + + T * px; // contained pointer + count_type * pn; // ptr to reference counter +}; + +template inline bool operator==(shared_ptr const & a, shared_ptr const & b) +{ + return a.get() == b.get(); +} + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) +{ + return a.get() != b.get(); +} + +template inline bool operator<(shared_ptr const & a, shared_ptr const & b) +{ + return std::less()(a.get(), b.get()); +} + +template void swap(shared_ptr & a, shared_ptr & b) +{ + a.swap(b); +} + +// get_pointer() enables boost::mem_fn to recognize shared_ptr + +template inline T * get_pointer(shared_ptr const & p) +{ + return p.get(); +} + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_convertible.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_convertible.hpp new file mode 100644 index 0000000000..2c1539bd77 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_convertible.hpp @@ -0,0 +1,76 @@ +#ifndef BOOST_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED +#define BOOST_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_convertible.hpp +// +// Copyright 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x610 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +namespace boost +{ + +namespace detail +{ + +template< class Y, class T > struct sp_convertible +{ + typedef char (&yes) [1]; + typedef char (&no) [2]; + + static yes f( T* ); + static no f( ... ); + + enum _vt { value = sizeof( f( (Y*)0 ) ) == sizeof(yes) }; +}; + +struct sp_empty +{ +}; + +template< bool > struct sp_enable_if_convertible_impl; + +template<> struct sp_enable_if_convertible_impl +{ + typedef sp_empty type; +}; + +template<> struct sp_enable_if_convertible_impl +{ +}; + +template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base.hpp new file mode 100644 index 0000000000..c25a57f49b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base.hpp @@ -0,0 +1,66 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base.hpp +// +// Copyright 2005, 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined( BOOST_SP_DISABLE_THREADS ) +# include + +#elif defined( BOOST_SP_USE_SPINLOCK ) +# include + +#elif defined( BOOST_SP_USE_PTHREADS ) +# include + +#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) +# include + +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) +# include + +#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) +# include + +#elif defined(__HP_aCC) && defined(__ia64) +# include + +#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) +# include + +#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) +# include + +#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) ) +# include + +#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) +# include + +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) +# include + +#elif !defined( BOOST_HAS_THREADS ) +# include + +#else +# include + +#endif + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_acc_ia64.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_acc_ia64.hpp new file mode 100644 index 0000000000..c956b8e01d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_acc_ia64.hpp @@ -0,0 +1,150 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED + +// +// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64 +// +// Copyright 2007 Baruch Zilber +// Copyright 2007 Boris Gubenko +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + _Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int r = static_cast(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE)); + if (1 == r) + { + _Asm_mf(); + } + + return r - 1; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int v = *pw; + + for (;;) + { + if (0 == v) + { + return 0; + } + + _Asm_mov_to_ar(_AREG_CCV, + v, + (_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE)); + int r = static_cast(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE)); + if (r == v) + { + return r + 1; + } + + v = r; + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); // TODO use ld.acq here + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_cw_ppc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_cw_ppc.hpp new file mode 100644 index 0000000000..3f43252863 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_cw_ppc.hpp @@ -0,0 +1,170 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( register long * pw ) +{ + register int a; + + asm + { +loop: + + lwarx a, 0, pw + addi a, a, 1 + stwcx. a, 0, pw + bne- loop + } +} + +inline long atomic_decrement( register long * pw ) +{ + register int a; + + asm + { + sync + +loop: + + lwarx a, 0, pw + addi a, a, -1 + stwcx. a, 0, pw + bne- loop + + isync + } + + return a; +} + +inline long atomic_conditional_increment( register long * pw ) +{ + register int a; + + asm + { +loop: + + lwarx a, 0, pw + cmpwi a, 0 + beq store + + addi a, a, 1 + +store: + + stwcx. a, 0, pw + bne- loop + } + + return a; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_cw_x86.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_cw_x86.hpp new file mode 100644 index 0000000000..b2e3f9bbd1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_cw_x86.hpp @@ -0,0 +1,158 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_cw_x86.hpp - CodeWarrion on 486+ +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2005 Rene Rivera +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + // int r = *pw; + // *pw += dv; + // return r; + + asm + { + mov esi, [pw] + mov eax, dv + lock xadd dword ptr [esi], eax + } +} + +inline void atomic_increment( int * pw ) +{ + //atomic_exchange_and_add( pw, 1 ); + + asm + { + mov esi, [pw] + lock inc dword ptr [esi] + } +} + +inline int atomic_conditional_increment( int * pw ) +{ + // int rv = *pw; + // if( rv != 0 ) ++*pw; + // return rv; + + asm + { + mov esi, [pw] + mov eax, dword ptr [esi] + L0: + test eax, eax + je L1 + mov ebx, eax + inc ebx + lock cmpxchg dword ptr [esi], ebx + jne L0 + L1: + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_ia64.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_ia64.hpp new file mode 100644 index 0000000000..7535295d2b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_ia64.hpp @@ -0,0 +1,157 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED + +// +// detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2006 Peter Dimov +// Copyright 2005 Ben Hutchings +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + // No barrier is required here but fetchadd always has an acquire or + // release barrier associated with it. We choose release as it should be + // cheaper. + __asm__ ("fetchadd4.rel %0=%1,1" : + "=r"(tmp), "=m"(*pw) : + "m"( *pw )); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv; + + __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" + " cmp.eq p7,p0=1,%0 ;; \n" + "(p7) ld4.acq %0=%1 " : + "=&r"(rv), "=m"(*pw) : + "m"( *pw ) : + "p7"); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv, tmp, tmp2; + + __asm__ ("0: ld4 %0=%3 ;; \n" + " cmp.eq p7,p0=0,%0 ;; \n" + "(p7) br.cond.spnt 1f \n" + " mov ar.ccv=%0 \n" + " add %1=1,%0 ;; \n" + " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" + " cmp.ne p7,p0=%0,%2 ;; \n" + "(p7) br.cond.spnt 0b \n" + " mov %0=%1 ;; \n" + "1:" : + "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : + "m"( *pw ) : + "ar.ccv", "p7"); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); // TODO use ld.acq here + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_ppc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_ppc.hpp new file mode 100644 index 0000000000..cea2740bca --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_ppc.hpp @@ -0,0 +1,181 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + __asm__ + ( + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "addi %1, %1, 1\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b": + + "=m"( *pw ), "=&b"( tmp ): + "r"( pw ), "m"( *pw ): + "cc" + ); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv; + + __asm__ __volatile__ + ( + "sync\n\t" + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "addi %1, %1, -1\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b\n\t" + "isync": + + "=m"( *pw ), "=&b"( rv ): + "r"( pw ), "m"( *pw ): + "memory", "cc" + ); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv; + + __asm__ + ( + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "cmpwi %1, 0\n\t" + "beq 1f\n\t" + "addi %1, %1, 1\n\t" + "1:\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b": + + "=m"( *pw ), "=&b"( rv ): + "r"( pw ), "m"( *pw ): + "cc" + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_sparc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_sparc.hpp new file mode 100644 index 0000000000..2afca168d4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_sparc.hpp @@ -0,0 +1,166 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ +// +// Copyright (c) 2006 Piotr Wyderski +// Copyright (c) 2006 Tomas Puverle +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// Thanks to Michael van der Westhuizen + +#include +#include // int32_t + +namespace boost +{ + +namespace detail +{ + +inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) +{ + __asm__ __volatile__( "cas %0, %2, %1" + : "+m" (*dest_), "+r" (swap_) + : "r" (compare_) + : "memory" ); + + return swap_; +} + +inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv ) +{ + // long r = *pw; + // *pw += dv; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) + { + return r; + } + } +} + +inline void atomic_increment( int32_t * pw ) +{ + atomic_fetch_and_add( pw, 1 ); +} + +inline int32_t atomic_decrement( int32_t * pw ) +{ + return atomic_fetch_and_add( pw, -1 ); +} + +inline int32_t atomic_conditional_increment( int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( r == 0 ) + { + return r; + } + + if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int32_t use_count_; // #shared + int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_x86.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_x86.hpp new file mode 100644 index 0000000000..8bf3171f33 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_gcc_x86.hpp @@ -0,0 +1,173 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64 +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + // int r = *pw; + // *pw += dv; + // return r; + + int r; + + __asm__ __volatile__ + ( + "lock\n\t" + "xadd %1, %0": + "=m"( *pw ), "=r"( r ): // outputs (%0, %1) + "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) + "memory", "cc" // clobbers + ); + + return r; +} + +inline void atomic_increment( int * pw ) +{ + //atomic_exchange_and_add( pw, 1 ); + + __asm__ + ( + "lock\n\t" + "incl %0": + "=m"( *pw ): // output (%0) + "m"( *pw ): // input (%1) + "cc" // clobbers + ); +} + +inline int atomic_conditional_increment( int * pw ) +{ + // int rv = *pw; + // if( rv != 0 ) ++*pw; + // return rv; + + int rv, tmp; + + __asm__ + ( + "movl %0, %%eax\n\t" + "0:\n\t" + "test %%eax, %%eax\n\t" + "je 1f\n\t" + "movl %%eax, %2\n\t" + "incl %2\n\t" + "lock\n\t" + "cmpxchgl %2, %0\n\t" + "jne 0b\n\t" + "1:": + "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2) + "m"( *pw ): // input (%3) + "cc" // clobbers + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_nt.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_nt.hpp new file mode 100644 index 0000000000..dc7a04231b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_nt.hpp @@ -0,0 +1,107 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_nt.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + ++use_count_; + } + + bool add_ref_lock() // true on success + { + if( use_count_ == 0 ) return false; + ++use_count_; + return true; + } + + void release() // nothrow + { + if( --use_count_ == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + ++weak_count_; + } + + void weak_release() // nothrow + { + if( --weak_count_ == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return use_count_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_pt.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_pt.hpp new file mode 100644 index 0000000000..cd30de950d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_pt.hpp @@ -0,0 +1,135 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_pt.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + + mutable pthread_mutex_t m_; + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { +// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init + +#if defined(__hpux) && defined(_DECTHREADS_) + pthread_mutex_init( &m_, pthread_mutexattr_default ); +#else + pthread_mutex_init( &m_, 0 ); +#endif + } + + virtual ~sp_counted_base() // nothrow + { + pthread_mutex_destroy( &m_ ); + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + pthread_mutex_lock( &m_ ); + ++use_count_; + pthread_mutex_unlock( &m_ ); + } + + bool add_ref_lock() // true on success + { + pthread_mutex_lock( &m_ ); + bool r = use_count_ == 0? false: ( ++use_count_, true ); + pthread_mutex_unlock( &m_ ); + return r; + } + + void release() // nothrow + { + pthread_mutex_lock( &m_ ); + long new_use_count = --use_count_; + pthread_mutex_unlock( &m_ ); + + if( new_use_count == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + pthread_mutex_lock( &m_ ); + ++weak_count_; + pthread_mutex_unlock( &m_ ); + } + + void weak_release() // nothrow + { + pthread_mutex_lock( &m_ ); + long new_weak_count = --weak_count_; + pthread_mutex_unlock( &m_ ); + + if( new_weak_count == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + pthread_mutex_lock( &m_ ); + long r = use_count_; + pthread_mutex_unlock( &m_ ); + + return r; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_solaris.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_solaris.hpp new file mode 100644 index 0000000000..a747b391e8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_solaris.hpp @@ -0,0 +1,113 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED + +// +// detail/sp_counted_base_solaris.hpp +// based on: detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2006 Michael van der Westhuizen +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + uint32_t use_count_; // #shared + uint32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_inc_32( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + for( ;; ) + { + uint32_t tmp = static_cast< uint32_t const volatile& >( use_count_ ); + if( tmp == 0 ) return false; + if( atomic_cas_32( &use_count_, tmp, tmp + 1 ) == tmp ) return true; + } + } + + void release() // nothrow + { + if( atomic_dec_32_nv( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_inc_32( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_dec_32_nv( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_spin.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_spin.hpp new file mode 100644 index 0000000000..610a468c7e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_spin.hpp @@ -0,0 +1,131 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int r = *pw; + *pw += dv; + return r; +} + +inline void atomic_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + ++*pw; +} + +inline int atomic_conditional_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int rv = *pw; + if( rv != 0 ) ++*pw; + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + spinlock_pool<1>::scoped_lock lock( &use_count_ ); + return use_count_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_sync.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_sync.hpp new file mode 100644 index 0000000000..d72dac2bc5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_sync.hpp @@ -0,0 +1,155 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics +// +// Copyright (c) 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#if INT_MAX >= 2147483647 + +typedef int sp_int32_t; + +#else + +typedef long sp_int32_t; + +#endif + +inline void atomic_increment( sp_int32_t * pw ) +{ + __sync_fetch_and_add( pw, 1 ); +} + +inline sp_int32_t atomic_decrement( sp_int32_t * pw ) +{ + return __sync_fetch_and_add( pw, -1 ); +} + +inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + sp_int32_t r = *pw; + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); + + if( r2 == r ) + { + return r; + } + else + { + r = r2; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + sp_int32_t use_count_; // #shared + sp_int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< sp_int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_w32.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_w32.hpp new file mode 100644 index 0000000000..f9903935d8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_base_w32.hpp @@ -0,0 +1,130 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + BOOST_INTERLOCKED_INCREMENT( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + for( ;; ) + { + long tmp = static_cast< long const volatile& >( use_count_ ); + if( tmp == 0 ) return false; + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) + + // work around a code generation bug + + long tmp2 = tmp + 1; + if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; + +#else + + if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; + +#endif + } + } + + void release() // nothrow + { + if( BOOST_INTERLOCKED_DECREMENT( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + BOOST_INTERLOCKED_INCREMENT( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( BOOST_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_impl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_impl.hpp new file mode 100644 index 0000000000..81f92da249 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_counted_impl.hpp @@ -0,0 +1,231 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_impl.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) +# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. +#endif + +#include +#include + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) +#include +#endif + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) +#include // std::allocator +#endif + +#include // std::size_t + +namespace boost +{ + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn ); +void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn ); + +#endif + +namespace detail +{ + +template class sp_counted_impl_p: public sp_counted_base +{ +private: + + X * px_; + + sp_counted_impl_p( sp_counted_impl_p const & ); + sp_counted_impl_p & operator= ( sp_counted_impl_p const & ); + + typedef sp_counted_impl_p this_type; + +public: + + explicit sp_counted_impl_p( X * px ): px_( px ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_constructor_hook( px, sizeof(X), this ); +#endif + } + + virtual void dispose() // nothrow + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); +#endif + boost::checked_delete( px_ ); + } + + virtual void * get_deleter( detail::sp_typeinfo const & ) + { + return 0; + } + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) + + void * operator new( std::size_t ) + { + return std::allocator().allocate( 1, static_cast(0) ); + } + + void operator delete( void * p ) + { + std::allocator().deallocate( static_cast(p), 1 ); + } + +#endif + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) + + void * operator new( std::size_t ) + { + return quick_allocator::alloc(); + } + + void operator delete( void * p ) + { + quick_allocator::dealloc( p ); + } + +#endif +}; + +// +// Borland's Codeguard trips up over the -Vx- option here: +// +#ifdef __CODEGUARD__ +# pragma option push -Vx- +#endif + +template class sp_counted_impl_pd: public sp_counted_base +{ +private: + + P ptr; // copy constructor must not throw + D del; // copy constructor must not throw + + sp_counted_impl_pd( sp_counted_impl_pd const & ); + sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); + + typedef sp_counted_impl_pd this_type; + +public: + + // pre: d(p) must not throw + + sp_counted_impl_pd( P p, D d ): ptr(p), del(d) + { + } + + virtual void dispose() // nothrow + { + del( ptr ); + } + + virtual void * get_deleter( detail::sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast( del ): 0; + } + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) + + void * operator new( std::size_t ) + { + return std::allocator().allocate( 1, static_cast(0) ); + } + + void operator delete( void * p ) + { + std::allocator().deallocate( static_cast(p), 1 ); + } + +#endif + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) + + void * operator new( std::size_t ) + { + return quick_allocator::alloc(); + } + + void operator delete( void * p ) + { + quick_allocator::dealloc( p ); + } + +#endif +}; + +template class sp_counted_impl_pda: public sp_counted_base +{ +private: + + P p_; // copy constructor must not throw + D d_; // copy constructor must not throw + A a_; // copy constructor must not throw + + sp_counted_impl_pda( sp_counted_impl_pda const & ); + sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); + + typedef sp_counted_impl_pda this_type; + +public: + + // pre: d( p ) must not throw + + sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a ) + { + } + + virtual void dispose() // nothrow + { + d_( p_ ); + } + + virtual void destroy() // nothrow + { + typedef typename A::template rebind< this_type >::other A2; + + A2 a2( a_ ); + + this->~this_type(); + a2.deallocate( this, 1 ); + } + + virtual void * get_deleter( detail::sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; + } +}; + +#ifdef __CODEGUARD__ +# pragma option pop +#endif + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_typeinfo.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_typeinfo.hpp new file mode 100644 index 0000000000..e78c94316a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/sp_typeinfo.hpp @@ -0,0 +1,83 @@ +#ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED +#define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_typeinfo.hpp +// +// Copyright 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#if defined( BOOST_NO_TYPEID ) + +namespace boost +{ + +namespace detail +{ + +typedef void* sp_typeinfo; + +template struct sp_typeid_ +{ + static char v_; +}; + +template char sp_typeid_< T >::v_; + +template struct sp_typeid_< T const >: sp_typeid_< T > +{ +}; + +template struct sp_typeid_< T volatile >: sp_typeid_< T > +{ +}; + +template struct sp_typeid_< T const volatile >: sp_typeid_< T > +{ +}; + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID(T) (&boost::detail::sp_typeid_::v_) + +#else + +#include + +namespace boost +{ + +namespace detail +{ + +#if defined( BOOST_NO_STD_TYPEINFO ) + +typedef ::type_info sp_typeinfo; + +#else + +typedef std::type_info sp_typeinfo; + +#endif + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID(T) typeid(T) + +#endif + +#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock.hpp new file mode 100644 index 0000000000..346fb3c61f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock.hpp @@ -0,0 +1,47 @@ +#ifndef BOOST_DETAIL_SPINLOCK_HPP_INCLUDED +#define BOOST_DETAIL_SPINLOCK_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// struct spinlock +// { +// void lock(); +// bool try_lock(); +// void unlock(); +// +// class scoped_lock; +// }; +// +// #define BOOST_DETAIL_SPINLOCK_INIT +// + +#include + +#if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) +# include +#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) ) +# include +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include +#elif defined(BOOST_HAS_PTHREADS) +# include +#elif !defined(BOOST_HAS_THREADS) +# include +#else +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_DETAIL_SPINLOCK_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_gcc_arm.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_gcc_arm.hpp new file mode 100644 index 0000000000..c21163bdd1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_gcc_arm.hpp @@ -0,0 +1,85 @@ +#ifndef BOOST_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED +#define BOOST_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r; + + __asm__ __volatile__( + "swp %0, %1, [%2]": + "=&r"( r ): // outputs + "r"( 1 ), "r"( &v_ ): // inputs + "memory", "cc" ); + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __asm__ __volatile__( "" ::: "memory" ); + *const_cast< int volatile* >( &v_ ) = 0; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_nt.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_nt.hpp new file mode 100644 index 0000000000..f03ba08a45 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_nt.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED +#define BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + bool locked_; + +public: + + inline bool try_lock() + { + if( locked_ ) + { + return false; + } + else + { + locked_ = true; + return true; + } + } + + inline void lock() + { + BOOST_ASSERT( !locked_ ); + locked_ = true; + } + + inline void unlock() + { + BOOST_ASSERT( locked_ ); + locked_ = false; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { false } + +#endif // #ifndef BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_pool.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_pool.hpp new file mode 100644 index 0000000000..a264b1a331 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_pool.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_DETAIL_SPINLOCK_POOL_HPP_INCLUDED +#define BOOST_DETAIL_SPINLOCK_POOL_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock_pool.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// spinlock_pool<0> is reserved for atomic<>, when/if it arrives +// spinlock_pool<1> is reserved for shared_ptr reference counts +// spinlock_pool<2> is reserved for shared_ptr atomic access +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +template< int I > class spinlock_pool +{ +private: + + static spinlock pool_[ 41 ]; + +public: + + static spinlock & spinlock_for( void const * pv ) + { + std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; + return pool_[ i ]; + } + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) ) + { + sp_.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +template< int I > spinlock spinlock_pool< I >::pool_[ 41 ] = +{ + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT +}; + +} // namespace detail +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SPINLOCK_POOL_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_pt.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_pt.hpp new file mode 100644 index 0000000000..dfb2d6f45b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_pt.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_DETAIL_SPINLOCK_PT_HPP_INCLUDED +#define BOOST_DETAIL_SPINLOCK_PT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + pthread_mutex_t v_; + +public: + + bool try_lock() + { + return pthread_mutex_trylock( &v_ ) == 0; + } + + void lock() + { + pthread_mutex_lock( &v_ ); + } + + void unlock() + { + pthread_mutex_unlock( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER } + +#endif // #ifndef BOOST_DETAIL_SPINLOCK_PT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_sync.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_sync.hpp new file mode 100644 index 0000000000..a7523967f0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_sync.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED +#define BOOST_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r = __sync_lock_test_and_set( &v_, 1 ); + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __sync_lock_release( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_w32.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_w32.hpp new file mode 100644 index 0000000000..aa416c34e4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/spinlock_w32.hpp @@ -0,0 +1,113 @@ +#ifndef BOOST_DETAIL_SPINLOCK_W32_HPP_INCLUDED +#define BOOST_DETAIL_SPINLOCK_W32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +// BOOST_COMPILER_FENCE + +#if defined(__INTEL_COMPILER) + +#define BOOST_COMPILER_FENCE __memory_barrier(); + +#elif defined( _MSC_VER ) && _MSC_VER >= 1310 + +extern "C" void _ReadWriteBarrier(); +#pragma intrinsic( _ReadWriteBarrier ) + +#define BOOST_COMPILER_FENCE _ReadWriteBarrier(); + +#elif defined(__GNUC__) + +#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" ); + +#else + +#define BOOST_COMPILER_FENCE + +#endif + +// + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + long v_; + +public: + + bool try_lock() + { + long r = BOOST_INTERLOCKED_EXCHANGE( &v_, 1 ); + + BOOST_COMPILER_FENCE + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + BOOST_COMPILER_FENCE + *const_cast< long volatile* >( &v_ ) = 0; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_DETAIL_SPINLOCK_W32_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/templated_streams.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/templated_streams.hpp new file mode 100644 index 0000000000..1fa6ee3534 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/templated_streams.hpp @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------------- +// boost detail/templated_streams.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2003 +// Eric Friedman +// +// 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_DETAIL_TEMPLATED_STREAMS_HPP +#define BOOST_DETAIL_TEMPLATED_STREAMS_HPP + +#include "boost/config.hpp" + +/////////////////////////////////////////////////////////////////////////////// +// (detail) BOOST_TEMPLATED_STREAM_* macros +// +// Provides workaround platforms without stream class templates. +// + +#if !defined(BOOST_NO_STD_LOCALE) + +#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) \ + template < typename E , typename T > + +#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) \ + template < typename E , typename T , typename A > + +#define BOOST_TEMPLATED_STREAM_ARGS(E,T) \ + typename E , typename T + +#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) \ + typename E , typename T , typename A + +#define BOOST_TEMPLATED_STREAM_COMMA , + +#define BOOST_TEMPLATED_STREAM_ELEM(E) E +#define BOOST_TEMPLATED_STREAM_TRAITS(T) T +#define BOOST_TEMPLATED_STREAM_ALLOC(A) A + +#define BOOST_TEMPLATED_STREAM(X,E,T) \ + BOOST_JOIN(std::basic_,X)< E , T > + +#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \ + BOOST_JOIN(std::basic_,X)< E , T , A > + +#else // defined(BOOST_NO_STD_LOCALE) + +#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) /**/ + +#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) /**/ + +#define BOOST_TEMPLATED_STREAM_ARGS(E,T) /**/ + +#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) /**/ + +#define BOOST_TEMPLATED_STREAM_COMMA /**/ + +#define BOOST_TEMPLATED_STREAM_ELEM(E) char +#define BOOST_TEMPLATED_STREAM_TRAITS(T) std::char_traits +#define BOOST_TEMPLATED_STREAM_ALLOC(A) std::allocator + +#define BOOST_TEMPLATED_STREAM(X,E,T) \ + std::X + +#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \ + std::X + +#endif // BOOST_NO_STD_LOCALE + +#endif // BOOST_DETAIL_TEMPLATED_STREAMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/utf8_codecvt_facet.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/utf8_codecvt_facet.hpp new file mode 100644 index 0000000000..ac7e7bfded --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/utf8_codecvt_facet.hpp @@ -0,0 +1,197 @@ +// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) +// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_UTF8_CODECVT_FACET_HPP +#define BOOST_UTF8_CODECVT_FACET_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// utf8_codecvt_facet.hpp + +// This header defines class utf8_codecvt_facet, derived fro +// std::codecvt, which can be used to convert utf8 data in +// files into wchar_t strings in the application. +// +// The header is NOT STANDALONE, and is not to be included by the USER. +// There are at least two libraries which want to use this functionality, and +// we want to avoid code duplication. It would be possible to create utf8 +// library, but: +// - this requires review process first +// - in the case, when linking the a library which uses utf8 +// (say 'program_options'), user should also link to the utf8 library. +// This seems inconvenient, and asking a user to link to an unrevieved +// library is strange. +// Until the above points are fixed, a library which wants to use utf8 must: +// - include this header from one of it's headers or sources +// - include the corresponding .cpp file from one of the sources +// - before including either file, the library must define +// - BOOST_UTF8_BEGIN_NAMESPACE to the namespace declaration that must be used +// - BOOST_UTF8_END_NAMESPACE to the code to close the previous namespace +// - declaration. +// - BOOST_UTF8_DECL -- to the code which must be used for all 'exportable' +// symbols. +// +// For example, program_options library might contain: +// #define BOOST_UTF8_BEGIN_NAMESPACE +// namespace boost { namespace program_options { +// #define BOOST_UTF8_END_NAMESPACE }} +// #define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL +// #include "../../detail/utf8/utf8_codecvt.cpp" +// +// Essentially, each library will have its own copy of utf8 code, in +// different namespaces. + +// Note:(Robert Ramey). I have made the following alterations in the original +// code. +// a) Rendered utf8_codecvt with using templates +// b) Move longer functions outside class definition to prevent inlining +// and make code smaller +// c) added on a derived class to permit translation to/from current +// locale to utf8 + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as text - note these ar templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// note the fact that on libraries without wide characters, ostream is +// is not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream but rather +// use two template parameters +// +// utf8_codecvt_facet +// This is an implementation of a std::codecvt facet for translating +// from UTF-8 externally to UCS-4. Note that this is not tied to +// any specific types in order to allow customization on platforms +// where wchar_t is not big enough. +// +// NOTES: The current implementation jumps through some unpleasant hoops in +// order to deal with signed character types. As a std::codecvt_base::result, +// it is necessary for the ExternType to be convertible to unsigned char. +// I chose not to tie the extern_type explicitly to char. But if any combination +// of types other than is used, then std::codecvt must be +// specialized on those types for this to work. + +#include +// for mbstate_t +#include +// for std::size_t +#include + +#include +#include + +namespace std { + #if defined(__LIBCOMO__) + using ::mbstate_t; + #elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__) + using ::mbstate_t; + #elif defined(__SGI_STL_PORT) + #elif defined(BOOST_NO_STDC_NAMESPACE) + using ::mbstate_t; + using ::codecvt; + #endif +} // namespace std + +#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) + #define BOOST_CODECVT_DO_LENGTH_CONST const +#else + #define BOOST_CODECVT_DO_LENGTH_CONST +#endif + +// maximum lenght of a multibyte string +#define MB_LENGTH_MAX 8 + +BOOST_UTF8_BEGIN_NAMESPACE + +struct BOOST_UTF8_DECL utf8_codecvt_facet : + public std::codecvt +{ +public: + explicit utf8_codecvt_facet(std::size_t no_locale_manage=0) + : std::codecvt(no_locale_manage) + {} +protected: + virtual std::codecvt_base::result do_in( + std::mbstate_t& state, + const char * from, + const char * from_end, + const char * & from_next, + wchar_t * to, + wchar_t * to_end, + wchar_t*& to_next + ) const; + + virtual std::codecvt_base::result do_out( + std::mbstate_t & state, const wchar_t * from, + const wchar_t * from_end, const wchar_t* & from_next, + char * to, char * to_end, char * & to_next + ) const; + + bool invalid_continuing_octet(unsigned char octet_1) const { + return (octet_1 < 0x80|| 0xbf< octet_1); + } + + bool invalid_leading_octet(unsigned char octet_1) const { + return (0x7f < octet_1 && octet_1 < 0xc0) || + (octet_1 > 0xfd); + } + + // continuing octets = octets except for the leading octet + static unsigned int get_cont_octet_count(unsigned char lead_octet) { + return get_octet_count(lead_octet) - 1; + } + + static unsigned int get_octet_count(unsigned char lead_octet); + + // How many "continuing octets" will be needed for this word + // == total octets - 1. + int get_cont_octet_out_count(wchar_t word) const ; + + virtual bool do_always_noconv() const throw() { return false; } + + // UTF-8 isn't really stateful since we rewind on partial conversions + virtual std::codecvt_base::result do_unshift( + std::mbstate_t&, + char * from, + char * /*to*/, + char * & next + ) const + { + next = from; + return ok; + } + + virtual int do_encoding() const throw() { + const int variable_byte_external_encoding=0; + return variable_byte_external_encoding; + } + + // How many char objects can I process to get <= max_limit + // wchar_t objects? + virtual int do_length( + BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &, + const char * from, + const char * from_end, + std::size_t max_limit +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) + ) const throw(); +#else + ) const; +#endif + + // Largest possible value do_length(state,from,from_end,1) could return. + virtual int do_max_length() const throw () { + return 6; // largest UTF-8 encoding of a UCS-4 character + } +}; + +BOOST_UTF8_END_NAMESPACE + +#endif // BOOST_UTF8_CODECVT_FACET_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/workaround.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/workaround.hpp new file mode 100644 index 0000000000..4933a531f9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/workaround.hpp @@ -0,0 +1,202 @@ +// Copyright David Abrahams 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef WORKAROUND_DWA2002126_HPP +# define WORKAROUND_DWA2002126_HPP + +// Compiler/library version workaround macro +// +// Usage: +// +// #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// // workaround for eVC4 and VC6 +// ... // workaround code here +// #endif +// +// When BOOST_STRICT_CONFIG is defined, expands to 0. Otherwise, the +// first argument must be undefined or expand to a numeric +// value. The above expands to: +// +// (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300 +// +// When used for workarounds that apply to the latest known version +// and all earlier versions of a compiler, the following convention +// should be observed: +// +// #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301)) +// +// The version number in this case corresponds to the last version in +// which the workaround was known to have been required. When +// BOOST_DETECT_OUTDATED_WORKAROUNDS is not the defined, the macro +// BOOST_TESTED_AT(x) expands to "!= 0", which effectively activates +// the workaround for any version of the compiler. When +// BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, a compiler warning or +// error will be issued if the compiler version exceeds the argument +// to BOOST_TESTED_AT(). This can be used to locate workarounds which +// may be obsoleted by newer versions. + +# ifndef BOOST_STRICT_CONFIG + +#include + +#ifndef __BORLANDC__ +#define __BORLANDC___WORKAROUND_GUARD 1 +#else +#define __BORLANDC___WORKAROUND_GUARD 0 +#endif +#ifndef __MSC_VER +#define __MSC_VER_WORKAROUND_GUARD 1 +#else +#define __MSC_VER_WORKAROUND_GUARD 0 +#endif +#ifndef _MSC_FULL_VER +#define _MSC_FULL_VER_WORKAROUND_GUARD 1 +#else +#define _MSC_FULL_VER_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_MSVC +#define BOOST_MSVC_WORKAROUND_GUARD 1 +#else +#define BOOST_MSVC_WORKAROUND_GUARD 0 +#endif +#ifndef __GNUC__ +#define __GNUC___WORKAROUND_GUARD 1 +#else +#define __GNUC___WORKAROUND_GUARD 0 +#endif +#ifndef __GNUC_MINOR__ +#define __GNUC_MINOR___WORKAROUND_GUARD 1 +#else +#define __GNUC_MINOR___WORKAROUND_GUARD 0 +#endif +#ifndef __GNUC_PATCHLEVEL__ +#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1 +#else +#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0 +#endif +#ifndef __IBMCPP__ +#define __IBMCPP___WORKAROUND_GUARD 1 +#else +#define __IBMCPP___WORKAROUND_GUARD 0 +#endif +#ifndef __SUNPRO_CC +#define __SUNPRO_CC_WORKAROUND_GUARD 1 +#else +#define __SUNPRO_CC_WORKAROUND_GUARD 0 +#endif +#ifndef __DECCXX_VER +#define __DECCXX_VER_WORKAROUND_GUARD 1 +#else +#define __DECCXX_VER_WORKAROUND_GUARD 0 +#endif +#ifndef __MWERKS__ +#define __MWERKS___WORKAROUND_GUARD 1 +#else +#define __MWERKS___WORKAROUND_GUARD 0 +#endif +#ifndef __EDG_VERSION__ +#define __EDG_VERSION___WORKAROUND_GUARD 1 +#else +#define __EDG_VERSION___WORKAROUND_GUARD 0 +#endif +#ifndef __HP_aCC +#define __HP_aCC_WORKAROUND_GUARD 1 +#else +#define __HP_aCC_WORKAROUND_GUARD 0 +#endif +#ifndef _CRAYC +#define _CRAYC_WORKAROUND_GUARD 1 +#else +#define _CRAYC_WORKAROUND_GUARD 0 +#endif +#ifndef __DMC__ +#define __DMC___WORKAROUND_GUARD 1 +#else +#define __DMC___WORKAROUND_GUARD 0 +#endif +#ifndef MPW_CPLUS +#define MPW_CPLUS_WORKAROUND_GUARD 1 +#else +#define MPW_CPLUS_WORKAROUND_GUARD 0 +#endif + +#ifndef _RWSTD_VER +#define _RWSTD_VER_WORKAROUND_GUARD 1 +#else +#define _RWSTD_VER_WORKAROUND_GUARD 0 +#endif +#ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC +#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1 +#else +#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0 +#endif +#ifndef __SGI_STL_PORT +#define __SGI_STL_PORT_WORKAROUND_GUARD 1 +#else +#define __SGI_STL_PORT_WORKAROUND_GUARD 0 +#endif +#ifndef _STLPORT_VERSION +#define _STLPORT_VERSION_WORKAROUND_GUARD 1 +#else +#define _STLPORT_VERSION_WORKAROUND_GUARD 0 +#endif + +#ifndef BOOST_INTEL_CXX_VERSION +#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1 +#else +#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_INTEL_WIN +#define BOOST_INTEL_WIN_WORKAROUND_GUARD 1 +#else +#define BOOST_INTEL_WIN_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_DINKUMWARE_STDLIB +#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1 +#else +#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_INTEL +#define BOOST_INTEL_WORKAROUND_GUARD 1 +#else +#define BOOST_INTEL_WORKAROUND_GUARD 0 +#endif +// Always define to zero, if it's used it'll be defined my MPL: +#define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0 + +# define BOOST_WORKAROUND(symbol, test) \ + ((symbol ## _WORKAROUND_GUARD + 0 == 0) && \ + (symbol != 0) && (1 % (( (symbol test) ) + 1))) +// ^ ^ ^ ^ +// The extra level of parenthesis nesting above, along with the +// BOOST_OPEN_PAREN indirection below, is required to satisfy the +// broken preprocessor in MWCW 8.3 and earlier. +// +// The basic mechanism works as follows: +// (symbol test) + 1 => if (symbol test) then 2 else 1 +// 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0 +// +// The complication with % is for cooperation with BOOST_TESTED_AT(). +// When "test" is BOOST_TESTED_AT(x) and +// BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined, +// +// symbol test => if (symbol <= x) then 1 else -1 +// (symbol test) + 1 => if (symbol <= x) then 2 else 0 +// 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero +// + +# ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS +# define BOOST_OPEN_PAREN ( +# define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1 +# else +# define BOOST_TESTED_AT(value) != ((value)-(value)) +# endif + +# else + +# define BOOST_WORKAROUND(symbol, test) 0 + +# endif + +#endif // WORKAROUND_DWA2002126_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/detail/yield_k.hpp b/deal.II/contrib/boost/include/boost-1.37.0/detail/yield_k.hpp new file mode 100644 index 0000000000..d97542d02e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/detail/yield_k.hpp @@ -0,0 +1,149 @@ +#ifndef BOOST_DETAIL_YIELD_K_HPP_INCLUDED +#define BOOST_DETAIL_YIELD_K_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/yield_k.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// void yield( unsigned k ); +// +// Typical use: +// +// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); +// +// 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_SMT_PAUSE + +#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) + +extern "C" void _mm_pause(); +#pragma intrinsic( _mm_pause ) + +#define BOOST_SMT_PAUSE _mm_pause(); + +#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) + +#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); + +#endif + +// + +#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +#if defined( BOOST_USE_WINDOWS_H ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_USE_WINDOWS_H ) + extern "C" void __stdcall Sleep( unsigned ms ); +#endif + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif + else if( k < 32 ) + { + Sleep( 0 ); + } + else + { + Sleep( 1 ); + } +} + +} // namespace detail + +} // namespace boost + +#elif defined( BOOST_HAS_PTHREADS ) + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif + else if( k < 32 || k & 1 ) + { + sched_yield(); + } + else + { + // g++ -Wextra warns on {} or {0} + struct timespec rqtp = { 0, 0 }; + + // POSIX says that timespec has tv_sec and tv_nsec + // But it doesn't guarantee order or placement + + rqtp.tv_sec = 0; + rqtp.tv_nsec = 1000; + + nanosleep( &rqtp, 0 ); + } +} + +} // namespace detail + +} // namespace boost + +#else + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned ) +{ +} + +} // namespace detail + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/dynamic_bitset.hpp b/deal.II/contrib/boost/include/boost-1.37.0/dynamic_bitset.hpp new file mode 100644 index 0000000000..29e103862e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/dynamic_bitset.hpp @@ -0,0 +1,17 @@ +// ----------------------------------------------------------- +// +// Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek +// Copyright (c) 2003-2004, 2008 Gennaro Prota +// +// 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_DYNAMIC_BITSET_HPP +#define BOOST_DYNAMIC_BITSET_HPP + +#include "boost/dynamic_bitset/dynamic_bitset.hpp" + +#endif // include guard diff --git a/deal.II/contrib/boost/include/boost-1.37.0/dynamic_bitset_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/dynamic_bitset_fwd.hpp new file mode 100644 index 0000000000..7bb6e89743 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/dynamic_bitset_fwd.hpp @@ -0,0 +1,25 @@ +// ----------------------------------------------------------- +// +// Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek +// Copyright (c) 2003-2004 Gennaro Prota +// +// 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_DYNAMIC_BITSET_FWD_HPP +#define BOOST_DYNAMIC_BITSET_FWD_HPP + +#include + +namespace boost { + +template > +class dynamic_bitset; + +} + +#endif // include guard diff --git a/deal.II/contrib/boost/include/boost-1.37.0/dynamic_property_map.hpp b/deal.II/contrib/boost/include/boost-1.37.0/dynamic_property_map.hpp new file mode 100644 index 0000000000..4fc269b2cb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/dynamic_property_map.hpp @@ -0,0 +1,370 @@ +#ifndef DYNAMIC_PROPERTY_MAP_RG09302004_HPP +#define DYNAMIC_PROPERTY_MAP_RG09302004_HPP + +// Copyright 2004-5 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) + +// dynamic_property_map.hpp - +// Support for runtime-polymorphic property maps. This header is factored +// out of Doug Gregor's routines for reading GraphML files for use in reading +// GraphViz graph files. + +// Authors: Doug Gregor +// Ronald Garcia +// + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +namespace detail { + + // read_value - + // A wrapper around lexical_cast, which does not behave as + // desired for std::string types. + template + inline Value read_value(const std::string& value) + { return boost::lexical_cast(value); } + + template<> + inline std::string read_value(const std::string& value) + { return value; } + +} + + +// dynamic_property_map - +// This interface supports polymorphic manipulation of property maps. +class dynamic_property_map +{ +public: + virtual ~dynamic_property_map() { } + + virtual boost::any get(const any& key) = 0; + virtual std::string get_string(const any& key) = 0; + virtual void put(const any& key, const any& value) = 0; + virtual const std::type_info& key() const = 0; + virtual const std::type_info& value() const = 0; +}; + + +////////////////////////////////////////////////////////////////////// +// Property map exceptions +////////////////////////////////////////////////////////////////////// + +struct dynamic_property_exception : public std::exception { + virtual ~dynamic_property_exception() throw() {} + virtual const char* what() const throw() = 0; +}; + +struct property_not_found : public dynamic_property_exception { + std::string property; + mutable std::string statement; + property_not_found(const std::string& property) : property(property) {} + virtual ~property_not_found() throw() {} + + const char* what() const throw() { + if(statement.empty()) + statement = + std::string("Property not found: ") + property + "."; + + return statement.c_str(); + } +}; + +struct dynamic_get_failure : public dynamic_property_exception { + std::string property; + mutable std::string statement; + dynamic_get_failure(const std::string& property) : property(property) {} + virtual ~dynamic_get_failure() throw() {} + + const char* what() const throw() { + if(statement.empty()) + statement = + std::string( + "dynamic property get cannot retrieve value for property: ") + + property + "."; + + return statement.c_str(); + } +}; + +struct dynamic_const_put_error : public dynamic_property_exception { + virtual ~dynamic_const_put_error() throw() {} + + const char* what() const throw() { + return "Attempt to put a value into a const property map: "; + } +}; + + +namespace detail { + +// +// dynamic_property_map_adaptor - +// property-map adaptor to support runtime polymorphism. +template +class dynamic_property_map_adaptor : public dynamic_property_map +{ + typedef typename property_traits::key_type key_type; + typedef typename property_traits::value_type value_type; + typedef typename property_traits::category category; + + // do_put - overloaded dispatches from the put() member function. + // Attempts to "put" to a property map that does not model + // WritablePropertyMap result in a runtime exception. + + // in_value must either hold an object of value_type or a string that + // can be converted to value_type via iostreams. + void do_put(const any& in_key, const any& in_value, mpl::bool_) + { +#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)) + using boost::put; +#endif + + key_type key = any_cast(in_key); + if (in_value.type() == typeid(value_type)) { +#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) + boost::put(property_map, key, any_cast(in_value)); +#else + put(property_map, key, any_cast(in_value)); +#endif + } else { + // if in_value is an empty string, put a default constructed value_type. + std::string v = any_cast(in_value); + if (v.empty()) { +#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) + boost::put(property_map, key, value_type()); +#else + put(property_map, key, value_type()); +#endif + } else { +#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) + boost::put(property_map, key, detail::read_value(v)); +#else + put(property_map, key, detail::read_value(v)); +#endif + } + } + } + + void do_put(const any&, const any&, mpl::bool_) + { + throw dynamic_const_put_error(); + } + +public: + explicit dynamic_property_map_adaptor(const PropertyMap& property_map) + : property_map(property_map) { } + + virtual boost::any get(const any& key) + { +#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) + return boost::get(property_map, any_cast(key)); +#else + using boost::get; + + return get(property_map, any_cast(key)); +#endif + } + + virtual std::string get_string(const any& key) + { +#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) + std::ostringstream out; + out << boost::get(property_map, any_cast(key)); + return out.str(); +#else + using boost::get; + + std::ostringstream out; + out << get(property_map, any_cast(key)); + return out.str(); +#endif + } + + virtual void put(const any& in_key, const any& in_value) + { + do_put(in_key, in_value, + mpl::bool_<(is_convertible::value)>()); + } + + virtual const std::type_info& key() const { return typeid(key_type); } + virtual const std::type_info& value() const { return typeid(value_type); } + + PropertyMap& base() { return property_map; } + const PropertyMap& base() const { return property_map; } + +private: + PropertyMap property_map; +}; + +} // namespace detail + +// +// dynamic_properties - +// container for dynamic property maps +// +struct dynamic_properties +{ + typedef std::multimap + property_maps_type; + typedef boost::function3, + const std::string&, + const boost::any&, + const boost::any&> generate_fn_type; +public: + + typedef property_maps_type::iterator iterator; + typedef property_maps_type::const_iterator const_iterator; + + dynamic_properties() : generate_fn() { } + dynamic_properties(const generate_fn_type& g) : generate_fn(g) {} + + ~dynamic_properties() + { + for (property_maps_type::iterator i = property_maps.begin(); + i != property_maps.end(); ++i) { + delete i->second; + } + } + + template + dynamic_properties& + property(const std::string& name, PropertyMap property_map) + { + // Tbd: exception safety + std::auto_ptr pm( + new detail::dynamic_property_map_adaptor(property_map)); + property_maps_type::iterator i = + property_maps.insert(property_maps_type::value_type(name, 0)); + i->second = pm.release(); + + return *this; + } + + iterator begin() { return property_maps.begin(); } + const_iterator begin() const { return property_maps.begin(); } + iterator end() { return property_maps.end(); } + const_iterator end() const { return property_maps.end(); } + + iterator lower_bound(const std::string& name) + { return property_maps.lower_bound(name); } + + const_iterator lower_bound(const std::string& name) const + { return property_maps.lower_bound(name); } + + void + insert(const std::string& name, std::auto_ptr pm) + { + property_maps.insert(property_maps_type::value_type(name, pm.release())); + } + + template + std::auto_ptr + generate(const std::string& name, const Key& key, const Value& value) + { + if(!generate_fn) { + throw property_not_found(name); + } else { + return generate_fn(name,key,value); + } + } + +private: + property_maps_type property_maps; + generate_fn_type generate_fn; +}; + +template +bool +put(const std::string& name, dynamic_properties& dp, const Key& key, + const Value& value) +{ + for (dynamic_properties::iterator i = dp.lower_bound(name); + i != dp.end() && i->first == name; ++i) { + if (i->second->key() == typeid(key)) { + i->second->put(key, value); + return true; + } + } + + std::auto_ptr new_map = dp.generate(name, key, value); + if (new_map.get()) { + new_map->put(key, value); + dp.insert(name, new_map); + return true; + } else { + return false; + } +} + +#ifndef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +template +Value +get(const std::string& name, const dynamic_properties& dp, const Key& key) +{ + for (dynamic_properties::const_iterator i = dp.lower_bound(name); + i != dp.end() && i->first == name; ++i) { + if (i->second->key() == typeid(key)) + return any_cast(i->second->get(key)); + } + + throw dynamic_get_failure(name); +} +#endif + +template +Value +get(const std::string& name, const dynamic_properties& dp, const Key& key, type) +{ + for (dynamic_properties::const_iterator i = dp.lower_bound(name); + i != dp.end() && i->first == name; ++i) { + if (i->second->key() == typeid(key)) + return any_cast(i->second->get(key)); + } + + throw dynamic_get_failure(name); +} + +template +std::string +get(const std::string& name, const dynamic_properties& dp, const Key& key) +{ + for (dynamic_properties::const_iterator i = dp.lower_bound(name); + i != dp.end() && i->first == name; ++i) { + if (i->second->key() == typeid(key)) + return i->second->get_string(key); + } + + throw dynamic_get_failure(name); +} + +// The easy way to ignore properties. +inline +std::auto_ptr +ignore_other_properties(const std::string&, + const boost::any&, + const boost::any&) { + return std::auto_ptr(0); +} + +} // namespace boost + +#endif // DYNAMIC_PROPERTY_MAP_RG09302004_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/enable_shared_from_this.hpp b/deal.II/contrib/boost/include/boost-1.37.0/enable_shared_from_this.hpp new file mode 100644 index 0000000000..4e49f1f73b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/enable_shared_from_this.hpp @@ -0,0 +1,73 @@ +#ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED +#define BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED + +// +// enable_shared_from_this.hpp +// +// Copyright (c) 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html +// + +#include +#include +#include +#include + +namespace boost +{ + +template class enable_shared_from_this +{ +protected: + + enable_shared_from_this() + { + } + + enable_shared_from_this(enable_shared_from_this const &) + { + } + + enable_shared_from_this & operator=(enable_shared_from_this const &) + { + return *this; + } + + ~enable_shared_from_this() + { + } + +public: + + shared_ptr shared_from_this() + { + shared_ptr p(_internal_weak_this); + BOOST_ASSERT(p.get() == this); + return p; + } + + shared_ptr shared_from_this() const + { + shared_ptr p(_internal_weak_this); + BOOST_ASSERT(p.get() == this); + return p; + } + +// Note: No, you don't need to initialize _internal_weak_this +// +// Please read the documentation, not the code +// +// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html + + typedef T _internal_element_type; // for bcc 5.5.1 + mutable weak_ptr<_internal_element_type> _internal_weak_this; +}; + +} // namespace boost + +#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception.hpp new file mode 100644 index 0000000000..c77f215b8f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception.hpp @@ -0,0 +1,17 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_1D94A7C6054E11DB9804B622A1EF5492 +#define UUID_1D94A7C6054E11DB9804B622A1EF5492 + +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/error_info_impl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/error_info_impl.hpp new file mode 100644 index 0000000000..7a57b8bd6d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/error_info_impl.hpp @@ -0,0 +1,61 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_CE6983AC753411DDA764247956D89593 +#define UUID_CE6983AC753411DDA764247956D89593 + +#include + +namespace +boost + { + namespace + exception_detail + { + class + error_info_base + { + public: + + virtual char const * tag_typeid_name() const = 0; + virtual std::string value_as_string() const = 0; + + protected: + + virtual + ~error_info_base() throw() + { + } + }; + } + + template + class + error_info: + public exception_detail::error_info_base + { + public: + + typedef T value_type; + + error_info( value_type const & value ); + ~error_info() throw(); + + value_type const & + value() const + { + return value_; + } + + private: + + char const * tag_typeid_name() const; + std::string value_as_string() const; + + value_type const value_; + }; + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/is_output_streamable.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/is_output_streamable.hpp new file mode 100644 index 0000000000..57376bf3da --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/is_output_streamable.hpp @@ -0,0 +1,38 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_898984B4076411DD973EDFA055D89593 +#define UUID_898984B4076411DD973EDFA055D89593 + +#include + +namespace +boost + { + namespace + to_string_detail + { + template + char operator<<( std::basic_ostream &, T const & ); + + template + struct + is_output_streamable_impl + { + static std::basic_ostream & f(); + static T const & g(); + enum e { value=1!=(sizeof(f()< > + struct + is_output_streamable + { + enum e { value=to_string_detail::is_output_streamable_impl::value }; + }; + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/object_hex_dump.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/object_hex_dump.hpp new file mode 100644 index 0000000000..a6221b6db5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/object_hex_dump.hpp @@ -0,0 +1,40 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_6F463AC838DF11DDA3E6909F56D89593 +#define UUID_6F463AC838DF11DDA3E6909F56D89593 + +#include +#include +#include +#include +#include + +namespace +boost + { + namespace + exception_detail + { + template + inline + std::string + object_hex_dump( T const & x, size_t max_size=16 ) + { + std::ostringstream s; + s << "type: " << type_name() << ", size: " << sizeof(T) << ", dump: "; + size_t n=sizeof(T)>max_size?max_size:sizeof(T); + s.fill('0'); + s.width(2); + unsigned char const * b=reinterpret_cast(&x); + s << std::setw(2) << std::hex << (unsigned int)*b; + for( unsigned char const * e=b+n; ++b!=e; ) + s << " " << std::setw(2) << std::hex << (unsigned int)*b; + return s.str(); + } + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/type_info.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/type_info.hpp new file mode 100644 index 0000000000..97bf72615c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/detail/type_info.hpp @@ -0,0 +1,130 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_C3E1741C754311DDB2834CCA55D89593 +#define UUID_C3E1741C754311DDB2834CCA55D89593 + +#include +#include + +namespace +boost + { + template + inline + char const * + tag_type_name() + { +#ifdef BOOST_NO_TYPEID + return BOOST_CURRENT_FUNCTION; +#else + return typeid(T*).name(); +#endif + } + + template + inline + char const * + type_name() + { +#ifdef BOOST_NO_TYPEID + return BOOST_CURRENT_FUNCTION; +#else + return typeid(T).name(); +#endif + } + + namespace + exception_detail + { +#ifdef BOOST_NO_TYPEID + struct + type_info_ + { + detail::sp_typeinfo type_; + char const * name_; + + explicit + type_info_( detail::sp_typeinfo type, char const * name ): + type_(type), + name_(name) + { + } + + friend + bool + operator==( type_info_ const & a, type_info_ const & b ) + { + return a.type_==b.type_; + } + + friend + bool + operator<( type_info_ const & a, type_info_ const & b ) + { + return a.type_before(*b.type_)); + } + + char const * + name() const + { + return type_->name(); + } + }; +#endif + + inline + bool + operator!=( type_info_ const & a, type_info_ const & b ) + { + return !(a==b); + } + } + } + +#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T),::boost::tag_type_name()) + +#ifndef BOOST_NO_RTTI +#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x)) +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/diagnostic_information.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/diagnostic_information.hpp new file mode 100644 index 0000000000..99273bcff6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/diagnostic_information.hpp @@ -0,0 +1,64 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_0552D49838DD11DD90146B8956D89593 +#define UUID_0552D49838DD11DD90146B8956D89593 + +#include +#include +#include +#include + +namespace +boost + { + namespace + exception_detail + { + inline + char const * + get_diagnostic_information( exception const & x ) + { + if( error_info_container * c=x.data_.get() ) + try + { + return c->diagnostic_information(); + } + catch(...) + { + } + return 0; + } + } + + inline + std::string + diagnostic_information( exception const & x ) + { + std::ostringstream tmp; + if( boost::shared_ptr f=get_error_info(x) ) + { + tmp << *f; + if( boost::shared_ptr l=get_error_info(x) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( boost::shared_ptr fn=get_error_info(x) ) + tmp << *fn; + else + tmp << "(unknown)"; +#ifndef BOOST_NO_RTTI + tmp << "\nDynamic exception type: " << BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name(); + if( std::exception const * e=dynamic_cast(&x) ) + tmp << "\nstd::exception::what: " << e->what(); +#endif + if( char const * s=exception_detail::get_diagnostic_information(x) ) + if( *s ) + tmp << '\n' << s; + return tmp.str(); + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/enable_current_exception.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/enable_current_exception.hpp new file mode 100644 index 0000000000..7e6403b83e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/enable_current_exception.hpp @@ -0,0 +1,6 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/enable_error_info.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/enable_error_info.hpp new file mode 100644 index 0000000000..7e6403b83e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/enable_error_info.hpp @@ -0,0 +1,6 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/error_info.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/error_info.hpp new file mode 100644 index 0000000000..d80bf399d8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/error_info.hpp @@ -0,0 +1,6 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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) + +namespace boost { template class error_info; } diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/exception.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/exception.hpp new file mode 100644 index 0000000000..53e6ed0c87 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/exception.hpp @@ -0,0 +1,396 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_274DA366004E11DCB1DDFE2E56D89593 +#define UUID_274DA366004E11DCB1DDFE2E56D89593 + +namespace +boost + { + namespace + exception_detail + { + template + class + refcount_ptr + { + public: + + refcount_ptr(): + px_(0) + { + } + + ~refcount_ptr() + { + release(); + } + + refcount_ptr( refcount_ptr const & x ): + px_(x.px_) + { + add_ref(); + } + + refcount_ptr & + operator=( refcount_ptr const & x ) + { + adopt(x.px_); + return *this; + } + + void + adopt( T * px ) + { + release(); + px_=px; + add_ref(); + } + + T * + get() const + { + return px_; + } + + private: + + T * px_; + + void + add_ref() + { + if( px_ ) + px_->add_ref(); + } + + void + release() + { + if( px_ ) + px_->release(); + } + }; + } + + //////////////////////////////////////////////////////////////////////// + + template + class error_info; + + typedef error_info throw_function; + typedef error_info throw_file; + typedef error_info throw_line; + + template <> + class + error_info + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info + { + public: + typedef int value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template + E const & operator<<( E const &, error_info const & ); + + class exception; + + template + class shared_ptr; + + namespace + exception_detail + { + class error_info_base; + struct type_info_; + + struct + error_info_container + { + virtual char const * diagnostic_information() const = 0; + virtual shared_ptr get( type_info_ const & ) const = 0; + virtual void set( shared_ptr const &, type_info_ const & ) = 0; + virtual void add_ref() const = 0; + virtual void release() const = 0; + + protected: + + virtual + ~error_info_container() throw() + { + } + }; + + template + struct get_info; + + template <> + struct get_info; + + template <> + struct get_info; + + template <> + struct get_info; + + char const * get_diagnostic_information( exception const & ); + } + + class + exception + { + protected: + + exception(): + throw_function_(0), + throw_file_(0), + throw_line_(-1) + { + } + +#ifdef __HP_aCC + //On HP aCC, this protected copy constructor prevents throwing boost::exception. + //On all other platforms, the same effect is achieved by the pure virtual destructor. + exception( exception const & x ) throw(): + data_(x.data_), + throw_function_(x.throw_function_), + throw_file_(x.throw_file_), + throw_line_(x.throw_line_) + { + } +#endif + + virtual ~exception() throw() +#ifndef __HP_aCC + = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors. +#endif + ; + + private: + + template + friend + E const & + operator<<( E const & x, throw_function const & y ) + { + x.throw_function_=y.v_; + return x; + } + + template + friend + E const & + operator<<( E const & x, throw_file const & y ) + { + x.throw_file_=y.v_; + return x; + } + + template + friend + E const & + operator<<( E const & x, throw_line const & y ) + { + x.throw_line_=y.v_; + return x; + } + + friend char const * exception_detail::get_diagnostic_information( exception const & ); + + template + friend E const & operator<<( E const &, error_info const & ); + + template + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + + mutable exception_detail::refcount_ptr data_; + mutable char const * throw_function_; + mutable char const * throw_file_; + mutable int throw_line_; + }; + + inline + exception:: + ~exception() throw() + { + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { + template + struct + error_info_injector: + public T, + public exception + { + explicit + error_info_injector( T const & x ): + T(x) + { + } + + ~error_info_injector() throw() + { + } + }; + + struct large_size { char c[256]; }; + large_size dispatch( exception * ); + + struct small_size { }; + small_size dispatch( void * ); + + template + struct enable_error_info_helper; + + template + struct + enable_error_info_helper + { + typedef T type; + }; + + template + struct + enable_error_info_helper + { + typedef error_info_injector type; + }; + + template + struct + enable_error_info_return_type + { + typedef typename enable_error_info_helper::type type; + }; + } + + template + inline + typename + exception_detail::enable_error_info_return_type::type + enable_error_info( T const & x ) + { + typedef typename exception_detail::enable_error_info_return_type::type rt; + return rt(x); + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { + class + clone_base + { + public: + + virtual clone_base const * clone() const = 0; + virtual void rethrow() const = 0; + + virtual + ~clone_base() throw() + { + } + }; + + inline + void + copy_boost_exception( exception * a, exception const * b ) + { + *a = *b; + } + + inline + void + copy_boost_exception( void *, void const * ) + { + } + + template + class + clone_impl: + public T, + public clone_base + { + public: + + explicit + clone_impl( T const & x ): + T(x) + { + copy_boost_exception(this,&x); + } + + ~clone_impl() throw() + { + } + + private: + + clone_base const * + clone() const + { + return new clone_impl(*this); + } + + void + rethrow() const + { + throw*this; + } + }; + } + + template + inline + exception_detail::clone_impl + enable_current_exception( T const & x ) + { + return exception_detail::clone_impl(x); + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/get_error_info.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/get_error_info.hpp new file mode 100644 index 0000000000..e45d3d6eb0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/get_error_info.hpp @@ -0,0 +1,134 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_1A590226753311DD9E4CCF6156D89593 +#define UUID_1A590226753311DD9E4CCF6156D89593 + +#include +#include +#include +#include + +namespace +boost + { + namespace + exception_detail + { + struct + strwrap + { + std::string str; + char const * ptr; + + explicit + strwrap( char const * s ): + str(s), + ptr(&str[0]) + { + } + + private: + + strwrap( strwrap const & ); + strwrap & operator=( strwrap const & ); + }; + + template <> + struct + get_info + { + static + shared_ptr + get( exception const & x ) + { + if( x.throw_function_ && *x.throw_function_ ) + { + shared_ptr s(new strwrap(x.throw_function_)); + return shared_ptr(s,&s->ptr); + } + else + return shared_ptr(); + } + }; + + template <> + struct + get_info + { + static + shared_ptr + get( exception const & x ) + { + if( x.throw_file_ && *x.throw_file_ ) + { + shared_ptr s(new strwrap(x.throw_file_)); + return shared_ptr(s,&s->ptr); + } + else + return shared_ptr(); + } + }; + + template <> + struct + get_info + { + static + shared_ptr + get( exception const & x ) + { + if( x.throw_line_!=-1 ) + return boost::shared_ptr(new int(x.throw_line_)); + else + return shared_ptr(); + } + }; + + template + struct + get_info + { + static + shared_ptr + get( exception const & x ) + { + if( exception_detail::error_info_container * c=x.data_.get() ) + if( shared_ptr eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) ) + { +#ifndef BOOST_NO_RTTI + BOOST_ASSERT( 0!=dynamic_cast(eib.get()) ); +#endif + ErrorInfo const * w = static_cast(eib.get()); + return shared_ptr(eib,&w->value()); + } + return shared_ptr(); + } + }; + } + +#ifdef BOOST_NO_RTTI + template + inline + shared_ptr + get_error_info( boost::exception const & x ) + { + return exception_detail::get_info::get(x); + } +#else + template + inline + shared_ptr + get_error_info( E const & some_exception ) + { + if( exception const * x = dynamic_cast(&some_exception) ) + return exception_detail::get_info::get(*x); + else + return shared_ptr(); + } +#endif + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/info.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/info.hpp new file mode 100644 index 0000000000..a0892c9c84 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/info.hpp @@ -0,0 +1,151 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_8D22C4CA9CC811DCAA9133D256D89593 +#define UUID_8D22C4CA9CC811DCAA9133D256D89593 + +#include +#include +#include +#include +#include + +namespace +boost + { + template + inline + error_info:: + error_info( value_type const & value ): + value_(value) + { + } + + template + inline + error_info:: + ~error_info() throw() + { + } + + template + inline + char const * + error_info:: + tag_typeid_name() const + { + return tag_type_name(); + } + + template + inline + std::string + error_info:: + value_as_string() const + { + return to_string_stub(value_); + } + + namespace + exception_detail + { + class + error_info_container_impl: + public error_info_container + { + public: + + error_info_container_impl(): + count_(0) + { + } + + ~error_info_container_impl() throw() + { + } + + void + set( shared_ptr const & x, type_info_ const & typeid_ ) + { + BOOST_ASSERT(x); + info_[typeid_] = x; + diagnostic_info_str_.clear(); + } + + shared_ptr + get( type_info_ const & ti ) const + { + error_info_map::const_iterator i=info_.find(ti); + if( info_.end()!=i ) + { + shared_ptr const & p = i->second; +#ifndef BOOST_NO_RTTI + BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti ); +#endif + return p; + } + return shared_ptr(); + } + + char const * + diagnostic_information() const + { + if( diagnostic_info_str_.empty() ) + { + std::string tmp; + for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) + { + shared_ptr const & x = i->second; + tmp += '['; + tmp += x->tag_typeid_name(); + tmp += "] = "; + tmp += x->value_as_string(); + tmp += '\n'; + } + diagnostic_info_str_.swap(tmp); + } + return diagnostic_info_str_.c_str(); + } + + private: + + friend class boost::exception; + + typedef std::map< type_info_, shared_ptr > error_info_map; + error_info_map info_; + mutable std::string diagnostic_info_str_; + mutable int count_; + + void + add_ref() const + { + ++count_; + } + + void + release() const + { + if( !--count_ ) + delete this; + } + }; + } + + template + inline + E const & + operator<<( E const & x, error_info const & v ) + { + typedef error_info error_info_tag_t; + shared_ptr p( new error_info_tag_t(v) ); + exception_detail::error_info_container * c; + if( !(c=x.data_.get()) ) + x.data_.adopt(c=new exception_detail::error_info_container_impl); + c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t)); + return x; + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/info_tuple.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/info_tuple.hpp new file mode 100644 index 0000000000..3c8197a7e3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/info_tuple.hpp @@ -0,0 +1,67 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_63EE924290FB11DC87BB856555D89593 +#define UUID_63EE924290FB11DC87BB856555D89593 + +#include +#include + +namespace +boost + { + template < + class E, + class Tag1,class T1, + class Tag2,class T2 > + inline + E const & + operator<<( + E const & x, + tuple< + error_info, + error_info > const & v ) + { + return x << v.template get<0>() << v.template get<1>(); + } + + template < + class E, + class Tag1,class T1, + class Tag2,class T2, + class Tag3,class T3 > + inline + E const & + operator<<( + E const & x, + tuple< + error_info, + error_info, + error_info > const & v ) + { + return x << v.template get<0>() << v.template get<1>() << v.template get<2>(); + } + + template < + class E, + class Tag1,class T1, + class Tag2,class T2, + class Tag3,class T3, + class Tag4,class T4 > + inline + E const & + operator<<( + E const & x, + tuple< + error_info, + error_info, + error_info, + error_info > const & v ) + { + return x << v.template get<0>() << v.template get<1>() << v.template get<2>() << v.template get<3>(); + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/to_string.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/to_string.hpp new file mode 100644 index 0000000000..e10cbfdebc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/to_string.hpp @@ -0,0 +1,74 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_7E48761AD92811DC9011477D56D89593 +#define UUID_7E48761AD92811DC9011477D56D89593 + +#include +#include +#include + +namespace +boost + { + namespace + to_string_detail + { + template + typename disable_if,char>::type to_string( T const & ); + + template + struct has_to_string_impl; + + template + struct + has_to_string_impl + { + enum e { value=1 }; + }; + + template + struct + has_to_string_impl + { + static T const & f(); + enum e { value=1!=sizeof(to_string(f())) }; + }; + } + + template + inline + typename enable_if,std::string>::type + to_string( T const & x ) + { + std::ostringstream out; + out << x; + return out.str(); + } + + template + struct + has_to_string + { + enum e { value=to_string_detail::has_to_string_impl::value>::value }; + }; + + template + inline + std::string + to_string( std::pair const & x ) + { + return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')'; + } + + inline + std::string + to_string( std::exception const & x ) + { + return x.what(); + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception/to_string_stub.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception/to_string_stub.hpp new file mode 100644 index 0000000000..1cd08bbc8f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception/to_string_stub.hpp @@ -0,0 +1,100 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_E788439ED9F011DCB181F25B55D89593 +#define UUID_E788439ED9F011DCB181F25B55D89593 + +#include +#include +#include + +namespace +boost + { + namespace + exception_detail + { + template + struct + to_string_dispatcher + { + template + static + std::string + convert( T const & x, Stub ) + { + return to_string(x); + } + }; + + template <> + struct + to_string_dispatcher + { + template + static + std::string + convert( T const & x, Stub s ) + { + return s(x); + } + + template + static + std::string + convert( T const & x, std::string s ) + { + return s; + } + + template + static + std::string + convert( T const & x, char const * s ) + { + BOOST_ASSERT(s!=0); + return s; + } + }; + + namespace + to_string_dispatch + { + template + inline + std::string + dispatch( T const & x, Stub s ) + { + return to_string_dispatcher::value>::convert(x,s); + } + } + + template + inline + std::string + string_stub_dump( T const & x ) + { + return "[ " + exception_detail::object_hex_dump(x) + " ]"; + } + } + + template + inline + std::string + to_string_stub( T const & x ) + { + return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump); + } + + template + inline + std::string + to_string_stub( T const & x, Stub s ) + { + return exception_detail::to_string_dispatch::dispatch(x,s); + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/exception_ptr.hpp b/deal.II/contrib/boost/include/boost-1.37.0/exception_ptr.hpp new file mode 100644 index 0000000000..196329d254 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/exception_ptr.hpp @@ -0,0 +1,349 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_FA5836A2CADA11DC8CD47C8555D89593 +#define UUID_FA5836A2CADA11DC8CD47C8555D89593 + +#include +#include +#include +#include +#include + +namespace +boost + { + class exception_ptr; + exception_ptr current_exception(); + void rethrow_exception( exception_ptr const & ); + + class + exception_ptr + { + typedef bool exception_ptr::*unspecified_bool_type; + friend exception_ptr current_exception(); + friend void rethrow_exception( exception_ptr const & ); + + shared_ptr c_; + bool bad_alloc_; + + struct + bad_alloc_tag + { + }; + + explicit + exception_ptr( bad_alloc_tag ): + bad_alloc_(true) + { + } + + explicit + exception_ptr( shared_ptr const & c ): + c_(c), + bad_alloc_(false) + { + BOOST_ASSERT(c); + } + + public: + + exception_ptr(): + bad_alloc_(false) + { + } + + operator unspecified_bool_type() const + { + return (bad_alloc_ || c_) ? &exception_ptr::bad_alloc_ : 0; + } + + friend + bool + operator==( exception_ptr const & a, exception_ptr const & b ) + { + return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_; + } + + friend + bool + operator!=( exception_ptr const & a, exception_ptr const & b ) + { + return !(a==b); + } + }; + + class + unknown_exception: + public exception, + public std::exception, + public exception_detail::clone_base + { + public: + + unknown_exception() + { + } + + explicit + unknown_exception( boost::exception const & e ): + boost::exception(e) + { + } + + ~unknown_exception() throw() + { + } + + private: + + exception_detail::clone_base const * + clone() const + { + return new unknown_exception(*this); + } + + void + rethrow() const + { + throw*this; + } + }; + + namespace + exception_detail + { + template + class + current_exception_std_exception_wrapper: + public T, + public boost::exception, + public clone_base + { + public: + + explicit + current_exception_std_exception_wrapper( T const & e1 ): + T(e1) + { + } + + current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ): + T(e1), + boost::exception(e2) + { + } + + ~current_exception_std_exception_wrapper() throw() + { + } + + private: + + clone_base const * + clone() const + { + return new current_exception_std_exception_wrapper(*this); + } + + void + rethrow() const + { + throw *this; + } + }; + +#ifdef BOOST_NO_RTTI + template + exception const * + get_boost_exception( T const * ) + { + try + { + throw; + } + catch( + exception & x ) + { + return &x; + } + catch(...) + { + return 0; + } + } +#else + template + exception const * + get_boost_exception( T const * x ) + { + return dynamic_cast(x); + } +#endif + + template + inline + shared_ptr + current_exception_std_exception( T const & e1 ) + { + if( boost::exception const * e2 = get_boost_exception(&e1) ) + return shared_ptr(new current_exception_std_exception_wrapper(e1,*e2)); + else + return shared_ptr(new current_exception_std_exception_wrapper(e1)); + } + + inline + shared_ptr + current_exception_unknown_exception() + { + return shared_ptr(new unknown_exception()); + } + + inline + shared_ptr + current_exception_unknown_boost_exception( boost::exception const & e ) + { + return shared_ptr(new unknown_exception(e)); + } + + inline + shared_ptr + current_exception_unknown_std_exception( std::exception const & e ) + { + if( boost::exception const * be = get_boost_exception(&e) ) + return current_exception_unknown_boost_exception(*be); + else + return current_exception_unknown_exception(); + } + + inline + shared_ptr + current_exception_impl() + { + try + { + throw; + } + catch( + exception_detail::clone_base & e ) + { + return shared_ptr(e.clone()); + } + catch( + std::invalid_argument & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::out_of_range & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::logic_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_alloc & e ) + { + return exception_detail::current_exception_std_exception(e); + } +#ifndef BOOST_NO_TYPEID + catch( + std::bad_cast & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_typeid & e ) + { + return exception_detail::current_exception_std_exception(e); + } +#endif + catch( + std::bad_exception & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::exception & e ) + { + return exception_detail::current_exception_unknown_std_exception(e); + } + catch( + boost::exception & e ) + { + return exception_detail::current_exception_unknown_boost_exception(e); + } + catch( + ... ) + { + return exception_detail::current_exception_unknown_exception(); + } + } + } + + inline + exception_ptr + current_exception() + { + try + { + return exception_ptr(exception_detail::current_exception_impl()); + } + catch( + std::bad_alloc & ) + { + } + catch( + ... ) + { + try + { + return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception())); + } + catch( + std::bad_alloc & ) + { + } + catch( + ... ) + { + BOOST_ASSERT(0); + } + } + return exception_ptr(exception_ptr::bad_alloc_tag()); + } + + template + inline + exception_ptr + copy_exception( T const & e ) + { + try + { + throw enable_current_exception(e); + } + catch( + ... ) + { + return current_exception(); + } + } + + inline + void + rethrow_exception( exception_ptr const & p ) + { + BOOST_ASSERT(p); + if( p.bad_alloc_ ) + throw enable_current_exception(std::bad_alloc()); + else + p.c_->rethrow(); + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/filesystem.hpp b/deal.II/contrib/boost/include/boost-1.37.0/filesystem.hpp new file mode 100644 index 0000000000..aa65b2119a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/filesystem.hpp @@ -0,0 +1,20 @@ +// boost/filesystem/filesystem.hpp -----------------------------------------// + +// Copyright Beman Dawes 2005 + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/filesystem + +//----------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP +#define BOOST_FILESYSTEM_FILESYSTEM_HPP + +#include // includes path.hpp +#include + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/foreach.hpp b/deal.II/contrib/boost/include/boost-1.37.0/foreach.hpp new file mode 100644 index 0000000000..86f8f9cb85 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/foreach.hpp @@ -0,0 +1,1088 @@ +/////////////////////////////////////////////////////////////////////////////// +// foreach.hpp header file +// +// Copyright 2004 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) +// See http://www.boost.org/libs/foreach for documentation +// +// Credits: +// Anson Tsao - for the initial inspiration and several good suggestions. +// Thorsten Ottosen - for Boost.Range, and for suggesting a way to detect +// const-qualified rvalues at compile time on VC7.1+ +// Russell Hind - For help porting to Borland +// Alisdair Meredith - For help porting to Borland +// Stefan Slapeta - For help porting to Intel +// David Jenkins - For help finding a Microsoft Code Analysis bug + +#ifndef BOOST_FOREACH + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // for std::pair + +#include +#include + +// Some compilers let us detect even const-qualified rvalues at compile-time +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ + || (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL)) \ + || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL)) +# define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION +#else +// Some compilers allow temporaries to be bound to non-const references. +// These compilers make it impossible to for BOOST_FOREACH to detect +// temporaries and avoid reevaluation of the collection expression. +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ + || BOOST_WORKAROUND(__BORLANDC__, < 0x593) \ + || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x570)) \ + || BOOST_WORKAROUND(__DECCXX_VER, <= 60590042) +# define BOOST_FOREACH_NO_RVALUE_DETECTION +# endif +// Some compilers do not correctly implement the lvalue/rvalue conversion +// rules of the ternary conditional operator. +# if defined(BOOST_FOREACH_NO_RVALUE_DETECTION) \ + || defined(BOOST_NO_SFINAE) \ + || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ + || BOOST_WORKAROUND(BOOST_INTEL_WIN, <= 810) \ + || BOOST_WORKAROUND(__GNUC__, < 3) \ + || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 2)) \ + || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 3) && defined(__APPLE_CC__)) \ + || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ + || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) +# define BOOST_FOREACH_NO_CONST_RVALUE_DETECTION +# else +# define BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION +# endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION +# include +# include +# include +# include +#endif + +// This must be at global scope, hence the uglified name +enum boost_foreach_argument_dependent_lookup_hack +{ + boost_foreach_argument_dependent_lookup_hack_value +}; + +namespace boost +{ + +// forward declarations for iterator_range +template +class iterator_range; + +// forward declarations for sub_range +template +class sub_range; + +namespace foreach +{ + /////////////////////////////////////////////////////////////////////////////// + // in_range + // + template + inline std::pair in_range(T begin, T end) + { + return std::make_pair(begin, end); + } + + /////////////////////////////////////////////////////////////////////////////// + // boost::foreach::tag + // + typedef boost_foreach_argument_dependent_lookup_hack tag; + + /////////////////////////////////////////////////////////////////////////////// + // boost::foreach::is_lightweight_proxy + // Specialize this for user-defined collection types if they are inexpensive to copy. + // This tells BOOST_FOREACH it can avoid the rvalue/lvalue detection stuff. + template + struct is_lightweight_proxy + : boost::mpl::false_ + { + }; + + /////////////////////////////////////////////////////////////////////////////// + // boost::foreach::is_noncopyable + // Specialize this for user-defined collection types if they cannot be copied. + // This also tells BOOST_FOREACH to avoid the rvalue/lvalue detection stuff. + template + struct is_noncopyable + #if !defined(BOOST_BROKEN_IS_BASE_AND_DERIVED) && !defined(BOOST_NO_IS_ABSTRACT) + : boost::mpl::or_< + boost::is_abstract + , boost::is_base_and_derived + > + #elif !defined(BOOST_BROKEN_IS_BASE_AND_DERIVED) + : boost::is_base_and_derived + #elif !defined(BOOST_NO_IS_ABSTRACT) + : boost::is_abstract + #else + : boost::mpl::false_ + #endif + { + }; + +} // namespace foreach + +} // namespace boost + +// vc6/7 needs help ordering the following overloads +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# define BOOST_FOREACH_TAG_DEFAULT ... +#else +# define BOOST_FOREACH_TAG_DEFAULT boost::foreach::tag +#endif + +/////////////////////////////////////////////////////////////////////////////// +// boost_foreach_is_lightweight_proxy +// Another customization point for the is_lightweight_proxy optimization, +// this one works on legacy compilers. Overload boost_foreach_is_lightweight_proxy +// at the global namespace for your type. +template +inline boost::foreach::is_lightweight_proxy * +boost_foreach_is_lightweight_proxy(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } + +template +inline boost::mpl::true_ * +boost_foreach_is_lightweight_proxy(std::pair *&, boost::foreach::tag) { return 0; } + +template +inline boost::mpl::true_ * +boost_foreach_is_lightweight_proxy(boost::iterator_range *&, boost::foreach::tag) { return 0; } + +template +inline boost::mpl::true_ * +boost_foreach_is_lightweight_proxy(boost::sub_range *&, boost::foreach::tag) { return 0; } + +template +inline boost::mpl::true_ * +boost_foreach_is_lightweight_proxy(T **&, boost::foreach::tag) { return 0; } + +/////////////////////////////////////////////////////////////////////////////// +// boost_foreach_is_noncopyable +// Another customization point for the is_noncopyable trait, +// this one works on legacy compilers. Overload boost_foreach_is_noncopyable +// at the global namespace for your type. +template +inline boost::foreach::is_noncopyable * +boost_foreach_is_noncopyable(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } + +namespace boost +{ + +namespace foreach_detail_ +{ + +/////////////////////////////////////////////////////////////////////////////// +// Define some utilities for assessing the properties of expressions +// +template +inline boost::mpl::and_ *and_(Bool1 *, Bool2 *) { return 0; } + +template +inline boost::mpl::and_ *and_(Bool1 *, Bool2 *, Bool3 *) { return 0; } + +template +inline boost::mpl::or_ *or_(Bool1 *, Bool2 *) { return 0; } + +template +inline boost::mpl::or_ *or_(Bool1 *, Bool2 *, Bool3 *) { return 0; } + +template +inline boost::mpl::not_ *not_(Bool *) { return 0; } + +template +inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } + +template +inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; } + +template +inline boost::is_array *is_array_(T const &) { return 0; } + +template +inline boost::is_const *is_const_(T &) { return 0; } + +#ifndef BOOST_FOREACH_NO_RVALUE_DETECTION +template +inline boost::mpl::true_ *is_const_(T const &) { return 0; } +#endif + +/////////////////////////////////////////////////////////////////////////////// +// auto_any_t/auto_any +// General utility for putting an object of any type into automatic storage +struct auto_any_base +{ + // auto_any_base must evaluate to false in boolean context so that + // they can be declared in if() statements. + operator bool() const + { + return false; + } +}; + +template +struct auto_any : auto_any_base +{ + auto_any(T const &t) + : item(t) + { + } + + // temporaries of type auto_any will be bound to const auto_any_base + // references, but we still want to be able to mutate the stored + // data, so declare it as mutable. + mutable T item; +}; + +typedef auto_any_base const &auto_any_t; + +template +inline BOOST_DEDUCED_TYPENAME boost::mpl::if_::type &auto_any_cast(auto_any_t a) +{ + return static_cast const &>(a).item; +} + +typedef boost::mpl::true_ const_; + +/////////////////////////////////////////////////////////////////////////////// +// type2type +// +template +struct type2type + : boost::mpl::if_ +{ +}; + +template +struct wrap_cstr +{ + typedef T type; +}; + +template<> +struct wrap_cstr +{ + typedef wrap_cstr type; + typedef char *iterator; + typedef char *const_iterator; +}; + +template<> +struct wrap_cstr +{ + typedef wrap_cstr type; + typedef char const *iterator; + typedef char const *const_iterator; +}; + +template<> +struct wrap_cstr +{ + typedef wrap_cstr type; + typedef wchar_t *iterator; + typedef wchar_t *const_iterator; +}; + +template<> +struct wrap_cstr +{ + typedef wrap_cstr type; + typedef wchar_t const *iterator; + typedef wchar_t const *const_iterator; +}; + +template +struct is_char_array + : mpl::and_< + is_array + , mpl::or_< + is_convertible + , is_convertible + > + > +{}; + +template +struct foreach_iterator +{ + // **** READ THIS IF YOUR COMPILE BREAKS HERE **** + // + // There is an ambiguity about how to iterate over arrays of char and wchar_t. + // Should the last array element be treated as a null terminator to be skipped, or + // is it just like any other element in the array? To fix the problem, you must + // say which behavior you want. + // + // To treat the container as a null-terminated string, merely cast it to a + // char const *, as in BOOST_FOREACH( char ch, (char const *)"hello" ) ... + // + // To treat the container as an array, use boost::as_array() in , + // as in BOOST_FOREACH( char ch, boost::as_array("hello") ) ... + #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 + BOOST_MPL_ASSERT_MSG( (!is_char_array::value), IS_THIS_AN_ARRAY_OR_A_NULL_TERMINATED_STRING, (T&) ); + #endif + + // If the type is a pointer to a null terminated string (as opposed + // to an array type), there is no ambiguity. + typedef BOOST_DEDUCED_TYPENAME wrap_cstr::type container; + + typedef BOOST_DEDUCED_TYPENAME boost::mpl::eval_if< + C + , range_const_iterator + , range_mutable_iterator + >::type type; +}; + + +template +struct foreach_reverse_iterator +{ + // **** READ THIS IF YOUR COMPILE BREAKS HERE **** + // + // There is an ambiguity about how to iterate over arrays of char and wchar_t. + // Should the last array element be treated as a null terminator to be skipped, or + // is it just like any other element in the array? To fix the problem, you must + // say which behavior you want. + // + // To treat the container as a null-terminated string, merely cast it to a + // char const *, as in BOOST_FOREACH( char ch, (char const *)"hello" ) ... + // + // To treat the container as an array, use boost::as_array() in , + // as in BOOST_FOREACH( char ch, boost::as_array("hello") ) ... + #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 + BOOST_MPL_ASSERT_MSG( (!is_char_array::value), IS_THIS_AN_ARRAY_OR_A_NULL_TERMINATED_STRING, (T&) ); + #endif + + // If the type is a pointer to a null terminated string (as opposed + // to an array type), there is no ambiguity. + typedef BOOST_DEDUCED_TYPENAME wrap_cstr::type container; + + typedef BOOST_DEDUCED_TYPENAME boost::mpl::eval_if< + C + , range_reverse_iterator + , range_reverse_iterator + >::type type; +}; + +template +struct foreach_reference + : iterator_reference::type> +{ +}; + +/////////////////////////////////////////////////////////////////////////////// +// encode_type +// +template +inline type2type *encode_type(T &, boost::mpl::false_ *) { return 0; } + +template +inline type2type *encode_type(T const &, boost::mpl::true_ *) { return 0; } + +/////////////////////////////////////////////////////////////////////////////// +// set_false +// +inline bool set_false(bool &b) +{ + b = false; + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// to_ptr +// +template +inline T *&to_ptr(T const &) +{ + static T *t = 0; + return t; +} + +// Borland needs a little extra help with arrays +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +template +inline T (*&to_ptr(T (&)[N]))[N] +{ + static T (*t)[N] = 0; + return t; +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// derefof +// +template +inline T &derefof(T *t) +{ + // This is a work-around for a compiler bug in Borland. If T* is a pointer to array type U(*)[N], + // then dereferencing it results in a U* instead of U(&)[N]. The cast forces the issue. + return reinterpret_cast( + *const_cast( + reinterpret_cast(t) + ) + ); +} + +#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION +/////////////////////////////////////////////////////////////////////////////// +// Detect at compile-time whether an expression yields an rvalue or +// an lvalue. This is rather non-standard, but some popular compilers +// accept it. +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// rvalue_probe +// +template +struct rvalue_probe +{ + struct private_type_ {}; + // can't ever return an array by value + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::mpl::or_, boost::is_array >, private_type_, T + >::type value_type; + operator value_type() { return *reinterpret_cast(this); } // never called + operator T &() const { return *reinterpret_cast(const_cast(this)); } // never called +}; + +template +rvalue_probe const make_probe(T const &) +{ + return rvalue_probe(); +} + +# define BOOST_FOREACH_IS_RVALUE(COL) \ + boost::foreach_detail_::and_( \ + boost::foreach_detail_::not_(boost::foreach_detail_::is_array_(COL)) \ + , (true ? 0 : boost::foreach_detail_::is_rvalue_( \ + (true ? boost::foreach_detail_::make_probe(COL) : (COL)), 0))) + +#elif defined(BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION) +/////////////////////////////////////////////////////////////////////////////// +// Detect at run-time whether an expression yields an rvalue +// or an lvalue. This is 100% standard C++, but not all compilers +// accept it. Also, it causes FOREACH to break when used with non- +// copyable collection types. +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// rvalue_probe +// +template +struct rvalue_probe +{ + rvalue_probe(T &t, bool &b) + : value(t) + , is_rvalue(b) + { + } + + struct private_type_ {}; + // can't ever return an array or an abstract type by value + #ifdef BOOST_NO_IS_ABSTRACT + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::is_array, private_type_, T + >::type value_type; + #else + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::mpl::or_, boost::is_array >, private_type_, T + >::type value_type; + #endif + + operator value_type() + { + this->is_rvalue = true; + return this->value; + } + + operator T &() const + { + return this->value; + } + +private: + T &value; + bool &is_rvalue; +}; + +template +rvalue_probe make_probe(T &t, bool &b) { return rvalue_probe(t, b); } + +template +rvalue_probe make_probe(T const &t, bool &b) { return rvalue_probe(t, b); } + +/////////////////////////////////////////////////////////////////////////////// +// simple_variant +// holds either a T or a T const* +template +struct simple_variant +{ + simple_variant(T const *t) + : is_rvalue(false) + { + *static_cast(this->data.address()) = t; + } + + simple_variant(T const &t) + : is_rvalue(true) + { + ::new(this->data.address()) T(t); + } + + simple_variant(simple_variant const &that) + : is_rvalue(that.is_rvalue) + { + if(this->is_rvalue) + ::new(this->data.address()) T(*that.get()); + else + *static_cast(this->data.address()) = that.get(); + } + + ~simple_variant() + { + if(this->is_rvalue) + this->get()->~T(); + } + + T const *get() const + { + if(this->is_rvalue) + return static_cast(this->data.address()); + else + return *static_cast(this->data.address()); + } + +private: + enum size_type { size = sizeof(T) > sizeof(T*) ? sizeof(T) : sizeof(T*) }; + simple_variant &operator =(simple_variant const &); + bool const is_rvalue; + aligned_storage data; +}; + +// If the collection is an array or is noncopyable, it must be an lvalue. +// If the collection is a lightweight proxy, treat it as an rvalue +// BUGBUG what about a noncopyable proxy? +template +inline BOOST_DEDUCED_TYPENAME boost::enable_if, IsProxy>::type * +should_copy_impl(LValue *, IsProxy *, bool *) +{ + return 0; +} + +// Otherwise, we must determine at runtime whether it's an lvalue or rvalue +inline bool * +should_copy_impl(boost::mpl::false_ *, boost::mpl::false_ *, bool *is_rvalue) +{ + return is_rvalue; +} + +#endif + +/////////////////////////////////////////////////////////////////////////////// +// contain +// +template +inline auto_any contain(T const &t, boost::mpl::true_ *) // rvalue +{ + return t; +} + +template +inline auto_any contain(T &t, boost::mpl::false_ *) // lvalue +{ + // Cannot seem to get sunpro to handle addressof() with array types. + #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x570)) + return &t; + #else + return boost::addressof(t); + #endif +} + +#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION +template +auto_any > +contain(T const &t, bool *rvalue) +{ + return *rvalue ? simple_variant(t) : simple_variant(&t); +} +#endif + +///////////////////////////////////////////////////////////////////////////// +// begin +// +template +inline auto_any::type> +begin(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue +{ + return boost::begin(auto_any_cast(col)); +} + +template +inline auto_any::type> +begin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue +{ + typedef BOOST_DEDUCED_TYPENAME type2type::type type; + typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator; + return iterator(boost::begin(derefof(auto_any_cast(col)))); +} + +#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION +template +auto_any::type> +begin(auto_any_t col, type2type *, bool *) +{ + return boost::begin(*auto_any_cast, boost::mpl::false_>(col).get()); +} +#endif + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline auto_any +begin(auto_any_t col, type2type *, boost::mpl::true_ *) // null-terminated C-style strings +{ + return auto_any_cast(col); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// end +// +template +inline auto_any::type> +end(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue +{ + return boost::end(auto_any_cast(col)); +} + +template +inline auto_any::type> +end(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue +{ + typedef BOOST_DEDUCED_TYPENAME type2type::type type; + typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator; + return iterator(boost::end(derefof(auto_any_cast(col)))); +} + +#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION +template +auto_any::type> +end(auto_any_t col, type2type *, bool *) +{ + return boost::end(*auto_any_cast, boost::mpl::false_>(col).get()); +} +#endif + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline auto_any +end(auto_any_t col, type2type *, boost::mpl::true_ *) // null-terminated C-style strings +{ + return 0; // not used +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// done +// +template +inline bool done(auto_any_t cur, auto_any_t end, type2type *) +{ + typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iter_t; + return auto_any_cast(cur) == auto_any_cast(end); +} + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline bool done(auto_any_t cur, auto_any_t, type2type *) // null-terminated C-style strings +{ + return ! *auto_any_cast(cur); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// next +// +template +inline void next(auto_any_t cur, type2type *) +{ + typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iter_t; + ++auto_any_cast(cur); +} + +/////////////////////////////////////////////////////////////////////////////// +// deref +// +template +inline BOOST_DEDUCED_TYPENAME foreach_reference::type +deref(auto_any_t cur, type2type *) +{ + typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iter_t; + return *auto_any_cast(cur); +} + +///////////////////////////////////////////////////////////////////////////// +// rbegin +// +template +inline auto_any::type> +rbegin(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue +{ + return boost::rbegin(auto_any_cast(col)); +} + +template +inline auto_any::type> +rbegin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue +{ + typedef BOOST_DEDUCED_TYPENAME type2type::type type; + typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator; + return iterator(boost::rbegin(derefof(auto_any_cast(col)))); +} + +#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION +template +auto_any::type> +rbegin(auto_any_t col, type2type *, bool *) +{ + return boost::rbegin(*auto_any_cast, boost::mpl::false_>(col).get()); +} +#endif + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline auto_any > +rbegin(auto_any_t col, type2type *, boost::mpl::true_ *) // null-terminated C-style strings +{ + T *p = auto_any_cast(col); + while(0 != *p) + ++p; + return reverse_iterator(p); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// rend +// +template +inline auto_any::type> +rend(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue +{ + return boost::rend(auto_any_cast(col)); +} + +template +inline auto_any::type> +rend(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue +{ + typedef BOOST_DEDUCED_TYPENAME type2type::type type; + typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator; + return iterator(boost::rend(derefof(auto_any_cast(col)))); +} + +#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION +template +auto_any::type> +rend(auto_any_t col, type2type *, bool *) +{ + return boost::rend(*auto_any_cast, boost::mpl::false_>(col).get()); +} +#endif + +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline auto_any > +rend(auto_any_t col, type2type *, boost::mpl::true_ *) // null-terminated C-style strings +{ + return reverse_iterator(auto_any_cast(col)); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// rdone +// +template +inline bool rdone(auto_any_t cur, auto_any_t end, type2type *) +{ + typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iter_t; + return auto_any_cast(cur) == auto_any_cast(end); +} + +/////////////////////////////////////////////////////////////////////////////// +// rnext +// +template +inline void rnext(auto_any_t cur, type2type *) +{ + typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iter_t; + ++auto_any_cast(cur); +} + +/////////////////////////////////////////////////////////////////////////////// +// rderef +// +template +inline BOOST_DEDUCED_TYPENAME foreach_reference::type +rderef(auto_any_t cur, type2type *) +{ + typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iter_t; + return *auto_any_cast(cur); +} + +} // namespace foreach_detail_ +} // namespace boost + +// Suppress a bogus code analysis warning on vc8+ +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +# define BOOST_FOREACH_SUPPRESS_WARNINGS() __pragma(warning(suppress:6001)) +#else +# define BOOST_FOREACH_SUPPRESS_WARNINGS() +#endif + +// A sneaky way to get the type of the collection without evaluating the expression +#define BOOST_FOREACH_TYPEOF(COL) \ + (true ? 0 : boost::foreach_detail_::encode_type(COL, boost::foreach_detail_::is_const_(COL))) + +// returns true_* if the type is noncopyable +#define BOOST_FOREACH_IS_NONCOPYABLE(COL) \ + boost_foreach_is_noncopyable( \ + boost::foreach_detail_::to_ptr(COL) \ + , boost_foreach_argument_dependent_lookup_hack_value) + +// returns true_* if the type is a lightweight proxy (and is not noncopyable) +#define BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL) \ + boost::foreach_detail_::and_( \ + boost::foreach_detail_::not_(BOOST_FOREACH_IS_NONCOPYABLE(COL)) \ + , boost_foreach_is_lightweight_proxy( \ + boost::foreach_detail_::to_ptr(COL) \ + , boost_foreach_argument_dependent_lookup_hack_value)) + +#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION +/////////////////////////////////////////////////////////////////////////////// +// R-values and const R-values supported here with zero runtime overhead +/////////////////////////////////////////////////////////////////////////////// + +// No variable is needed to track the rvalue-ness of the collection expression +# define BOOST_FOREACH_PREAMBLE() \ + BOOST_FOREACH_SUPPRESS_WARNINGS() + +// Evaluate the collection expression +# define BOOST_FOREACH_EVALUATE(COL) \ + (COL) + +# define BOOST_FOREACH_SHOULD_COPY(COL) \ + (true ? 0 : boost::foreach_detail_::or_( \ + BOOST_FOREACH_IS_RVALUE(COL) \ + , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))) + +#elif defined(BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION) +/////////////////////////////////////////////////////////////////////////////// +// R-values and const R-values supported here +/////////////////////////////////////////////////////////////////////////////// + +// Declare a variable to track the rvalue-ness of the collection expression +# define BOOST_FOREACH_PREAMBLE() \ + BOOST_FOREACH_SUPPRESS_WARNINGS() \ + if (bool _foreach_is_rvalue = false) {} else + +// Evaluate the collection expression, and detect if it is an lvalue or and rvalue +# define BOOST_FOREACH_EVALUATE(COL) \ + (true ? boost::foreach_detail_::make_probe((COL), _foreach_is_rvalue) : (COL)) + +// The rvalue/lvalue-ness of the collection expression is determined dynamically, unless +// type type is an array or is noncopyable or is non-const, in which case we know it's an lvalue. +// If the type happens to be a lightweight proxy, always make a copy. +# define BOOST_FOREACH_SHOULD_COPY(COL) \ + (boost::foreach_detail_::should_copy_impl( \ + true ? 0 : boost::foreach_detail_::or_( \ + boost::foreach_detail_::is_array_(COL) \ + , BOOST_FOREACH_IS_NONCOPYABLE(COL) \ + , boost::foreach_detail_::not_(boost::foreach_detail_::is_const_(COL))) \ + , true ? 0 : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL) \ + , &_foreach_is_rvalue)) + +#elif !defined(BOOST_FOREACH_NO_RVALUE_DETECTION) +/////////////////////////////////////////////////////////////////////////////// +// R-values supported here, const R-values NOT supported here +/////////////////////////////////////////////////////////////////////////////// + +// No variable is needed to track the rvalue-ness of the collection expression +# define BOOST_FOREACH_PREAMBLE() \ + BOOST_FOREACH_SUPPRESS_WARNINGS() + +// Evaluate the collection expression +# define BOOST_FOREACH_EVALUATE(COL) \ + (COL) + +// Determine whether the collection expression is an lvalue or an rvalue. +// NOTE: this gets the answer wrong for const rvalues. +# define BOOST_FOREACH_SHOULD_COPY(COL) \ + (true ? 0 : boost::foreach_detail_::or_( \ + boost::foreach_detail_::is_rvalue_((COL), 0) \ + , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))) + +#else +/////////////////////////////////////////////////////////////////////////////// +// R-values NOT supported here +/////////////////////////////////////////////////////////////////////////////// + +// No variable is needed to track the rvalue-ness of the collection expression +# define BOOST_FOREACH_PREAMBLE() \ + BOOST_FOREACH_SUPPRESS_WARNINGS() + +// Evaluate the collection expression +# define BOOST_FOREACH_EVALUATE(COL) \ + (COL) + +// Can't use rvalues with BOOST_FOREACH (unless they are lightweight proxies) +# define BOOST_FOREACH_SHOULD_COPY(COL) \ + (true ? 0 : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL)) + +#endif + +#define BOOST_FOREACH_CONTAIN(COL) \ + boost::foreach_detail_::contain( \ + BOOST_FOREACH_EVALUATE(COL) \ + , BOOST_FOREACH_SHOULD_COPY(COL)) + +#define BOOST_FOREACH_BEGIN(COL) \ + boost::foreach_detail_::begin( \ + _foreach_col \ + , BOOST_FOREACH_TYPEOF(COL) \ + , BOOST_FOREACH_SHOULD_COPY(COL)) + +#define BOOST_FOREACH_END(COL) \ + boost::foreach_detail_::end( \ + _foreach_col \ + , BOOST_FOREACH_TYPEOF(COL) \ + , BOOST_FOREACH_SHOULD_COPY(COL)) + +#define BOOST_FOREACH_DONE(COL) \ + boost::foreach_detail_::done( \ + _foreach_cur \ + , _foreach_end \ + , BOOST_FOREACH_TYPEOF(COL)) + +#define BOOST_FOREACH_NEXT(COL) \ + boost::foreach_detail_::next( \ + _foreach_cur \ + , BOOST_FOREACH_TYPEOF(COL)) + +#define BOOST_FOREACH_DEREF(COL) \ + boost::foreach_detail_::deref( \ + _foreach_cur \ + , BOOST_FOREACH_TYPEOF(COL)) + +#define BOOST_FOREACH_RBEGIN(COL) \ + boost::foreach_detail_::rbegin( \ + _foreach_col \ + , BOOST_FOREACH_TYPEOF(COL) \ + , BOOST_FOREACH_SHOULD_COPY(COL)) + +#define BOOST_FOREACH_REND(COL) \ + boost::foreach_detail_::rend( \ + _foreach_col \ + , BOOST_FOREACH_TYPEOF(COL) \ + , BOOST_FOREACH_SHOULD_COPY(COL)) + +#define BOOST_FOREACH_RDONE(COL) \ + boost::foreach_detail_::rdone( \ + _foreach_cur \ + , _foreach_end \ + , BOOST_FOREACH_TYPEOF(COL)) + +#define BOOST_FOREACH_RNEXT(COL) \ + boost::foreach_detail_::rnext( \ + _foreach_cur \ + , BOOST_FOREACH_TYPEOF(COL)) + +#define BOOST_FOREACH_RDEREF(COL) \ + boost::foreach_detail_::rderef( \ + _foreach_cur \ + , BOOST_FOREACH_TYPEOF(COL)) + +/////////////////////////////////////////////////////////////////////////////// +// BOOST_FOREACH +// +// For iterating over collections. Collections can be +// arrays, null-terminated strings, or STL containers. +// The loop variable can be a value or reference. For +// example: +// +// std::list int_list(/*stuff*/); +// BOOST_FOREACH(int &i, int_list) +// { +// /* +// * loop body goes here. +// * i is a reference to the int in int_list. +// */ +// } +// +// Alternately, you can declare the loop variable first, +// so you can access it after the loop finishes. Obviously, +// if you do it this way, then the loop variable cannot be +// a reference. +// +// int i; +// BOOST_FOREACH(i, int_list) +// { ... } +// +#define BOOST_FOREACH(VAR, COL) \ + BOOST_FOREACH_PREAMBLE() \ + if (boost::foreach_detail_::auto_any_t _foreach_col = BOOST_FOREACH_CONTAIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t _foreach_cur = BOOST_FOREACH_BEGIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t _foreach_end = BOOST_FOREACH_END(COL)) {} else \ + for (bool _foreach_continue = true; \ + _foreach_continue && !BOOST_FOREACH_DONE(COL); \ + _foreach_continue ? BOOST_FOREACH_NEXT(COL) : (void)0) \ + if (boost::foreach_detail_::set_false(_foreach_continue)) {} else \ + for (VAR = BOOST_FOREACH_DEREF(COL); !_foreach_continue; _foreach_continue = true) + +/////////////////////////////////////////////////////////////////////////////// +// BOOST_REVERSE_FOREACH +// +// For iterating over collections in reverse order. In +// all other respects, BOOST_REVERSE_FOREACH is like +// BOOST_FOREACH. +// +#define BOOST_REVERSE_FOREACH(VAR, COL) \ + BOOST_FOREACH_PREAMBLE() \ + if (boost::foreach_detail_::auto_any_t _foreach_col = BOOST_FOREACH_CONTAIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t _foreach_cur = BOOST_FOREACH_RBEGIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t _foreach_end = BOOST_FOREACH_REND(COL)) {} else \ + for (bool _foreach_continue = true; \ + _foreach_continue && !BOOST_FOREACH_RDONE(COL); \ + _foreach_continue ? BOOST_FOREACH_RNEXT(COL) : (void)0) \ + if (boost::foreach_detail_::set_false(_foreach_continue)) {} else \ + for (VAR = BOOST_FOREACH_RDEREF(COL); !_foreach_continue; _foreach_continue = true) + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format.hpp new file mode 100644 index 0000000000..73464a819f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format.hpp @@ -0,0 +1,59 @@ +// ---------------------------------------------------------------------------- +// format.hpp : primary header +// ---------------------------------------------------------------------------- + +// 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_HPP +#define BOOST_FORMAT_HPP + +#include +#include +#include +#include + +#ifndef BOOST_NO_STD_LOCALE +#include +#endif + +// *** Compatibility framework +#include + +#ifdef BOOST_NO_LOCALE_ISIDIGIT +#include // we'll use the non-locale 's std::isdigit(int) +#endif + +// **** Forward declarations ---------------------------------- +#include // basic_format, and other frontends +#include // misc forward declarations for internal use + +// **** Auxiliary structs (stream_format_state , and format_item ) +#include + +// **** Format class interface -------------------------------- +#include + +// **** Exceptions ----------------------------------------------- +#include + +// **** Implementation ------------------------------------------- +#include // member functions +#include // class for grouping arguments +#include // argument-feeding functions +#include // format-string parsing (member-)functions + +// **** Implementation of the free functions ---------------------- +#include + + +// *** Undefine 'local' macros : +#include + +#endif // BOOST_FORMAT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/alt_sstream.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/alt_sstream.hpp new file mode 100644 index 0000000000..e236be3526 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/alt_sstream.hpp @@ -0,0 +1,176 @@ +// ---------------------------------------------------------------------------- +// alt_sstream.hpp : alternative stringstream +// ---------------------------------------------------------------------------- + +// 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_SK_ALT_SSTREAM_HPP +#define BOOST_SK_ALT_SSTREAM_HPP + +#include +#include +#include +#include +#include + +namespace boost { + namespace io { + + template, + class Alloc=::std::allocator > + class basic_altstringbuf; + + template, + class Alloc=::std::allocator > + class basic_oaltstringstream; + + + template + class basic_altstringbuf + : public ::std::basic_streambuf + { + typedef ::std::basic_streambuf streambuf_t; + typedef typename CompatAlloc::compatible_type compat_allocator_type; + typedef typename CompatTraits::compatible_type compat_traits_type; + public: + typedef Ch char_type; + typedef Tr traits_type; + typedef typename compat_traits_type::int_type int_type; + typedef typename compat_traits_type::pos_type pos_type; + typedef typename compat_traits_type::off_type off_type; + typedef Alloc allocator_type; + typedef ::std::basic_string string_type; + typedef typename string_type::size_type size_type; + + typedef ::std::streamsize streamsize; + + + explicit basic_altstringbuf(std::ios_base::openmode mode + = std::ios_base::in | std::ios_base::out) + : putend_(NULL), is_allocated_(false), mode_(mode) + {} + explicit basic_altstringbuf(const string_type& s, + ::std::ios_base::openmode mode + = ::std::ios_base::in | ::std::ios_base::out) + : putend_(NULL), is_allocated_(false), mode_(mode) + { dealloc(); str(s); } + virtual ~basic_altstringbuf() + { dealloc(); } + using streambuf_t::pbase; + using streambuf_t::pptr; + using streambuf_t::epptr; + using streambuf_t::eback; + using streambuf_t::gptr; + using streambuf_t::egptr; + + void clear_buffer(); + void str(const string_type& s); + + // 0-copy access : + Ch * begin() const; + size_type size() const; + size_type cur_size() const; // stop at current pointer + Ch * pend() const // the highest position reached by pptr() since creation + { return ((putend_ < pptr()) ? pptr() : putend_); } + size_type pcount() const + { return static_cast( pptr() - pbase()) ;} + + // copy buffer to string : + string_type str() const + { return string_type(begin(), size()); } + string_type cur_str() const + { return string_type(begin(), cur_size()); } + protected: + explicit basic_altstringbuf (basic_altstringbuf * s, + ::std::ios_base::openmode mode + = ::std::ios_base::in | ::std::ios_base::out) + : putend_(NULL), is_allocated_(false), mode_(mode) + { dealloc(); str(s); } + + virtual pos_type seekoff(off_type off, ::std::ios_base::seekdir way, + ::std::ios_base::openmode which + = ::std::ios_base::in | ::std::ios_base::out); + virtual pos_type seekpos (pos_type pos, + ::std::ios_base::openmode which + = ::std::ios_base::in | ::std::ios_base::out); + virtual int_type underflow(); + virtual int_type pbackfail(int_type meta = compat_traits_type::eof()); + virtual int_type overflow(int_type meta = compat_traits_type::eof()); + void dealloc(); + private: + enum { alloc_min = 256}; // minimum size of allocations + + Ch *putend_; // remembers (over seeks) the highest value of pptr() + bool is_allocated_; + ::std::ios_base::openmode mode_; + compat_allocator_type alloc_; // the allocator object + }; + + +// --- class basic_oaltstringstream ---------------------------------------- + template + class basic_oaltstringstream + : private base_from_member< shared_ptr< basic_altstringbuf< Ch, Tr, Alloc> > >, + public ::std::basic_ostream + { + class No_Op { + // used as no-op deleter for (not-owner) shared_pointers + public: + template + const T & operator()(const T & arg) { return arg; } + }; + typedef ::std::basic_ostream stream_t; + typedef boost::base_from_member > > + pbase_type; + typedef ::std::basic_string string_type; + typedef typename string_type::size_type size_type; + typedef basic_altstringbuf stringbuf_t; + public: + typedef Alloc allocator_type; + basic_oaltstringstream() + : pbase_type(new stringbuf_t), stream_t(rdbuf()) + { } + basic_oaltstringstream(::boost::shared_ptr buf) + : pbase_type(buf), stream_t(rdbuf()) + { } + basic_oaltstringstream(stringbuf_t * buf) + : pbase_type(buf, No_Op() ), stream_t(rdbuf()) + { } + stringbuf_t * rdbuf() const + { return pbase_type::member.get(); } + void clear_buffer() + { rdbuf()->clear_buffer(); } + + // 0-copy access : + Ch * begin() const + { return rdbuf()->begin(); } + size_type size() const + { return rdbuf()->size(); } + size_type cur_size() const // stops at current position + { return rdbuf()->cur_size(); } + + // copy buffer to string : + string_type str() const // [pbase, epptr[ + { return rdbuf()->str(); } + string_type cur_str() const // [pbase, pptr[ + { return rdbuf()->cur_str(); } + void str(const string_type& s) + { rdbuf()->str(s); } + }; + + } // N.S. io +} // N.S. boost + +#include + +#endif // include guard + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/alt_sstream_impl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/alt_sstream_impl.hpp new file mode 100644 index 0000000000..0ef35c09e6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/alt_sstream_impl.hpp @@ -0,0 +1,303 @@ +// ---------------------------------------------------------------------------- +// alt_sstream_impl.hpp : alternative stringstream, templates implementation +// ---------------------------------------------------------------------------- + +// 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_SK_ALT_SSTREAM_IMPL_HPP +#define BOOST_SK_ALT_SSTREAM_IMPL_HPP + +namespace boost { + namespace io { +// --- Implementation ------------------------------------------------------// + + template + void basic_altstringbuf:: + clear_buffer () { + const Ch * p = pptr(); + const Ch * b = pbase(); + if(p != NULL && p != b) { + seekpos(0, ::std::ios_base::out); + } + p = gptr(); + b = eback(); + if(p != NULL && p != b) { + seekpos(0, ::std::ios_base::in); + } + } + + template + void basic_altstringbuf:: + str (const string_type& s) { + size_type sz=s.size(); + if(sz != 0 && mode_ & (::std::ios_base::in | ::std::ios_base::out) ) { + Ch *new_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0); + // if this didnt throw, we're safe, update the buffer + dealloc(); + sz = s.copy(new_ptr, sz); + putend_ = new_ptr + sz; + if(mode_ & ::std::ios_base::in) + streambuf_t::setg(new_ptr, new_ptr, new_ptr + sz); + if(mode_ & ::std::ios_base::out) { + streambuf_t::setp(new_ptr, new_ptr + sz); + if(mode_ & (::std::ios_base::app | ::std::ios_base::ate)) + streambuf_t::pbump(static_cast(sz)); + if(gptr() == NULL) + streambuf_t::setg(new_ptr, NULL, new_ptr); + } + is_allocated_ = true; + } + else + dealloc(); + } + template + Ch* basic_altstringbuf:: + begin () const { + if(mode_ & ::std::ios_base::out && pptr() != NULL) + return pbase(); + else if(mode_ & ::std::ios_base::in && gptr() != NULL) + return eback(); + return NULL; + } + + template + typename std::basic_string::size_type + basic_altstringbuf:: + size () const { + if(mode_ & ::std::ios_base::out && pptr()) + return static_cast(pend() - pbase()); + else if(mode_ & ::std::ios_base::in && gptr()) + return static_cast(egptr() - eback()); + else + return 0; + } + + template + typename std::basic_string::size_type + basic_altstringbuf:: + cur_size () const { + if(mode_ & ::std::ios_base::out && pptr()) + return static_cast( pptr() - pbase()); + else if(mode_ & ::std::ios_base::in && gptr()) + return static_cast( gptr() - eback()); + else + return 0; + } + + template + typename basic_altstringbuf::pos_type + basic_altstringbuf:: + seekoff (off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) { + if(pptr() != NULL && putend_ < pptr()) + putend_ = pptr(); + if(which & ::std::ios_base::in && gptr() != NULL) { + // get area + if(way == ::std::ios_base::end) + off += static_cast(putend_ - gptr()); + else if(way == ::std::ios_base::beg) + off += static_cast(eback() - gptr()); + else if(way != ::std::ios_base::cur || (which & ::std::ios_base::out) ) + // (altering in&out is only supported if way is beg or end, not cur) + return pos_type(off_type(-1)); + if(eback() <= off+gptr() && off+gptr() <= putend_ ) { + // set gptr + streambuf_t::gbump(static_cast(off)); + if(which & ::std::ios_base::out && pptr() != NULL) + // update pptr to match gptr + streambuf_t::pbump(static_cast(gptr()-pptr())); + } + else + off = off_type(-1); + } + else if(which & ::std::ios_base::out && pptr() != NULL) { + // put area + if(way == ::std::ios_base::end) + off += static_cast(putend_ - pptr()); + else if(way == ::std::ios_base::beg) + off += static_cast(pbase() - pptr()); + else if(way != ::std::ios_base::beg) + return pos_type(off_type(-1)); + if(pbase() <= off+pptr() && off+pptr() <= putend_) + // set pptr + streambuf_t::pbump(static_cast(off)); + else + off = off_type(-1); + } + else // neither in nor out + off = off_type(-1); + return (pos_type(off)); + } + //- end seekoff(..) + + + template + typename basic_altstringbuf::pos_type + basic_altstringbuf:: + seekpos (pos_type pos, ::std::ios_base::openmode which) { + off_type off = off_type(pos); // operation guaranteed by §27.4.3.2 table 88 + if(pptr() != NULL && putend_ < pptr()) + putend_ = pptr(); + if(off != off_type(-1)) { + if(which & ::std::ios_base::in && gptr() != NULL) { + // get area + if(0 <= off && off <= putend_ - eback()) { + streambuf_t::gbump(static_cast(eback() - gptr() + off)); + if(which & ::std::ios_base::out && pptr() != NULL) { + // update pptr to match gptr + streambuf_t::pbump(static_cast(gptr()-pptr())); + } + } + else + off = off_type(-1); + } + else if(which & ::std::ios_base::out && pptr() != NULL) { + // put area + if(0 <= off && off <= putend_ - eback()) + streambuf_t::pbump(static_cast(eback() - pptr() + off)); + else + off = off_type(-1); + } + else // neither in nor out + off = off_type(-1); + return (pos_type(off)); + } + else { + BOOST_ASSERT(0); // §27.4.3.2 allows undefined-behaviour here + return pos_type(off_type(-1)); + } + } + // -end seekpos(..) + + + template + typename basic_altstringbuf::int_type + basic_altstringbuf:: + underflow () { + if(gptr() == NULL) // no get area -> nothing to get. + return (compat_traits_type::eof()); + else if(gptr() < egptr()) // ok, in buffer + return (compat_traits_type::to_int_type(*gptr())); + else if(mode_ & ::std::ios_base::in && pptr() != NULL + && (gptr() < pptr() || gptr() < putend_) ) + { // expand get area + if(putend_ < pptr()) + putend_ = pptr(); // remember pptr reached this far + streambuf_t::setg(eback(), gptr(), putend_); + return (compat_traits_type::to_int_type(*gptr())); + } + else // couldnt get anything. EOF. + return (compat_traits_type::eof()); + } + // -end underflow(..) + + + template + typename basic_altstringbuf::int_type + basic_altstringbuf:: + pbackfail (int_type meta) { + if(gptr() != NULL && (eback() < gptr()) + && (mode_ & (::std::ios_base::out) + || compat_traits_type::eq_int_type(compat_traits_type::eof(), meta) + || compat_traits_type::eq(compat_traits_type::to_char_type(meta), gptr()[-1]) ) ) { + streambuf_t::gbump(-1); // back one character + if(!compat_traits_type::eq_int_type(compat_traits_type::eof(), meta)) + // put-back meta into get area + *gptr() = compat_traits_type::to_char_type(meta); + return (compat_traits_type::not_eof(meta)); + } + else + return (compat_traits_type::eof()); // failed putback + } + // -end pbackfail(..) + + + template + typename basic_altstringbuf::int_type + basic_altstringbuf:: + overflow (int_type meta) { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4996) +#endif + if(compat_traits_type::eq_int_type(compat_traits_type::eof(), meta)) + return compat_traits_type::not_eof(meta); // nothing to do + else if(pptr() != NULL && pptr() < epptr()) { + streambuf_t::sputc(compat_traits_type::to_char_type(meta)); + return meta; + } + else if(! (mode_ & ::std::ios_base::out)) + // no write position, and cant make one + return compat_traits_type::eof(); + else { // make a write position available + std::size_t prev_size = pptr() == NULL ? 0 : epptr() - eback(); + std::size_t new_size = prev_size; + // exponential growth : size *= 1.5 + std::size_t add_size = new_size / 2; + if(add_size < alloc_min) + add_size = alloc_min; + Ch * newptr = NULL, *oldptr = eback(); + + // make sure adding add_size wont overflow size_t + while (0 < add_size && ((std::numeric_limits::max)() + - add_size < new_size) ) + add_size /= 2; + if(0 < add_size) { + new_size += add_size; + newptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0); + } + + if(0 < prev_size) + compat_traits_type::copy(newptr, oldptr, prev_size); + if(is_allocated_) + alloc_.deallocate(oldptr, prev_size); + is_allocated_=true; + + if(prev_size == 0) { // first allocation + putend_ = newptr; + streambuf_t::setp(newptr, newptr + new_size); + if(mode_ & ::std::ios_base::in) + streambuf_t::setg(newptr, newptr, newptr + 1); + else + streambuf_t::setg(newptr, 0, newptr); + } + else { // update pointers + putend_ = putend_ - oldptr + newptr; + int pptr_count = static_cast(pptr()-pbase()); + int gptr_count = static_cast(gptr()-eback()); + streambuf_t::setp(pbase() - oldptr + newptr, newptr + new_size); + streambuf_t::pbump(pptr_count); + if(mode_ & ::std::ios_base::in) + streambuf_t::setg(newptr, newptr + gptr_count, pptr() + 1); + else + streambuf_t::setg(newptr, 0, newptr); + } + streambuf_t::sputc(compat_traits_type::to_char_type(meta)); + return meta; + } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } + // -end overflow(..) + + template + void basic_altstringbuf:: dealloc() { + if(is_allocated_) + alloc_.deallocate(eback(), (pptr() != NULL ? epptr() : egptr()) - eback()); + is_allocated_ = false; + streambuf_t::setg(0, 0, 0); + streambuf_t::setp(0, 0); + putend_ = NULL; + } + + }// N.S. io +} // N.S. boost + +#endif // include guard + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/detail/compat_workarounds.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/compat_workarounds.hpp new file mode 100644 index 0000000000..8e51514f3e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/compat_workarounds.hpp @@ -0,0 +1,86 @@ +// ---------------------------------------------------------------------------- +// compat_workarounds : general framework for non-conformance workarounds +// ---------------------------------------------------------------------------- + +// 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 + +// ---------------------------------------------------------------------------- + + +// this file defines wrapper classes to hide non-conforming +// std::char_traits<> and std::allocator<> traits +// and Includes : config_macros.hpp (defines config macros +// and compiler-specific switches) + +// Non-conformant Std-libs fail to supply conformant traits (std::char_traits, +// std::allocator) and/or the std::string doesnt support them. +// We don't want to have hundreds of #ifdef workarounds, so we define +// replacement traits. +// But both char_traits and allocator traits are visible in the interface, +// (inside the final string type), thus we need to keep both +// the replacement type (typedefed to 'compatible_type') for real use, +// and the original stdlib type (typedef to 'type_for_string') for interface +// visibility. This is what Compat* classes do (as well as be transparent +// when good allocator and char traits are present) + +#ifndef BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP +#define BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP + +namespace boost { + namespace io { + + // gcc-2.95 char traits (non-conformantly named string_char_traits) + // lack several functions so we extend them in a replacement class. + template + class CompatTraits; + + // std::allocator in gcc-2.95 is ok, but basic_string only works + // with plain 'std::alloc' still, alt_stringbuf requires a functionnal + // alloc template argument, so we need a replacement allocator + template + class CompatAlloc; + } // N.S. io +}// N.S. boost + + +#include + // sets-up macros and load compiler-specific workarounds headers. + +#if !defined(BOOST_FORMAT_STREAMBUF_DEFINED) +// workarounds-gcc-2.95 might have defined own streambuf +#include +#endif + +#if !defined(BOOST_FORMAT_OSTREAM_DEFINED) +// workarounds-gcc-2.95 might already have included +#include +#endif + + + +namespace boost { + namespace io { + + // **** CompatTraits general definitions : ---------------------------- + template + class CompatTraits + { // general case : be transparent + public: + typedef Tr compatible_type; + }; + + // **** CompatAlloc general definitions : ----------------------------- + template + class CompatAlloc + { // general case : be transparent + public: + typedef Alloc compatible_type; + }; + + } //N.S. io +} // N.S. boost +#endif // include guard diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/detail/config_macros.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/config_macros.hpp new file mode 100644 index 0000000000..1f01b1789b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/config_macros.hpp @@ -0,0 +1,97 @@ +// -*- C++ -*- +// ---------------------------------------------------------------------------- +// config_macros.hpp : configuration macros for the format library +// only BOOST_IO_STD is absolutely needed (it should be 'std::' in general) +// others are compiler-specific workaround macros used in #ifdef switches +// ---------------------------------------------------------------------------- + +// 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_CONFIG_MACROS_HPP +#define BOOST_FORMAT_CONFIG_MACROS_HPP + +#include +#include + +// make sure our local macros wont override something : +#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \ + || defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) \ + || defined(BOOST_NO_TEMPLATE_STD_STREAM) \ + || defined(BOOST_FORMAT_STREAMBUF_DEFINED) || defined(BOOST_FORMAT_OSTREAM_DEFINED) +#error "boost::format uses a local macro that is already defined." +#endif + +// specific workarounds. each header can define BOOS_IO_STD if it +// needs. (e.g. because of IO_NEEDS_USING_DECLARATION) +#include +#include + +#ifndef BOOST_IO_STD +# define BOOST_IO_STD ::std:: +#endif + +#if defined(BOOST_NO_STD_LOCALE) || \ + ( BOOST_WORKAROUND(__BORLANDC__, <= 0x564) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) ) +// some future __BORLANDC__ >0x564 versions might not need this +// 0x570 is Borland's kylix branch +#define BOOST_NO_LOCALE_ISDIGIT +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) || BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1300)) +#define BOOST_NO_OVERLOAD_FOR_NON_CONST +#endif + +// gcc-2.95's native stringstream is not usable +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +#define BOOST_FORMAT_IGNORE_STRINGSTREAM +#endif + + +// **** Workaround for io streams, stlport and msvc. +#ifdef BOOST_IO_NEEDS_USING_DECLARATION +namespace boost { + using std::char_traits; + using std::basic_ostream; + namespace io { + using std::basic_ostream; + namespace detail { + using std::basic_ios; + using std::basic_ostream; + } + } +#if ! defined(BOOST_NO_STD_LOCALE) + using std::locale; + namespace io { + using std::locale; + namespace detail { + using std::locale; + } + } +#endif // locale +} + // -end N.S. boost +#endif // needs_using_declaration + + +// *** hide std::locale if it doesnt exist. +// this typedef is either std::locale or int, avoids placing ifdefs everywhere +namespace boost { namespace io { namespace detail { +#if ! defined(BOOST_NO_STD_LOCALE) + typedef BOOST_IO_STD locale locale_t; +#else + typedef int locale_t; +#endif +} } } + + +// ---------------------------------------------------------------------------- + +#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/detail/msvc_disambiguater.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/msvc_disambiguater.hpp new file mode 100644 index 0000000000..f12e5e97b2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/msvc_disambiguater.hpp @@ -0,0 +1,56 @@ +// ---------------------------------------------------------------------------- +// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads) +// the trick was described in boost's list by Aleksey Gurtovoy +// ---------------------------------------------------------------------------- + +// 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_MSVC_DISAMBIGUATER_HPP +#define BOOST_MSVC_DISAMBIGUATER_HPP + +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \ + BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + // this whole header is specifically for msvc up to 7.0 + +#include +#include + +namespace boost { +namespace io { +namespace detail { + +template< class Ch, class Tr, class T > +struct disambiguater +{ + template< typename U > + static void put_head(BOOST_IO_STD basic_ostream& os, group1 const& x, long) + { + os << group_head(x.a1_); + } + static void put_head(BOOST_IO_STD basic_ostream& os, T const& x, int) + { + } + template< typename U > + static void put_last(BOOST_IO_STD basic_ostream& os, group1 const& x, long) + { + os << group_last(x.a1_); + } + static void put_last(BOOST_IO_STD basic_ostream& os, T const& x, int) + { + os << x; + } +}; + +} // namespace detail +} // namespace io +} // namespace boost + +#endif // -BOOST_MSVC + +#endif // -BOOST_MSVC_DISAMBIGUATER_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/detail/unset_macros.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/unset_macros.hpp new file mode 100644 index 0000000000..b3ac47b42b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/unset_macros.hpp @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------- +// unset_macros.hpp +// ---------------------------------------------------------------------------- + +// 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 + +// ---------------------------------------------------------------------------- + +// *** Undefine 'local' macros : +#ifdef BOOST_NO_OVERLOAD_FOR_NON_CONST +#undef BOOST_NO_OVERLOAD_FOR_NON_CONST +#endif +#ifdef BOOST_NO_LOCALE_ISDIGIT +#undef BOOST_NO_LOCALE_ISDIGIT +#endif +#ifdef BOOST_IO_STD +#undef BOOST_IO_STD +#endif +#ifdef BOOST_IO_NEEDS_USING_DECLARATION +#undef BOOST_IO_NEEDS_USING_DECLARATION +#endif +#ifdef BOOST_NO_TEMPLATE_STD_STREAM +#undef BOOST_NO_TEMPLATE_STD_STREAM +#endif +#ifdef BOOST_FORMAT_STREAMBUF_DEFINED +#undef BOOST_FORMAT_STREAMBUF_DEFINED +#endif +#ifdef BOOST_FORMAT_OSTREAM_DEFINED +#undef BOOST_FORMAT_OSTREAM_DEFINED +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/detail/workarounds_gcc-2_95.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/workarounds_gcc-2_95.hpp new file mode 100644 index 0000000000..8c49d42d02 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/workarounds_gcc-2_95.hpp @@ -0,0 +1,162 @@ +// ---------------------------------------------------------------------------- +// workarounds for gcc < 3.0. +// ---------------------------------------------------------------------------- + +// 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 + + +// ---------------------------------------------------------------------------- + +// There's a lot to do, the stdlib shipped with gcc prior to 3.x +// was terribly non-conforming. +// . defines macros switches +// . supplies template classes basic_foo where gcc only supplies foo. +// i.e : +// - basic_ios from ios +// - basic_ostream from ostream +// - basic_srteambuf from streambuf +// these can be used transparently. (it obviously does not work for wchar_t) +// . specialise CompatAlloc and CompatTraits to wrap gcc-2.95's +// string_char_traits and std::alloc + +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + // only for gcc-2.95's native stdlib + +#ifndef BOOST_FORMAT_WORKAROUNDS_GCC295_H +#define BOOST_FORMAT_WORKAROUNDS_GCC295_H + +// SGI STL doesnt have and others, so we need iostream. +#include +#define BOOST_FORMAT_OSTREAM_DEFINED + +#include +#define BOOST_FORMAT_STREAMBUF_DEFINED + +#define BOOST_NO_TEMPLATE_STD_STREAM + +#ifndef BOOST_IO_STD +# define BOOST_IO_STD std:: +#endif + + + +// *** +// gcc's simple classes turned into standard-like template classes : + +namespace std { + + + // gcc has string_char_traits, it's incomplete. + // we declare a std::char_traits, and specialize CompatTraits<..> on it + // to do what is required + template + class char_traits; // no definition here, we will just use it as a tag. + + template + class basic_streambuf; + + template + class basic_streambuf : public streambuf { + }; + + template > + class basic_ios; + + template + class basic_ios : public ostream { + public: + basic_ios(streambuf * p) : ostream(p) {}; + char fill() const { return ios::fill(); } // gcc returns wchar.. + char fill(char c) { return ios::fill(c); } // gcc takes wchar.. + char widen(char c) { return c; } + char narrow(char c, char def) { return c; } + basic_ios& copyfmt(const ios& right) { + fill(right.fill()); + flags(right.flags() ); + exceptions(right.exceptions()); + width(right.width()); + precision(right.precision()); + return *this; + } + }; + + + typedef ios ios_base; + + template + class basic_ostream; + + template + class basic_ostream : public basic_ios + { + public: + basic_ostream(streambuf * p) : basic_ios (p) {} + }; + +} // namespace std + + +namespace boost { + namespace io { + + + // ** CompatTraits gcc2.95 specialisations ---------------------------- + template + class CompatTraits< ::std::string_char_traits > + : public ::std::string_char_traits + { + public: + typedef CompatTraits compatible_type; + + typedef Ch char_type; + typedef int int_type; + typedef ::std::streampos pos_type; + typedef ::std::streamoff off_type; + + static char_type + to_char_type(const int_type& meta) { + return static_cast(meta); } + static int_type + to_int_type(const char_type& ch) { + return static_cast(static_cast(ch) );} + static bool + eq_int_type(const int_type& left, const int_type& right) { + return left == right; } + static int_type + eof() { + return static_cast(EOF); + } + static int_type + not_eof(const int_type& meta) { + return (meta == eof()) ? 0 : meta; + } + }; + + template + class CompatTraits< ::std::char_traits > { + public: + typedef CompatTraits< ::std::string_char_traits > compatible_type; + }; + + // ** CompatAlloc gcc-2.95 specialisations --------------------------- + template<> + class CompatAlloc< ::std::alloc> + { + public: + typedef ::std::allocator compatible_type; + }; + + } // N.S. io +} // N.S. boost + + + + + +#endif // include guard + +#endif // if workaround diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/detail/workarounds_stlport.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/workarounds_stlport.hpp new file mode 100644 index 0000000000..eb35dc1708 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/detail/workarounds_stlport.hpp @@ -0,0 +1,42 @@ +// ---------------------------------------------------------------------------- +// workarounds_stlport.hpp : workaround STLport issues +// ---------------------------------------------------------------------------- + +// 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_MACROS_STLPORT_HPP +#define BOOST_MACROS_STLPORT_HPP + +#if defined(_STLPORT_VERSION) && BOOST_WORKAROUND( BOOST_MSVC, <= 1300) +// msvc-6-stlport fails to find basic_string::append( iterator, iterator) when linking +// might affect other MSwindows compilers +#define BOOST_NO_STRING_APPEND +#endif + +// *** This should go to "boost/config/stdlib/stlport.hpp". + +// If the streams are not native and there are problems with using templates +// accross namespaces, we define some macros to enable a workaround for this. + +// STLport 4.5 +#if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) +# define BOOST_IO_STD +# define BOOST_IO_NEEDS_USING_DECLARATION +#endif + +// STLport 4.0 +#if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_OWN_NAMESPACE) && defined(BOOST_NO_USING_TEMPLATE) +# define BOOST_IO_STD +# define BOOST_IO_NEEDS_USING_DECLARATION +#endif + + +// ---------------------------------------------------------------------------- + +#endif // BOOST_MACROS_STLPORT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/exceptions.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/exceptions.hpp new file mode 100644 index 0000000000..9b2de834cf --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/exceptions.hpp @@ -0,0 +1,103 @@ +// ---------------------------------------------------------------------------- +// boost/format/exceptions.hpp +// ---------------------------------------------------------------------------- + +// Copyright Samuel Krempp 2003. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// See http://www.boost.org/libs/format/ for library home page + +// ---------------------------------------------------------------------------- + +#ifndef BOOST_FORMAT_EXCEPTIONS_HPP +#define BOOST_FORMAT_EXCEPTIONS_HPP + + +#include + + +namespace boost { + + namespace io { + +// **** exceptions ----------------------------------------------- + + class format_error : public std::exception + { + public: + format_error() {} + virtual const char *what() const throw() { + return "boost::format_error: " + "format generic failure"; + } + }; + + class bad_format_string : public format_error + { + std::size_t pos_, next_; + public: + bad_format_string(std::size_t pos, std::size_t size) + : pos_(pos), next_(size) {} + std::size_t get_pos() const { return pos_; } + std::size_t get_next() const { return next_; } + virtual const char *what() const throw() { + return "boost::bad_format_string: format-string is ill-formed"; + } + }; + + class too_few_args : public format_error + { + std::size_t cur_, expected_; + public: + too_few_args(std::size_t cur, std::size_t expected) + : cur_(cur), expected_(expected) {} + std::size_t get_cur() const { return cur_; } + std::size_t get_expected() const { return expected_; } + virtual const char *what() const throw() { + return "boost::too_few_args: " + "format-string referred to more arguments than were passed"; + } + }; + + class too_many_args : public format_error + { + std::size_t cur_, expected_; + public: + too_many_args(std::size_t cur, std::size_t expected) + : cur_(cur), expected_(expected) {} + std::size_t get_cur() const { return cur_; } + std::size_t get_expected() const { return expected_; } + virtual const char *what() const throw() { + return "boost::too_many_args: " + "format-string referred to less arguments than were passed"; + } + }; + + + class out_of_range : public format_error + { + int index_, beg_, end_; // range is [ beg, end [ + public: + out_of_range(int index, int beg, int end) + : index_(index), beg_(beg), end_(end) {} + int get_index() const { return index_; } + int get_beg() const { return beg_; } + int get_end() const { return end_; } + virtual const char *what() const throw() { + return "boost::out_of_range: " + "tried to refer to an argument (or item) number which" + " is out of range, according to the format string"; + } + }; + + + } // namespace io + +} // namespace boost + + +#endif // BOOST_FORMAT_EXCEPTIONS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/feed_args.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/feed_args.hpp new file mode 100644 index 0000000000..53243dccc8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/feed_args.hpp @@ -0,0 +1,277 @@ +// ---------------------------------------------------------------------------- +// feed_args.hpp : functions for processing each argument +// (feed, feed_manip, and distribute) +// ---------------------------------------------------------------------------- + +// 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_FEED_ARGS_HPP +#define BOOST_FORMAT_FEED_ARGS_HPP + +#include +#include +#include + +#include +#include +#include + +namespace boost { +namespace io { +namespace detail { + + template + void mk_str( std::basic_string & res, + const Ch * beg, + typename std::basic_string::size_type size, + std::streamsize w, + const Ch fill_char, + std::ios_base::fmtflags f, + const Ch prefix_space, // 0 if no space-padding + bool center) + // applies centered/left/right padding to the string [beg, beg+size[ + // Effects : the result is placed in res. + { + typedef typename std::basic_string::size_type size_type; + res.resize(0); + if(w<=0 || static_cast(w) <=size) { + // no need to pad. + res.reserve(size + !!prefix_space); + if(prefix_space) + res.append(1, prefix_space); + if (size) + res.append(beg, size); + } + else { + std::streamsize n=static_cast(w-size-!!prefix_space); + std::streamsize n_after = 0, n_before = 0; + res.reserve(static_cast(w)); // allocate once for the 2 inserts + if(center) + n_after = n/2, n_before = n - n_after; + else + if(f & std::ios_base::left) + n_after = n; + else + n_before = n; + // now make the res string : + if(n_before) res.append(static_cast(n_before), fill_char); + if(prefix_space) + res.append(1, prefix_space); + if (size) + res.append(beg, size); + if(n_after) res.append(static_cast(n_after), fill_char); + } + } // -mk_str(..) + + +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \ + BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) +// MSVC needs to be tricked to disambiguate this simple overload.. +// the trick is in "boost/format/msvc_disambiguater.hpp" + + template< class Ch, class Tr, class T> inline + void put_head (BOOST_IO_STD basic_ostream & os, const T& x ) { + disambiguater::put_head(os, x, 1L); + } + template< class Ch, class Tr, class T> inline + void put_last (BOOST_IO_STD basic_ostream & os, const T& x ) { + disambiguater::put_last(os, x, 1L); + } + +#else + + template< class Ch, class Tr, class T> inline + void put_head (BOOST_IO_STD basic_ostream &, const T& ) { + } + + template< class Ch, class Tr, class T> inline + void put_head( BOOST_IO_STD basic_ostream & os, const group1& x ) { + os << group_head(x.a1_); // send the first N-1 items, not the last + } + + template< class Ch, class Tr, class T> inline + void put_last( BOOST_IO_STD basic_ostream & os, const T& x ) { + os << x ; + } + + template< class Ch, class Tr, class T> inline + void put_last( BOOST_IO_STD basic_ostream & os, const group1& x ) { + os << group_last(x.a1_); // this selects the last element + } + +#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST + template< class Ch, class Tr, class T> inline + void put_head( BOOST_IO_STD basic_ostream &, T& ) { + } + + template< class Ch, class Tr, class T> inline + void put_last( BOOST_IO_STD basic_ostream & os, T& x) { + os << x ; + } +#endif +#endif // -msvc workaround + + + template< class Ch, class Tr, class Alloc, class T> + void put( T x, + const format_item& specs, + typename basic_format::string_type& res, + typename basic_format::internal_streambuf_t & buf, + io::detail::locale_t *loc_p = NULL) + { +#ifdef BOOST_MSVC + // If std::min or std::max 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 + // does the actual conversion of x, with given params, into a string + // using the supplied stringbuf. + + typedef typename basic_format::string_type string_type; + typedef typename basic_format::format_item_t format_item_t; + typedef typename string_type::size_type size_type; + + basic_oaltstringstream oss( &buf); + specs.fmtstate_.apply_on(oss, loc_p); + + // the stream format state can be modified by manipulators in the argument : + put_head( oss, x ); + // in case x is a group, apply the manip part of it, + // in order to find width + + const std::ios_base::fmtflags fl=oss.flags(); + const bool internal = (fl & std::ios_base::internal) != 0; + const std::streamsize w = oss.width(); + const bool two_stepped_padding= internal && (w!=0); + + res.resize(0); + if(! two_stepped_padding) { + if(w>0) // handle padding via mk_str, not natively in stream + oss.width(0); + put_last( oss, x); + const Ch * res_beg = buf.pbase(); + Ch prefix_space = 0; + if(specs.pad_scheme_ & format_item_t::spacepad) + if(buf.pcount()== 0 || + (res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') )) + prefix_space = oss.widen(' '); + size_type res_size = (std::min)( + static_cast(specs.truncate_ - !!prefix_space), + buf.pcount() ); + mk_str(res, res_beg, res_size, w, oss.fill(), fl, + prefix_space, (specs.pad_scheme_ & format_item_t::centered) !=0 ); + } + else { // 2-stepped padding + // internal can be implied by zeropad, or user-set. + // left, right, and centered alignment overrule internal, + // but spacepad or truncate might be mixed with internal (using manipulator) + put_last( oss, x); // may pad + const Ch * res_beg = buf.pbase(); + size_type res_size = buf.pcount(); + bool prefix_space=false; + if(specs.pad_scheme_ & format_item_t::spacepad) + if(buf.pcount()== 0 || + (res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') )) + prefix_space = true; + if(res_size == static_cast(w) && w<=specs.truncate_ && !prefix_space) { + // okay, only one thing was printed and padded, so res is fine + res.assign(res_beg, res_size); + } + else { // length w exceeded + // either it was multi-output with first output padding up all width.. + // either it was one big arg and we are fine. + // Note that res_size oss2( &buf); + specs.fmtstate_.apply_on(oss2, loc_p); + put_head( oss2, x ); + + oss2.width(0); + if(prefix_space) + oss2 << ' '; + put_last(oss2, x ); + if(buf.pcount()==0 && specs.pad_scheme_ & format_item_t::spacepad) { + prefix_space =true; + oss2 << ' '; + } + // we now have the minimal-length output + const Ch * tmp_beg = buf.pbase(); + size_type tmp_size = (std::min)(static_cast(specs.truncate_), + buf.pcount() ); + + + if(static_cast(w) <= tmp_size) { + // minimal length is already >= w, so no padding (cool!) + res.assign(tmp_beg, tmp_size); + } + else { // hum.. we need to pad (multi_output, or spacepad present) + //find where we should pad + size_type sz = (std::min)(res_size + (prefix_space ? 1 : 0), tmp_size); + size_type i = prefix_space; + for(; i=tmp_size) i=prefix_space; + res.assign(tmp_beg, i); + std::streamsize d = w - static_cast(tmp_size); + BOOST_ASSERT(d>0); + res.append(static_cast( d ), oss2.fill()); + res.append(tmp_beg+i, tmp_size-i); + BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0) + == static_cast(w)); + BOOST_ASSERT(res.size() == static_cast(w)); + } + } + } + buf.clear_buffer(); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } // end- put(..) + + + template< class Ch, class Tr, class Alloc, class T> + void distribute (basic_format& self, T x) { + // call put(x, ..) on every occurence of the current argument : + if(self.cur_arg_ >= self.num_args_) { + if( self.exceptions() & too_many_args_bit ) + boost::throw_exception(too_many_args(self.cur_arg_, self.num_args_)); + else return; + } + for(unsigned long i=0; i < self.items_.size(); ++i) { + if(self.items_[i].argN_ == self.cur_arg_) { + put (x, self.items_[i], self.items_[i].res_, + self.buf_, boost::get_pointer(self.loc_) ); + } + } + } + + template + basic_format& + feed (basic_format& self, T x) { + if(self.dumped_) self.clear(); + distribute (self, x); + ++self.cur_arg_; + if(self.bound_.size() != 0) { + while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] ) + ++self.cur_arg_; + } + return self; + } + +} // namespace detail +} // namespace io +} // namespace boost + + +#endif // BOOST_FORMAT_FEED_ARGS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/format_class.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/format_class.hpp new file mode 100644 index 0000000000..d776d95146 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/format_class.hpp @@ -0,0 +1,143 @@ +// ---------------------------------------------------------------------------- +// format_class.hpp : class interface +// ---------------------------------------------------------------------------- + +// 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_CLASS_HPP +#define BOOST_FORMAT_CLASS_HPP + + +#include +#include + +#include // to store locale when needed + +#include +#include +#include +#include + +namespace boost { + + template + class basic_format + { + typedef typename io::CompatTraits::compatible_type compat_traits; + public: + typedef Ch CharT; // borland fails in operator% if we use Ch and Tr directly + typedef std::basic_string string_type; + typedef typename string_type::size_type size_type; + typedef io::detail::format_item format_item_t; + typedef io::basic_altstringbuf internal_streambuf_t; + + + explicit basic_format(const Ch* str=NULL); + explicit basic_format(const string_type& s); + basic_format(const basic_format& x); + basic_format& operator= (const basic_format& x); + void swap(basic_format& x); + +#if !defined(BOOST_NO_STD_LOCALE) + explicit basic_format(const Ch* str, const std::locale & loc); + explicit basic_format(const string_type& s, const std::locale & loc); +#endif + io::detail::locale_t getloc() const; + + basic_format& clear(); // empty all converted string buffers (except bound items) + basic_format& clear_binds(); // unbind all bound items, and call clear() + basic_format& parse(const string_type&); // resets buffers and parse a new format string + + // ** formatted result ** // + size_type size() const; // sum of the current string pieces sizes + string_type str() const; // final string + + // ** arguments passing ** // + template + basic_format& operator%(const T& x) + { return io::detail::feed(*this,x); } + +#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST + template basic_format& operator%(T& x) + { return io::detail::feed(*this,x); } +#endif + + // ** object modifying **// + template + basic_format& bind_arg(int argN, const T& val) + { return io::detail::bind_arg_body(*this, argN, val); } + basic_format& clear_bind(int argN); + template + basic_format& modify_item(int itemN, T manipulator) + { return io::detail::modify_item_body (*this, itemN, manipulator);} + + // Choosing which errors will throw exceptions : + unsigned char exceptions() const; + unsigned char exceptions(unsigned char newexcept); + +#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) \ + && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \ + && !BOOST_WORKAROUND( _CRAYC, != 0) \ + && !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + // use friend templates and private members only if supported + +#ifndef BOOST_NO_TEMPLATE_STD_STREAM + template + friend std::basic_ostream & + operator<<( std::basic_ostream & , + const basic_format& ); +#else + template + friend std::ostream & + operator<<( std::ostream & , + const basic_format& ); +#endif + + template + friend basic_format& + io::detail::feed (basic_format&, T); + + template friend + void io::detail::distribute (basic_format&, T); + + template friend + basic_format& + io::detail::modify_item_body (basic_format&, int, T); + + template friend + basic_format& + io::detail::bind_arg_body (basic_format&, int, const T&); + + private: +#endif + typedef io::detail::stream_format_state stream_format_state; + // flag bits, used for style_ + enum style_values { ordered = 1, // set only if all directives are positional + special_needs = 4 }; + + void make_or_reuse_data(std::size_t nbitems);// used for (re-)initialisation + + // member data --------------------------------------------// + std::vector items_; // each '%..' directive leads to a format_item + std::vector bound_; // stores which arguments were bound. size() == 0 || num_args + + int style_; // style of format-string : positional or not, etc + int cur_arg_; // keep track of wich argument is current + int num_args_; // number of expected arguments + mutable bool dumped_; // true only after call to str() or << + string_type prefix_; // piece of string to insert before first item + unsigned char exceptions_; + internal_streambuf_t buf_; // the internal stream buffer. + boost::optional loc_; + }; // class basic_format + +} // namespace boost + + +#endif // BOOST_FORMAT_CLASS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/format_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/format_fwd.hpp new file mode 100644 index 0000000000..be3228af3c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/format_fwd.hpp @@ -0,0 +1,49 @@ +// ---------------------------------------------------------------------------- +// format_fwd.hpp : forward declarations +// ---------------------------------------------------------------------------- + +// 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_FWD_HPP +#define BOOST_FORMAT_FWD_HPP + +#include +#include + +#include + +namespace boost { + + template , class Alloc = std::allocator > +#else + class Tr = std::string_char_traits, class Alloc = std::alloc > +#endif + class basic_format; + + typedef basic_format format; + +#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF) \ + && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM) + typedef basic_format wformat; +#endif + + namespace io { + enum format_error_bits { bad_format_string_bit = 1, + too_few_args_bit = 2, too_many_args_bit = 4, + out_of_range_bit = 8, + all_error_bits = 255, no_error_bits=0 }; + + } // namespace io + +} // namespace boost + +#endif // BOOST_FORMAT_FWD_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/format_implementation.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/format_implementation.hpp new file mode 100644 index 0000000000..28300e579f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/format_implementation.hpp @@ -0,0 +1,288 @@ +// ---------------------------------------------------------------------------- +// 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 +#include +#include +#include +#include // std::swap + +namespace boost { + +// --- basic_format implementation -----------------------------------------// + + template< class Ch, class Tr, class Alloc> + basic_format:: 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:: basic_format(const Ch* s, const std::locale & loc) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + loc_(loc), exceptions_(io::all_error_bits) + { + if(s) parse( s ); + } + + template< class Ch, class Tr, class Alloc> + basic_format:: basic_format(const string_type& s, const std::locale & loc) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + loc_(loc), exceptions_(io::all_error_bits) + { + parse(s); + } +#endif // ! BOOST_NO_STD_LOCALE + template< class Ch, class Tr, class Alloc> + io::detail::locale_t basic_format:: + getloc() const { + return loc_ ? loc_.get() : io::detail::locale_t(); + } + + template< class Ch, class Tr, class Alloc> + basic_format:: 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:: 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_(false), + 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& basic_format:: + operator= (const basic_format& x) { + if(this == &x) + return *this; + (basic_format(x)).swap(*this); + return *this; + } + template< class Ch, class Tr, class Alloc> + void basic_format:: + 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:: exceptions() const { + return exceptions_; + } + + template< class Ch, class Tr, class Alloc> + unsigned char basic_format:: exceptions(unsigned char newexcept) { + unsigned char swp = exceptions_; + exceptions_ = newexcept; + return swp; + } + + template + void basic_format:: + make_or_reuse_data (std::size_t nbitems) { +#if !defined(BOOST_NO_STD_LOCALE) + Ch fill = ( BOOST_USE_FACET(std::ctype, 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& basic_format:: + 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(bound_.size()) ); + + for(unsigned long i=0; i + basic_format& basic_format:: + clear_binds () { + // remove all binds, then clear() + bound_.resize(0); + clear(); + return *this; + } + + template< class Ch, class Tr, class Alloc> + basic_format& basic_format:: + 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> + typename basic_format::string_type + basic_format:: + 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(item.fmtstate_.width_) > res.size() ) + res.append( static_cast(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::size_type basic_format:: + size () const { +#ifdef BOOST_MSVC + // If std::min or std::max 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(item.fmtstate_.width_) ); + sz += item.appendix_.size(); + } + return sz; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } + +namespace io { +namespace detail { + + template + basic_format& + bind_arg_body (basic_format& 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(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 a non-binded arg : + BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]); + return self; + } + + template basic_format& + modify_item_body (basic_format& 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(self.items_.size() )) { + if( self.exceptions() & io::out_of_range_bit ) + boost::throw_exception(io::out_of_range(itemN, 1, static_cast(self.items_.size()) )); + else return self; + } + self.items_[itemN-1].fmtstate_. template apply_manip ( manipulator ); + return self; + } + +} // namespace detail +} // namespace io +} // namespace boost + + + +#endif // BOOST_FORMAT_IMPLEMENTATION_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/free_funcs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/free_funcs.hpp new file mode 100644 index 0000000000..3a51545526 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/free_funcs.hpp @@ -0,0 +1,70 @@ +// ---------------------------------------------------------------------------- +// free_funcs.hpp : implementation of the free functions of boost::format +// ---------------------------------------------------------------------------- + +// 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_FUNCS_HPP +#define BOOST_FORMAT_FUNCS_HPP + +#include +#include + +namespace boost { + + template inline + std::basic_string str(const basic_format& f) { + // adds up all pieces of strings and converted items, and return the formatted string + return f.str(); + } + namespace io { + using ::boost::str; // keep compatibility with when it was defined in this N.S. + } // - namespace io + +#ifndef BOOST_NO_TEMPLATE_STD_STREAM + template + std::basic_ostream & + operator<<( std::basic_ostream & os, + const basic_format& f) +#else + template + std::ostream & + operator<<( std::ostream & os, + const basic_format& f) +#endif + // effect: "return os << str(f);" but we can do it faster + { + typedef boost::basic_format format_t; + if(f.items_.size()==0) + os << f.prefix_; + else { + if(f.cur_arg_ < f.num_args_) + if( f.exceptions() & io::too_few_args_bit ) + // not enough variables supplied + boost::throw_exception(io::too_few_args(f.cur_arg_, f.num_args_)); + if(f.style_ & format_t::special_needs) + os << f.str(); + else { + // else we dont have to count chars output, so we dump directly to os : + os << f.prefix_; + for(unsigned long i=0; i + + +namespace boost { +namespace io { + + +namespace detail { + + +// empty group, but useful even though. +struct group0 +{ + group0() {} +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << ( BOOST_IO_STD basic_ostream& os, + const group0& ) +{ + return os; +} + +template +struct group1 +{ + T1 a1_; + group1(T1 a1) + : a1_(a1) + {} +private: + group1& operator=(const group1&); +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group1& x) +{ + os << x.a1_; + return os; +} + + + + +template +struct group2 +{ + T1 a1_; + T2 a2_; + group2(T1 a1,T2 a2) + : a1_(a1),a2_(a2) + {} +private: + group2& operator=(const group2&); +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group2& x) +{ + os << x.a1_<< x.a2_; + return os; +} + +template +struct group3 +{ + T1 a1_; + T2 a2_; + T3 a3_; + group3(T1 a1,T2 a2,T3 a3) + : a1_(a1),a2_(a2),a3_(a3) + {} +private: + group3& operator=(const group3&); +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group3& x) +{ + os << x.a1_<< x.a2_<< x.a3_; + return os; +} + +template +struct group4 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + group4(T1 a1,T2 a2,T3 a3,T4 a4) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4) + {} +private: + group4& operator=(const group4&); +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group4& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_; + return os; +} + +template +struct group5 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + group5(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5) + {} +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group5& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_; + return os; +} + +template +struct group6 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + group6(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6) + {} +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group6& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_; + return os; +} + +template +struct group7 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + group7(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7) + {} +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group7& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_; + return os; +} + +template +struct group8 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + T8 a8_; + group8(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8) + {} +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group8& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_; + return os; +} + +template +struct group9 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + T8 a8_; + T9 a9_; + group9(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9) + {} +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group9& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_; + return os; +} + +template +struct group10 +{ + T1 a1_; + T2 a2_; + T3 a3_; + T4 a4_; + T5 a5_; + T6 a6_; + T7 a7_; + T8 a8_; + T9 a9_; + T10 a10_; + group10(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9,T10 a10) + : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9),a10_(a10) + {} +}; + +template +inline +BOOST_IO_STD basic_ostream& +operator << (BOOST_IO_STD basic_ostream& os, + const group10& x) +{ + os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_<< x.a10_; + return os; +} + + + + +template +inline +group1 +group_head( group2 const& x) +{ + return group1 (x.a1_); +} + +template +inline +group1 +group_last( group2 const& x) +{ + return group1 (x.a2_); +} + + + +template +inline +group2 +group_head( group3 const& x) +{ + return group2 (x.a1_,x.a2_); +} + +template +inline +group1 +group_last( group3 const& x) +{ + return group1 (x.a3_); +} + + + +template +inline +group3 +group_head( group4 const& x) +{ + return group3 (x.a1_,x.a2_,x.a3_); +} + +template +inline +group1 +group_last( group4 const& x) +{ + return group1 (x.a4_); +} + + + +template +inline +group4 +group_head( group5 const& x) +{ + return group4 (x.a1_,x.a2_,x.a3_,x.a4_); +} + +template +inline +group1 +group_last( group5 const& x) +{ + return group1 (x.a5_); +} + + + +template +inline +group5 +group_head( group6 const& x) +{ + return group5 (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_); +} + +template +inline +group1 +group_last( group6 const& x) +{ + return group1 (x.a6_); +} + + + +template +inline +group6 +group_head( group7 const& x) +{ + return group6 (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_); +} + +template +inline +group1 +group_last( group7 const& x) +{ + return group1 (x.a7_); +} + + + +template +inline +group7 +group_head( group8 const& x) +{ + return group7 (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_); +} + +template +inline +group1 +group_last( group8 const& x) +{ + return group1 (x.a8_); +} + + + +template +inline +group8 +group_head( group9 const& x) +{ + return group8 (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_,x.a8_); +} + +template +inline +group1 +group_last( group9 const& x) +{ + return group1 (x.a9_); +} + + + +template +inline +group9 +group_head( group10 const& x) +{ + return group9 (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_,x.a8_,x.a9_); +} + +template +inline +group1 +group_last( group10 const& x) +{ + return group1 (x.a10_); +} + + + + + +} // namespace detail + + + +// helper functions + + +inline detail::group1< detail::group0 > +group() { return detail::group1< detail::group0 > ( detail::group0() ); } + +template +inline +detail::group1< detail::group2 > + group(T1 a1, Var const& var) +{ + return detail::group1< detail::group2 > + ( detail::group2 + (a1, var) + ); +} + +template +inline +detail::group1< detail::group3 > + group(T1 a1,T2 a2, Var const& var) +{ + return detail::group1< detail::group3 > + ( detail::group3 + (a1,a2, var) + ); +} + +template +inline +detail::group1< detail::group4 > + group(T1 a1,T2 a2,T3 a3, Var const& var) +{ + return detail::group1< detail::group4 > + ( detail::group4 + (a1,a2,a3, var) + ); +} + +template +inline +detail::group1< detail::group5 > + group(T1 a1,T2 a2,T3 a3,T4 a4, Var const& var) +{ + return detail::group1< detail::group5 > + ( detail::group5 + (a1,a2,a3,a4, var) + ); +} + +template +inline +detail::group1< detail::group6 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var const& var) +{ + return detail::group1< detail::group6 > + ( detail::group6 + (a1,a2,a3,a4,a5, var) + ); +} + +template +inline +detail::group1< detail::group7 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var const& var) +{ + return detail::group1< detail::group7 > + ( detail::group7 + (a1,a2,a3,a4,a5,a6, var) + ); +} + +template +inline +detail::group1< detail::group8 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var const& var) +{ + return detail::group1< detail::group8 > + ( detail::group8 + (a1,a2,a3,a4,a5,a6,a7, var) + ); +} + +template +inline +detail::group1< detail::group9 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var const& var) +{ + return detail::group1< detail::group9 > + ( detail::group9 + (a1,a2,a3,a4,a5,a6,a7,a8, var) + ); +} + +template +inline +detail::group1< detail::group10 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var const& var) +{ + return detail::group1< detail::group10 > + ( detail::group10 + (a1,a2,a3,a4,a5,a6,a7,a8,a9, var) + ); +} + + +#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST + +template +inline +detail::group1< detail::group2 > + group(T1 a1, Var& var) +{ + return detail::group1< detail::group2 > + ( detail::group2 + (a1, var) + ); +} + +template +inline +detail::group1< detail::group3 > + group(T1 a1,T2 a2, Var& var) +{ + return detail::group1< detail::group3 > + ( detail::group3 + (a1,a2, var) + ); +} + +template +inline +detail::group1< detail::group4 > + group(T1 a1,T2 a2,T3 a3, Var& var) +{ + return detail::group1< detail::group4 > + ( detail::group4 + (a1,a2,a3, var) + ); +} + +template +inline +detail::group1< detail::group5 > + group(T1 a1,T2 a2,T3 a3,T4 a4, Var& var) +{ + return detail::group1< detail::group5 > + ( detail::group5 + (a1,a2,a3,a4, var) + ); +} + +template +inline +detail::group1< detail::group6 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var& var) +{ + return detail::group1< detail::group6 > + ( detail::group6 + (a1,a2,a3,a4,a5, var) + ); +} + +template +inline +detail::group1< detail::group7 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var& var) +{ + return detail::group1< detail::group7 > + ( detail::group7 + (a1,a2,a3,a4,a5,a6, var) + ); +} + +template +inline +detail::group1< detail::group8 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var& var) +{ + return detail::group1< detail::group8 > + ( detail::group8 + (a1,a2,a3,a4,a5,a6,a7, var) + ); +} + +template +inline +detail::group1< detail::group9 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var& var) +{ + return detail::group1< detail::group9 > + ( detail::group9 + (a1,a2,a3,a4,a5,a6,a7,a8, var) + ); +} + +template +inline +detail::group1< detail::group10 > + group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var& var) +{ + return detail::group1< detail::group10 > + ( detail::group10 + (a1,a2,a3,a4,a5,a6,a7,a8,a9, var) + ); +} + + +#endif // - BOOST_NO_OVERLOAD_FOR_NON_CONST + + +} // namespace io + +} // namespace boost + + +#endif // BOOST_FORMAT_GROUP_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/internals.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/internals.hpp new file mode 100644 index 0000000000..c1e824c75a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/internals.hpp @@ -0,0 +1,201 @@ +// ---------------------------------------------------------------------------- +// internals.hpp : internal structs : stream_format_state, format_item. +// included by format.hpp +// ---------------------------------------------------------------------------- + +// 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_INTERNALS_HPP +#define BOOST_FORMAT_INTERNALS_HPP + + +#include +#include +#include +#include +#include +#include // used as a dummy stream + +namespace boost { +namespace io { +namespace detail { + + +//---- stream_format_state --------------------------------------------------// + +// set of params that define the format state of a stream + template + struct stream_format_state + { + typedef BOOST_IO_STD basic_ios basic_ios; + + stream_format_state(Ch fill) { reset(fill); } +// stream_format_state(const basic_ios& os) { set_by_stream(os); } + + void reset(Ch fill); //- sets to default state. + void set_by_stream(const basic_ios& os); //- sets to os's state. + void apply_on(basic_ios & os, //- applies format_state to the stream + boost::io::detail::locale_t * loc_default = 0) const; + template + void apply_manip(T manipulator) //- modifies state by applying manipulator + { apply_manip_body( *this, manipulator) ; } + + // --- data --- + std::streamsize width_; + std::streamsize precision_; + Ch fill_; + std::ios_base::fmtflags flags_; + std::ios_base::iostate rdstate_; + std::ios_base::iostate exceptions_; + boost::optional loc_; + }; + + +//---- format_item ---------------------------------------------------------// + +// stores all parameters that can be specified in format strings + template + struct format_item + { + enum pad_values { zeropad = 1, spacepad =2, centered=4, tabulation = 8 }; + // 1. if zeropad is set, all other bits are not, + // 2. if tabulation is set, all others are not. + // centered and spacepad can be mixed freely. + enum arg_values { argN_no_posit = -1, // non-positional directive. will set argN later + argN_tabulation = -2, // tabulation directive. (no argument read) + argN_ignored = -3 // ignored directive. (no argument read) + }; + typedef BOOST_IO_STD basic_ios basic_ios; + typedef detail::stream_format_state stream_format_state; + typedef ::std::basic_string string_type; + + format_item(Ch fill) :argN_(argN_no_posit), fmtstate_(fill), + truncate_(max_streamsize()), pad_scheme_(0) {} + void reset(Ch fill); + void compute_states(); // sets states according to truncate and pad_scheme. + + static std::streamsize max_streamsize() { + return (std::numeric_limits::max)(); + } + + // --- data --- + int argN_; //- argument number (starts at 0, eg : %1 => argN=0) + // negative values for items that don't process an argument + string_type res_; //- result of the formatting of this item + string_type appendix_; //- piece of string between this item and the next + + stream_format_state fmtstate_;// set by parsing, is only affected by modify_item + + std::streamsize truncate_;//- is set for directives like %.5s that ask truncation + unsigned int pad_scheme_;//- several possible padding schemes can mix. see pad_values + }; + + + +//--- Definitions ------------------------------------------------------------ + +// - stream_format_state:: ------------------------------------------------- + template + void stream_format_state:: apply_on (basic_ios & os, + boost::io::detail::locale_t * loc_default) const { + // set the state of this stream according to our params + if(width_ != -1) + os.width(width_); + if(precision_ != -1) + os.precision(precision_); + if(fill_ != 0) + os.fill(fill_); + os.flags(flags_); + os.clear(rdstate_); + os.exceptions(exceptions_); +#if !defined(BOOST_NO_STD_LOCALE) + if(loc_) + os.imbue(loc_.get()); + else if(loc_default) + os.imbue(*loc_default); +#else + (void) loc_default; // keep compiler quiet if we don't support locales +#endif + } + + template + void stream_format_state:: set_by_stream(const basic_ios& os) { + // set our params according to the state of this stream + flags_ = os.flags(); + width_ = os.width(); + precision_ = os.precision(); + fill_ = os.fill(); + rdstate_ = os.rdstate(); + exceptions_ = os.exceptions(); + } + + + template + void apply_manip_body( stream_format_state& self, + T manipulator) { + // modify our params according to the manipulator + basic_oaltstringstream ss; + self.apply_on( ss ); + ss << manipulator; + self.set_by_stream( ss ); + } + + template inline + void stream_format_state:: reset(Ch fill) { + // set our params to standard's default state. cf § 27.4.4.1 of the C++ norm + width_=0; precision_=6; + fill_=fill; // default is widen(' '), but we cant compute it without the locale + flags_ = std::ios_base::dec | std::ios_base::skipws; + // the adjust_field part is left equal to 0, which means right. + exceptions_ = std::ios_base::goodbit; + rdstate_ = std::ios_base::goodbit; + } + + +// --- format_item:: -------------------------------------------------------- + + template + void format_item:: + reset (Ch fill) { + argN_=argN_no_posit; truncate_ = max_streamsize(); pad_scheme_ =0; + res_.resize(0); appendix_.resize(0); + fmtstate_.reset(fill); + } + + template + void format_item:: + compute_states() { + // reflect pad_scheme_ on fmt_state_ + // because some pad_schemes has complex consequences on several state params. + if(pad_scheme_ & zeropad) { + // ignore zeropad in left alignment : + if(fmtstate_.flags_ & std::ios_base::left) { + BOOST_ASSERT(!(fmtstate_.flags_ &(std::ios_base::adjustfield ^std::ios_base::left))); + // only left bit might be set. (not right, nor internal) + pad_scheme_ = pad_scheme_ & (~zeropad); + } + else { + pad_scheme_ &= ~spacepad; // printf ignores spacepad when zeropadding + fmtstate_.fill_='0'; + fmtstate_.flags_ = (fmtstate_.flags_ & ~std::ios_base::adjustfield) + | std::ios_base::internal; + // removes all adjustfield bits, and adds internal. + } + } + if(pad_scheme_ & spacepad) { + if(fmtstate_.flags_ & std::ios_base::showpos) + pad_scheme_ &= ~spacepad; + } + } + + +} } } // namespaces boost :: io :: detail + + +#endif // BOOST_FORMAT_INTERNALS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/internals_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/internals_fwd.hpp new file mode 100644 index 0000000000..e44eb3c132 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/internals_fwd.hpp @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------- +// internals_fwd.hpp : forward declarations, for internal headers +// ---------------------------------------------------------------------------- + +// 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_INTERNAL_FWD_HPP +#define BOOST_FORMAT_INTERNAL_FWD_HPP + +#include +#include + + +namespace boost { +namespace io { + +namespace detail { + template struct stream_format_state; + template struct format_item; + + + // these functions were intended as methods, + // but MSVC have problems with template member functions : + // defined in format_implementation.hpp : + template + basic_format& + modify_item_body (basic_format& self, + int itemN, T manipulator); + + template + basic_format& + bind_arg_body (basic_format& self, + int argN, const T& val); + + // in internals.hpp : + template + void apply_manip_body (stream_format_state& self, + T manipulator); + + // argument feeding (defined in feed_args.hpp ) : + template + void distribute (basic_format& self, T x); + + template + basic_format& + feed (basic_format& self, T x); + +} // namespace detail + +} // namespace io +} // namespace boost + + +#endif // BOOST_FORMAT_INTERNAL_FWD_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/format/parsing.hpp b/deal.II/contrib/boost/include/boost-1.37.0/format/parsing.hpp new file mode 100644 index 0000000000..7f1bfc883f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/format/parsing.hpp @@ -0,0 +1,503 @@ +// ---------------------------------------------------------------------------- +// parsing.hpp : implementation of the parsing member functions +// ( parse, parse_printf_directive) +// ---------------------------------------------------------------------------- + +// 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_PARSING_HPP +#define BOOST_FORMAT_PARSING_HPP + + +#include +#include +#include +#include + + +namespace boost { +namespace io { +namespace detail { + +#if defined(BOOST_NO_STD_LOCALE) + // streams will be used for narrow / widen. but these methods are not const + template + T& const_or_not(const T& x) { + return const_cast (x); + } +#else + template + const T& const_or_not(const T& x) { + return x; + } +#endif + + template inline + char wrap_narrow(const Facet& fac, Ch c, char deflt) { + return const_or_not(fac).narrow(c, deflt); + } + + template inline + bool wrap_isdigit(const Facet& fac, Ch c) { +#if ! defined( BOOST_NO_LOCALE_ISDIGIT ) + return fac.is(std::ctype::digit, c); +# else + using namespace std; + return isdigit(c); +#endif + } + + template + Iter wrap_scan_notdigit(const Facet & fac, Iter beg, Iter end) { + using namespace std; + for( ; beg!=end && wrap_isdigit(fac, *beg); ++beg) ; + return beg; + } + + + // Input : [start, last) iterators range and a + // a Facet to use its widen/narrow member function + // Effects : read sequence and convert digits into integral n, of type Res + // Returns : n + template + Iter str2int (const Iter & start, const Iter & last, Res & res, + const Facet& fac) + { + using namespace std; + Iter it; + res=0; + for(it=start; it != last && wrap_isdigit(fac, *it); ++it ) { + char cur_ch = wrap_narrow(fac, *it, 0); // cant fail. + res *= 10; + res += cur_ch - '0'; // 22.2.1.1.2.13 of the C++ standard + } + return it; + } + + // skip printf's "asterisk-fields" directives in the format-string buf + // Input : char string, with starting index *pos_p + // a Facet merely to use its widen/narrow member function + // Effects : advance *pos_p by skipping printf's asterisk fields. + // Returns : nothing + template + Iter skip_asterisk(Iter start, Iter last, const Facet& fac) + { + using namespace std; + ++ start; + start = wrap_scan_notdigit(fac, start, last); + if(start!=last && *start== const_or_not(fac).widen( '$') ) + ++start; + return start; + } + + + // auxiliary func called by parse_printf_directive + // for centralising error handling + // it either throws if user sets the corresponding flag, or does nothing. + inline void maybe_throw_exception(unsigned char exceptions, + std::size_t pos, std::size_t size) + { + if(exceptions & io::bad_format_string_bit) + boost::throw_exception(io::bad_format_string(pos, size) ); + } + + + // Input: the position of a printf-directive in the format-string + // a basic_ios& merely to use its widen/narrow member function + // a bitset'exceptions' telling whether to throw exceptions on errors. + // Returns: + // true if parse succeeded (ignore some errors if exceptions disabled) + // false if it failed so bad that the directive should be printed verbatim + // Effects: + // start is incremented so that *start is the first char after + // this directive + // *fpar is set with the parameters read in the directive + template + bool parse_printf_directive(Iter & start, const Iter& last, + detail::format_item * fpar, + const Facet& fac, + std::size_t offset, unsigned char exceptions) + { + typedef typename basic_format::format_item_t format_item_t; + + fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive + bool precision_set = false; + bool in_brackets=false; + Iter start0 = start; + std::size_t fstring_size = last-start0+offset; + + if(start>= last) { // empty directive : this is a trailing % + maybe_throw_exception(exceptions, start-start0 + offset, fstring_size); + return false; + } + + if(*start== const_or_not(fac).widen( '|')) { + in_brackets=true; + if( ++start >= last ) { + maybe_throw_exception(exceptions, start-start0 + offset, fstring_size); + return false; + } + } + + // the flag '0' would be picked as a digit for argument order, but here it's a flag : + if(*start== const_or_not(fac).widen( '0')) + goto parse_flags; + + // handle argument order (%2$d) or possibly width specification: %2d + if(wrap_isdigit(fac, *start)) { + int n; + start = str2int(start, last, n, fac); + if( start >= last ) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return false; + } + + // %N% case : this is already the end of the directive + if( *start == const_or_not(fac).widen( '%') ) { + fpar->argN_ = n-1; + ++start; + if( in_brackets) + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + // but don't return. maybe "%" was used in lieu of '$', so we go on. + else + return true; + } + + if ( *start== const_or_not(fac).widen( '$') ) { + fpar->argN_ = n-1; + ++start; + } + else { + // non-positionnal directive + fpar->fmtstate_.width_ = n; + fpar->argN_ = format_item_t::argN_no_posit; + goto parse_precision; + } + } + + parse_flags: + // handle flags + while ( start != last) { // as long as char is one of + - = _ # 0 l h or ' ' + // misc switches + switch ( wrap_narrow(fac, *start, 0)) { + case '\'' : break; // no effect yet. (painful to implement) + case 'l': + case 'h': // short/long modifier : for printf-comaptibility (no action needed) + break; + case '-': + fpar->fmtstate_.flags_ |= std::ios_base::left; + break; + case '=': + fpar->pad_scheme_ |= format_item_t::centered; + break; + case '_': + fpar->fmtstate_.flags_ |= std::ios_base::internal; + break; + case ' ': + fpar->pad_scheme_ |= format_item_t::spacepad; + break; + case '+': + fpar->fmtstate_.flags_ |= std::ios_base::showpos; + break; + case '0': + fpar->pad_scheme_ |= format_item_t::zeropad; + // need to know alignment before really setting flags, + // so just add 'zeropad' flag for now, it will be processed later. + break; + case '#': + fpar->fmtstate_.flags_ |= std::ios_base::showpoint | std::ios_base::showbase; + break; + default: + goto parse_width; + } + ++start; + } // loop on flag. + + if( start>=last) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return true; + } + parse_width: + // handle width spec + // first skip 'asterisk fields' : *, or *N$ + if(*start == const_or_not(fac).widen( '*') ) + start = skip_asterisk(start, last, fac); + if(start!=last && wrap_isdigit(fac, *start)) + start = str2int(start, last, fpar->fmtstate_.width_, fac); + + parse_precision: + if( start>= last) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return true; + } + // handle precision spec + if (*start== const_or_not(fac).widen( '.')) { + ++start; + if(start != last && *start == const_or_not(fac).widen( '*') ) + start = skip_asterisk(start, last, fac); + if(start != last && wrap_isdigit(fac, *start)) { + start = str2int(start, last, fpar->fmtstate_.precision_, fac); + precision_set = true; + } + else + fpar->fmtstate_.precision_ =0; + } + + // handle formatting-type flags : + while( start != last && ( *start== const_or_not(fac).widen( 'l') + || *start== const_or_not(fac).widen( 'L') + || *start== const_or_not(fac).widen( 'h')) ) + ++start; + if( start>=last) { + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + return true; + } + + if( in_brackets && *start== const_or_not(fac).widen( '|') ) { + ++start; + return true; + } + switch ( wrap_narrow(fac, *start, 0) ) { + case 'X': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + case 'p': // pointer => set hex. + case 'x': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::hex; + break; + + case 'o': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::oct; + break; + + case 'E': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + case 'e': + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + fpar->fmtstate_.flags_ |= std::ios_base::scientific; + + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; + break; + + case 'f': + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + fpar->fmtstate_.flags_ |= std::ios_base::fixed; + case 'u': + case 'd': + case 'i': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; + break; + + case 'T': + ++start; + if( start >= last) + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + else + fpar->fmtstate_.fill_ = *start; + fpar->pad_scheme_ |= format_item_t::tabulation; + fpar->argN_ = format_item_t::argN_tabulation; + break; + case 't': + fpar->fmtstate_.fill_ = const_or_not(fac).widen( ' '); + fpar->pad_scheme_ |= format_item_t::tabulation; + fpar->argN_ = format_item_t::argN_tabulation; + break; + + case 'G': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + break; + case 'g': // 'g' conversion is default for floats. + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; + + // CLEAR all floatield flags, so stream will CHOOSE + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + break; + + case 'C': + case 'c': + fpar->truncate_ = 1; + break; + case 'S': + case 's': + if(precision_set) // handle truncation manually, with own parameter. + fpar->truncate_ = fpar->fmtstate_.precision_; + fpar->fmtstate_.precision_ = 6; // default stream precision. + break; + case 'n' : + fpar->argN_ = format_item_t::argN_ignored; + break; + default: + maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + } + ++start; + + if( in_brackets ) { + if( start != last && *start== const_or_not(fac).widen( '|') ) { + ++start; + return true; + } + else maybe_throw_exception(exceptions, start-start0+offset, fstring_size); + } + return true; + } + // -end parse_printf_directive() + + template + int upper_bound_from_fstring(const String& buf, + const typename String::value_type arg_mark, + const Facet& fac, + unsigned char exceptions) + { + // quick-parsing of the format-string to count arguments mark (arg_mark, '%') + // returns : upper bound on the number of format items in the format strings + using namespace boost::io; + typename String::size_type i1=0; + int num_items=0; + while( (i1=buf.find(arg_mark,i1)) != String::npos ) { + if( i1+1 >= buf.size() ) { + if(exceptions & bad_format_string_bit) + boost::throw_exception(bad_format_string(i1, buf.size() )); // must not end in ".. %" + else { + ++num_items; + break; + } + } + if(buf[i1+1] == buf[i1] ) {// escaped "%%" + i1+=2; continue; + } + + ++i1; + // in case of %N% directives, dont count it double (wastes allocations..) : + i1 = detail::wrap_scan_notdigit(fac, buf.begin()+i1, buf.end()) - buf.begin(); + if( i1 < buf.size() && buf[i1] == arg_mark ) + ++i1; + ++num_items; + } + return num_items; + } + template inline + void append_string(String& dst, const String& src, + const typename String::size_type beg, + const typename String::size_type end) { +#if !defined(BOOST_NO_STRING_APPEND) + dst.append(src.begin()+beg, src.begin()+end); +#else + dst += src.substr(beg, end-beg); +#endif + } + +} // detail namespace +} // io namespace + + + +// ----------------------------------------------- +// format :: parse(..) + + template + basic_format& basic_format:: + parse (const string_type& buf) { + // parse the format-string + using namespace std; +#if !defined(BOOST_NO_STD_LOCALE) + const std::ctype & fac = BOOST_USE_FACET( std::ctype, getloc()); +#else + io::basic_oaltstringstream fac; + //has widen and narrow even on compilers without locale +#endif + + const Ch arg_mark = io::detail::const_or_not(fac).widen( '%'); + bool ordered_args=true; + int max_argN=-1; + + // A: find upper_bound on num_items and allocates arrays + int num_items = io::detail::upper_bound_from_fstring(buf, arg_mark, fac, exceptions()); + make_or_reuse_data(num_items); + + // B: Now the real parsing of the format string : + num_items=0; + typename string_type::size_type i0=0, i1=0; + typename string_type::const_iterator it; + bool special_things=false; + int cur_item=0; + while( (i1=buf.find(arg_mark,i1)) != string_type::npos ) { + string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_; + if( buf[i1+1] == buf[i1] ) { // escaped mark, '%%' + io::detail::append_string(piece, buf, i0, i1+1); + i1+=2; i0=i1; + continue; + } + BOOST_ASSERT( static_cast(cur_item) < items_.size() || cur_item==0); + + if(i1!=i0) { + io::detail::append_string(piece, buf, i0, i1); + i0=i1; + } + ++i1; + it = buf.begin()+i1; + bool parse_ok = io::detail::parse_printf_directive( + it, buf.end(), &items_[cur_item], fac, i1, exceptions()); + i1 = it - buf.begin(); + if( ! parse_ok ) // the directive will be printed verbatim + continue; + i0=i1; + items_[cur_item].compute_states(); // process complex options, like zeropad, into params + + int argN=items_[cur_item].argN_; + if(argN == format_item_t::argN_ignored) + continue; + if(argN ==format_item_t::argN_no_posit) + ordered_args=false; + else if(argN == format_item_t::argN_tabulation) special_things=true; + else if(argN > max_argN) max_argN = argN; + ++num_items; + ++cur_item; + } // loop on %'s + BOOST_ASSERT(cur_item == num_items); + + // store the final piece of string + { + string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_; + io::detail::append_string(piece, buf, i0, buf.size()); + } + + if( !ordered_args) { + if(max_argN >= 0 ) { // dont mix positional with non-positionnal directives + if(exceptions() & io::bad_format_string_bit) + boost::throw_exception(io::bad_format_string(max_argN, 0)); + // else do nothing. => positionnal arguments are processed as non-positionnal + } + // set things like it would have been with positional directives : + int non_ordered_items = 0; + for(int i=0; i< num_items; ++i) + if(items_[i].argN_ == format_item_t::argN_no_posit) { + items_[i].argN_ = non_ordered_items; + ++non_ordered_items; + } + max_argN = non_ordered_items-1; + } + + // C: set some member data : + items_.resize(num_items, format_item_t(io::detail::const_or_not(fac).widen( ' ')) ); + + if(special_things) style_ |= special_needs; + num_args_ = max_argN + 1; + if(ordered_args) style_ |= ordered; + else style_ &= ~ordered; + return *this; + } + +} // namespace boost + + +#endif // BOOST_FORMAT_PARSING_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function.hpp new file mode 100644 index 0000000000..bdb27691df --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function.hpp @@ -0,0 +1,66 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2001-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org/libs/function + +// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the +// design of this library. + +#include // unary_function, binary_function + +#include +#include + +#ifndef BOOST_FUNCTION_MAX_ARGS +# define BOOST_FUNCTION_MAX_ARGS 10 +#endif // BOOST_FUNCTION_MAX_ARGS + +// Include the prologue here so that the use of file-level iteration +// in anything that may be included by function_template.hpp doesn't break +#include + +// Visual Age C++ doesn't handle the file iteration well +#if BOOST_WORKAROUND(__IBMCPP__, >= 500) +# if BOOST_FUNCTION_MAX_ARGS >= 0 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 1 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 2 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 3 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 4 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 5 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 6 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 7 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 8 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 9 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 10 +# include +# endif +#else +// What is the '3' for? +# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_FUNCTION_MAX_ARGS,)) +# include BOOST_PP_ITERATE() +# undef BOOST_PP_ITERATION_PARAMS_1 +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/detail/function_iterate.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/function_iterate.hpp new file mode 100644 index 0000000000..5370b36aac --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/function_iterate.hpp @@ -0,0 +1,16 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org +#if !defined(BOOST_PP_IS_ITERATING) +# error Boost.Function - do not include this file! +#endif + +#define BOOST_FUNCTION_NUM_ARGS BOOST_PP_ITERATION() +#include +#undef BOOST_FUNCTION_NUM_ARGS + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/detail/gen_maybe_include.pl b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/gen_maybe_include.pl new file mode 100644 index 0000000000..d0629205e1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/gen_maybe_include.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w +# +# Boost.Function library +# +# Copyright (C) 2001-2003 Douglas Gregor (gregod@cs.rpi.edu) +# +# Permission to copy, use, sell and distribute this software is granted +# provided this copyright notice appears in all copies. +# Permission to modify the code and to distribute modified code is granted +# provided this copyright notice appears in all copies, and a notice +# that the code was modified is included with the copyright notice. +# +# This software is provided "as is" without express or implied warranty, +# and with no claim as to its suitability for any purpose. +# +# For more information, see http://www.boost.org +use English; + +$max_args = $ARGV[0]; + +open (OUT, ">maybe_include.hpp") or die("Cannot write to maybe_include.hpp"); +for($on_arg = 0; $on_arg <= $max_args; ++$on_arg) { + if ($on_arg == 0) { + print OUT "#if"; + } + else { + print OUT "#elif"; + } + print OUT " BOOST_FUNCTION_NUM_ARGS == $on_arg\n"; + print OUT "# ifndef BOOST_FUNCTION_$on_arg\n"; + print OUT "# define BOOST_FUNCTION_$on_arg\n"; + print OUT "# include \n"; + print OUT "# endif\n"; +} +print OUT "#else\n"; +print OUT "# error Cannot handle Boost.Function objects that accept more than $max_args arguments!\n"; +print OUT "#endif\n"; diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/detail/maybe_include.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/maybe_include.hpp new file mode 100644 index 0000000000..92f71bb227 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/maybe_include.hpp @@ -0,0 +1,267 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#if BOOST_FUNCTION_NUM_ARGS == 0 +# ifndef BOOST_FUNCTION_0 +# define BOOST_FUNCTION_0 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 1 +# ifndef BOOST_FUNCTION_1 +# define BOOST_FUNCTION_1 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 2 +# ifndef BOOST_FUNCTION_2 +# define BOOST_FUNCTION_2 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 3 +# ifndef BOOST_FUNCTION_3 +# define BOOST_FUNCTION_3 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 4 +# ifndef BOOST_FUNCTION_4 +# define BOOST_FUNCTION_4 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 5 +# ifndef BOOST_FUNCTION_5 +# define BOOST_FUNCTION_5 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 6 +# ifndef BOOST_FUNCTION_6 +# define BOOST_FUNCTION_6 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 7 +# ifndef BOOST_FUNCTION_7 +# define BOOST_FUNCTION_7 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 8 +# ifndef BOOST_FUNCTION_8 +# define BOOST_FUNCTION_8 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 9 +# ifndef BOOST_FUNCTION_9 +# define BOOST_FUNCTION_9 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 10 +# ifndef BOOST_FUNCTION_10 +# define BOOST_FUNCTION_10 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 11 +# ifndef BOOST_FUNCTION_11 +# define BOOST_FUNCTION_11 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 12 +# ifndef BOOST_FUNCTION_12 +# define BOOST_FUNCTION_12 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 13 +# ifndef BOOST_FUNCTION_13 +# define BOOST_FUNCTION_13 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 14 +# ifndef BOOST_FUNCTION_14 +# define BOOST_FUNCTION_14 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 15 +# ifndef BOOST_FUNCTION_15 +# define BOOST_FUNCTION_15 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 16 +# ifndef BOOST_FUNCTION_16 +# define BOOST_FUNCTION_16 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 17 +# ifndef BOOST_FUNCTION_17 +# define BOOST_FUNCTION_17 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 18 +# ifndef BOOST_FUNCTION_18 +# define BOOST_FUNCTION_18 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 19 +# ifndef BOOST_FUNCTION_19 +# define BOOST_FUNCTION_19 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 20 +# ifndef BOOST_FUNCTION_20 +# define BOOST_FUNCTION_20 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 21 +# ifndef BOOST_FUNCTION_21 +# define BOOST_FUNCTION_21 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 22 +# ifndef BOOST_FUNCTION_22 +# define BOOST_FUNCTION_22 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 23 +# ifndef BOOST_FUNCTION_23 +# define BOOST_FUNCTION_23 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 24 +# ifndef BOOST_FUNCTION_24 +# define BOOST_FUNCTION_24 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 25 +# ifndef BOOST_FUNCTION_25 +# define BOOST_FUNCTION_25 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 26 +# ifndef BOOST_FUNCTION_26 +# define BOOST_FUNCTION_26 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 27 +# ifndef BOOST_FUNCTION_27 +# define BOOST_FUNCTION_27 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 28 +# ifndef BOOST_FUNCTION_28 +# define BOOST_FUNCTION_28 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 29 +# ifndef BOOST_FUNCTION_29 +# define BOOST_FUNCTION_29 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 30 +# ifndef BOOST_FUNCTION_30 +# define BOOST_FUNCTION_30 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 31 +# ifndef BOOST_FUNCTION_31 +# define BOOST_FUNCTION_31 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 32 +# ifndef BOOST_FUNCTION_32 +# define BOOST_FUNCTION_32 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 33 +# ifndef BOOST_FUNCTION_33 +# define BOOST_FUNCTION_33 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 34 +# ifndef BOOST_FUNCTION_34 +# define BOOST_FUNCTION_34 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 35 +# ifndef BOOST_FUNCTION_35 +# define BOOST_FUNCTION_35 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 36 +# ifndef BOOST_FUNCTION_36 +# define BOOST_FUNCTION_36 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 37 +# ifndef BOOST_FUNCTION_37 +# define BOOST_FUNCTION_37 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 38 +# ifndef BOOST_FUNCTION_38 +# define BOOST_FUNCTION_38 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 39 +# ifndef BOOST_FUNCTION_39 +# define BOOST_FUNCTION_39 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 40 +# ifndef BOOST_FUNCTION_40 +# define BOOST_FUNCTION_40 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 41 +# ifndef BOOST_FUNCTION_41 +# define BOOST_FUNCTION_41 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 42 +# ifndef BOOST_FUNCTION_42 +# define BOOST_FUNCTION_42 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 43 +# ifndef BOOST_FUNCTION_43 +# define BOOST_FUNCTION_43 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 44 +# ifndef BOOST_FUNCTION_44 +# define BOOST_FUNCTION_44 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 45 +# ifndef BOOST_FUNCTION_45 +# define BOOST_FUNCTION_45 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 46 +# ifndef BOOST_FUNCTION_46 +# define BOOST_FUNCTION_46 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 47 +# ifndef BOOST_FUNCTION_47 +# define BOOST_FUNCTION_47 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 48 +# ifndef BOOST_FUNCTION_48 +# define BOOST_FUNCTION_48 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 49 +# ifndef BOOST_FUNCTION_49 +# define BOOST_FUNCTION_49 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 50 +# ifndef BOOST_FUNCTION_50 +# define BOOST_FUNCTION_50 +# include +# endif +#else +# error Cannot handle Boost.Function objects that accept more than 50 arguments! +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/detail/prologue.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/prologue.hpp new file mode 100644 index 0000000000..53d0f05cd3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/detail/prologue.hpp @@ -0,0 +1,26 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#ifndef BOOST_FUNCTION_PROLOGUE_HPP +#define BOOST_FUNCTION_PROLOGUE_HPP +# include +# include +# include // unary_function, binary_function +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif // BOOST_FUNCTION_PROLOGUE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function0.hpp new file mode 100644 index 0000000000..65a02e5fac --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function0.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 0 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function1.hpp new file mode 100644 index 0000000000..9089715155 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function1.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 1 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function10.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function10.hpp new file mode 100644 index 0000000000..6562724849 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function10.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 10 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function2.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function2.hpp new file mode 100644 index 0000000000..dc8bf97521 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function2.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 2 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function3.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function3.hpp new file mode 100644 index 0000000000..19d1a49dd5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function3.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 3 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function4.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function4.hpp new file mode 100644 index 0000000000..f3349e2dc9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function4.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 4 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function5.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function5.hpp new file mode 100644 index 0000000000..a1305eb5ce --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function5.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 5 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function6.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function6.hpp new file mode 100644 index 0000000000..1f60914919 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function6.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 6 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function7.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function7.hpp new file mode 100644 index 0000000000..68542ed46a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function7.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 7 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function8.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function8.hpp new file mode 100644 index 0000000000..cf2c37661f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function8.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 8 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function9.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function9.hpp new file mode 100644 index 0000000000..590e0883d7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function9.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 9 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function_base.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function_base.hpp new file mode 100644 index 0000000000..6612fb8415 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function_base.hpp @@ -0,0 +1,880 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2001-2006 +// Copyright Emil Dotchevski 2007 +// Use, modification and distribution is subject to the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#ifndef BOOST_FUNCTION_BASE_HEADER +#define BOOST_FUNCTION_BASE_HEADER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef BOOST_NO_SFINAE +# include "boost/utility/enable_if.hpp" +#else +# include "boost/mpl/bool.hpp" +#endif +#include +#include + +#if defined(BOOST_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4793 ) // complaint about native code generation +# pragma warning( disable : 4127 ) // "conditional expression is constant" +#endif + +// Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info. +#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE +// Embedded VC++ does not have type_info in namespace std +# define BOOST_FUNCTION_STD_NS +#else +# define BOOST_FUNCTION_STD_NS std +#endif + +// Borrowed from Boost.Python library: determines the cases where we +// need to use std::type_info::name to compare instead of operator==. +# if (defined(__GNUC__) && __GNUC__ >= 3) \ + || defined(_AIX) \ + || ( defined(__sgi) && defined(__host_mips)) +# include +# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \ + (std::strcmp((X).name(),(Y).name()) == 0) +# else +# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y)) +#endif + +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) +# define BOOST_FUNCTION_TARGET_FIX(x) x +#else +# define BOOST_FUNCTION_TARGET_FIX(x) +#endif // not MSVC + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x5A0) +# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ + typename ::boost::enable_if_c<(::boost::type_traits::ice_not< \ + (::boost::is_integral::value)>::value), \ + Type>::type +#else +// BCC doesn't recognize this depends on a template argument and complains +// about the use of 'typename' +# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ + ::boost::enable_if_c<(::boost::type_traits::ice_not< \ + (::boost::is_integral::value)>::value), \ + Type>::type +#endif + +namespace boost { + namespace detail { + namespace function { + class X; + + /** + * A buffer used to store small function objects in + * boost::function. It is a union containing function pointers, + * object pointers, and a structure that resembles a bound + * member function pointer. + */ + union function_buffer + { + // For pointers to function objects + mutable void* obj_ptr; + + // For pointers to std::type_info objects + struct type_t { + // (get_functor_type_tag, check_functor_type_tag). + const BOOST_FUNCTION_STD_NS::type_info* type; + + // Whether the type is const-qualified. + bool const_qualified; + // Whether the type is volatile-qualified. + bool volatile_qualified; + } type; + + // For function pointers of all kinds + mutable void (*func_ptr)(); + + // For bound member pointers + struct bound_memfunc_ptr_t { + void (X::*memfunc_ptr)(int); + void* obj_ptr; + } bound_memfunc_ptr; + + // For references to function objects. We explicitly keep + // track of the cv-qualifiers on the object referenced. + struct obj_ref_t { + mutable void* obj_ptr; + bool is_const_qualified; + bool is_volatile_qualified; + } obj_ref; + + // To relax aliasing constraints + mutable char data; + }; + + /** + * The unusable class is a placeholder for unused function arguments + * It is also completely unusable except that it constructable from + * anything. This helps compilers without partial specialization to + * handle Boost.Function objects returning void. + */ + struct unusable + { + unusable() {} + template unusable(const T&) {} + }; + + /* Determine the return type. This supports compilers that do not support + * void returns or partial specialization by silently changing the return + * type to "unusable". + */ + template struct function_return_type { typedef T type; }; + + template<> + struct function_return_type + { + typedef unusable type; + }; + + // The operation type to perform on the given functor/function pointer + enum functor_manager_operation_type { + clone_functor_tag, + move_functor_tag, + destroy_functor_tag, + check_functor_type_tag, + get_functor_type_tag + }; + + // Tags used to decide between different types of functions + struct function_ptr_tag {}; + struct function_obj_tag {}; + struct member_ptr_tag {}; + struct function_obj_ref_tag {}; + + template + class get_function_tag + { + typedef typename mpl::if_c<(is_pointer::value), + function_ptr_tag, + function_obj_tag>::type ptr_or_obj_tag; + + typedef typename mpl::if_c<(is_member_pointer::value), + member_ptr_tag, + ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; + + typedef typename mpl::if_c<(is_reference_wrapper::value), + function_obj_ref_tag, + ptr_or_obj_or_mem_tag>::type or_ref_tag; + + public: + typedef or_ref_tag type; + }; + + // The trivial manager does nothing but return the same pointer (if we + // are cloning) or return the null pointer (if we are deleting). + template + struct reference_manager + { + static inline void + manage(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + switch (op) { + case clone_functor_tag: + out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr; + return; + + case move_functor_tag: + out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr; + in_buffer.obj_ref.obj_ptr = 0; + return; + + case destroy_functor_tag: + out_buffer.obj_ref.obj_ptr = 0; + return; + + case check_functor_type_tag: + { + const BOOST_FUNCTION_STD_NS::type_info& check_type + = *out_buffer.type.type; + + // Check whether we have the same type. We can add + // cv-qualifiers, but we can't take them away. + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(F)) + && (!in_buffer.obj_ref.is_const_qualified + || out_buffer.type.const_qualified) + && (!in_buffer.obj_ref.is_volatile_qualified + || out_buffer.type.volatile_qualified)) + out_buffer.obj_ptr = in_buffer.obj_ref.obj_ptr; + else + out_buffer.obj_ptr = 0; + } + return; + + case get_functor_type_tag: + out_buffer.type.type = &typeid(F); + out_buffer.type.const_qualified = in_buffer.obj_ref.is_const_qualified; + out_buffer.type.volatile_qualified = in_buffer.obj_ref.is_volatile_qualified; + return; + } + } + }; + + /** + * Determine if boost::function can use the small-object + * optimization with the function object type F. + */ + template + struct function_allows_small_object_optimization + { + BOOST_STATIC_CONSTANT + (bool, + value = ((sizeof(F) <= sizeof(function_buffer) && + (alignment_of::value + % alignment_of::value == 0)))); + }; + + template + struct functor_wrapper: public F, public A + { + functor_wrapper( F f, A a ): + F(f), + A(a) + { + } + }; + + /** + * The functor_manager class contains a static function "manage" which + * can clone or destroy the given function/function object pointer. + */ + template + struct functor_manager_common + { + typedef Functor functor_type; + + // Function pointers + static inline void + manage_ptr(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + if (op == clone_functor_tag) + out_buffer.func_ptr = in_buffer.func_ptr; + else if (op == move_functor_tag) { + out_buffer.func_ptr = in_buffer.func_ptr; + in_buffer.func_ptr = 0; + } else if (op == destroy_functor_tag) + out_buffer.func_ptr = 0; + else if (op == check_functor_type_tag) { + const BOOST_FUNCTION_STD_NS::type_info& check_type + = *out_buffer.type.type; + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) + out_buffer.obj_ptr = &in_buffer.func_ptr; + else + out_buffer.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.type.type = &typeid(Functor); + out_buffer.type.const_qualified = false; + out_buffer.type.volatile_qualified = false; + } + } + + // Function objects that fit in the small-object buffer. + static inline void + manage_small(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + if (op == clone_functor_tag || op == move_functor_tag) { + const functor_type* in_functor = + reinterpret_cast(&in_buffer.data); + new ((void*)&out_buffer.data) functor_type(*in_functor); + + if (op == move_functor_tag) { + reinterpret_cast(&in_buffer.data)->~Functor(); + } + } else if (op == destroy_functor_tag) { + // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. + reinterpret_cast(&out_buffer.data)->~Functor(); + } else if (op == check_functor_type_tag) { + const BOOST_FUNCTION_STD_NS::type_info& check_type + = *out_buffer.type.type; + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) + out_buffer.obj_ptr = &in_buffer.data; + else + out_buffer.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.type.type = &typeid(Functor); + out_buffer.type.const_qualified = false; + out_buffer.type.volatile_qualified = false; + } + } + }; + + template + struct functor_manager + { + private: + typedef Functor functor_type; + + // Function pointers + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_ptr_tag) + { + functor_manager_common::manage_ptr(in_buffer,out_buffer,op); + } + + // Function objects that fit in the small-object buffer. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::true_) + { + functor_manager_common::manage_small(in_buffer,out_buffer,op); + } + + // Function objects that require heap allocation + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::false_) + { + if (op == clone_functor_tag) { + // Clone the functor + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + const functor_type* f = + (const functor_type*)(in_buffer.obj_ptr); + functor_type* new_f = new functor_type(*f); + out_buffer.obj_ptr = new_f; + } else if (op == move_functor_tag) { + out_buffer.obj_ptr = in_buffer.obj_ptr; + in_buffer.obj_ptr = 0; + } else if (op == destroy_functor_tag) { + /* Cast from the void pointer to the functor pointer type */ + functor_type* f = + static_cast(out_buffer.obj_ptr); + delete f; + out_buffer.obj_ptr = 0; + } else if (op == check_functor_type_tag) { + const BOOST_FUNCTION_STD_NS::type_info& check_type + = *out_buffer.type.type; + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) + out_buffer.obj_ptr = in_buffer.obj_ptr; + else + out_buffer.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.type.type = &typeid(Functor); + out_buffer.type.const_qualified = false; + out_buffer.type.volatile_qualified = false; + } + } + + // For function objects, we determine whether the function + // object can use the small-object optimization buffer or + // whether we need to allocate it on the heap. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_obj_tag) + { + manager(in_buffer, out_buffer, op, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + } + + // For member pointers, we use the small-object optimization buffer. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, member_ptr_tag) + { + manager(in_buffer, out_buffer, op, mpl::true_()); + } + + public: + /* Dispatch to an appropriate manager based on whether we have a + function pointer or a function object pointer. */ + static inline void + manage(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + typedef typename get_function_tag::type tag_type; + switch (op) { + case get_functor_type_tag: + out_buffer.type.type = &typeid(functor_type); + out_buffer.type.const_qualified = false; + out_buffer.type.volatile_qualified = false; + return; + + default: + manager(in_buffer, out_buffer, op, tag_type()); + return; + } + } + }; + + template + struct functor_manager_a + { + private: + typedef Functor functor_type; + + // Function pointers + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_ptr_tag) + { + functor_manager_common::manage_ptr(in_buffer,out_buffer,op); + } + + // Function objects that fit in the small-object buffer. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::true_) + { + functor_manager_common::manage_small(in_buffer,out_buffer,op); + } + + // Function objects that require heap allocation + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::false_) + { + typedef functor_wrapper functor_wrapper_type; + typedef typename Allocator::template rebind::other + wrapper_allocator_type; + typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; + + if (op == clone_functor_tag) { + // Clone the functor + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + const functor_wrapper_type* f = + (const functor_wrapper_type*)(in_buffer.obj_ptr); + wrapper_allocator_type wrapper_allocator(static_cast(*f)); + wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); + wrapper_allocator.construct(copy, *f); + + // Get back to the original pointer type + functor_wrapper_type* new_f = static_cast(copy); + out_buffer.obj_ptr = new_f; + } else if (op == move_functor_tag) { + out_buffer.obj_ptr = in_buffer.obj_ptr; + in_buffer.obj_ptr = 0; + } else if (op == destroy_functor_tag) { + /* Cast from the void pointer to the functor_wrapper_type */ + functor_wrapper_type* victim = + static_cast(in_buffer.obj_ptr); + wrapper_allocator_type wrapper_allocator(static_cast(*victim)); + wrapper_allocator.destroy(victim); + wrapper_allocator.deallocate(victim,1); + out_buffer.obj_ptr = 0; + } else if (op == check_functor_type_tag) { + const BOOST_FUNCTION_STD_NS::type_info& check_type + = *out_buffer.type.type; + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) + out_buffer.obj_ptr = in_buffer.obj_ptr; + else + out_buffer.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.type.type = &typeid(Functor); + out_buffer.type.const_qualified = false; + out_buffer.type.volatile_qualified = false; + } + } + + // For function objects, we determine whether the function + // object can use the small-object optimization buffer or + // whether we need to allocate it on the heap. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_obj_tag) + { + manager(in_buffer, out_buffer, op, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + } + + public: + /* Dispatch to an appropriate manager based on whether we have a + function pointer or a function object pointer. */ + static inline void + manage(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + typedef typename get_function_tag::type tag_type; + switch (op) { + case get_functor_type_tag: + out_buffer.type.type = &typeid(functor_type); + out_buffer.type.const_qualified = false; + out_buffer.type.volatile_qualified = false; + return; + + default: + manager(in_buffer, out_buffer, op, tag_type()); + return; + } + } + }; + + // A type that is only used for comparisons against zero + struct useless_clear_type {}; + +#ifdef BOOST_NO_SFINAE + // These routines perform comparisons between a Boost.Function + // object and an arbitrary function object (when the last + // parameter is mpl::bool_) or against zero (when the + // last parameter is mpl::bool_). They are only necessary + // for compilers that don't support SFINAE. + template + bool + compare_equal(const Function& f, const Functor&, int, mpl::bool_) + { return f.empty(); } + + template + bool + compare_not_equal(const Function& f, const Functor&, int, + mpl::bool_) + { return !f.empty(); } + + template + bool + compare_equal(const Function& f, const Functor& g, long, + mpl::bool_) + { + if (const Functor* fp = f.template target()) + return function_equal(*fp, g); + else return false; + } + + template + bool + compare_equal(const Function& f, const reference_wrapper& g, + int, mpl::bool_) + { + if (const Functor* fp = f.template target()) + return fp == g.get_pointer(); + else return false; + } + + template + bool + compare_not_equal(const Function& f, const Functor& g, long, + mpl::bool_) + { + if (const Functor* fp = f.template target()) + return !function_equal(*fp, g); + else return true; + } + + template + bool + compare_not_equal(const Function& f, + const reference_wrapper& g, int, + mpl::bool_) + { + if (const Functor* fp = f.template target()) + return fp != g.get_pointer(); + else return true; + } +#endif // BOOST_NO_SFINAE + + /** + * Stores the "manager" portion of the vtable for a + * boost::function object. + */ + struct vtable_base + { + void (*manager)(const function_buffer& in_buffer, + function_buffer& out_buffer, + functor_manager_operation_type op); + }; + } // end namespace function + } // end namespace detail + +/** + * The function_base class contains the basic elements needed for the + * function1, function2, function3, etc. classes. It is common to all + * functions (and as such can be used to tell if we have one of the + * functionN objects). + */ +class function_base +{ +public: + function_base() : vtable(0) { } + + /** Determine if the function is empty (i.e., has no target). */ + bool empty() const { return !vtable; } + + /** Retrieve the type of the stored function object, or typeid(void) + if this is empty. */ + const BOOST_FUNCTION_STD_NS::type_info& target_type() const + { + if (!vtable) return typeid(void); + + detail::function::function_buffer type; + vtable->manager(functor, type, detail::function::get_functor_type_tag); + return *type.type.type; + } + + template + Functor* target() + { + if (!vtable) return 0; + + detail::function::function_buffer type_result; + type_result.type.type = &typeid(Functor); + type_result.type.const_qualified = is_const::value; + type_result.type.volatile_qualified = is_volatile::value; + vtable->manager(functor, type_result, + detail::function::check_functor_type_tag); + return static_cast(type_result.obj_ptr); + } + + template +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + const Functor* target( Functor * = 0 ) const +#else + const Functor* target() const +#endif + { + if (!vtable) return 0; + + detail::function::function_buffer type_result; + type_result.type.type = &typeid(Functor); + type_result.type.const_qualified = true; + type_result.type.volatile_qualified = is_volatile::value; + vtable->manager(functor, type_result, + detail::function::check_functor_type_tag); + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + return (const Functor*)(type_result.obj_ptr); + } + + template + bool contains(const F& f) const + { +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + if (const F* fp = this->target( (F*)0 )) +#else + if (const F* fp = this->template target()) +#endif + { + return function_equal(*fp, f); + } else { + return false; + } + } + +#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3 + // GCC 3.3 and newer cannot copy with the global operator==, due to + // problems with instantiation of function return types before it + // has been verified that the argument types match up. + template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(Functor g) const + { + if (const Functor* fp = target()) + return function_equal(*fp, g); + else return false; + } + + template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(Functor g) const + { + if (const Functor* fp = target()) + return !function_equal(*fp, g); + else return true; + } +#endif + +public: // should be protected, but GCC 2.95.3 will fail to allow access + detail::function::vtable_base* vtable; + mutable detail::function::function_buffer functor; +}; + +/** + * The bad_function_call exception class is thrown when a boost::function + * object is invoked + */ +class bad_function_call : public std::runtime_error +{ +public: + bad_function_call() : std::runtime_error("call to empty boost::function") {} +}; + +#ifndef BOOST_NO_SFINAE +inline bool operator==(const function_base& f, + detail::function::useless_clear_type*) +{ + return f.empty(); +} + +inline bool operator!=(const function_base& f, + detail::function::useless_clear_type*) +{ + return !f.empty(); +} + +inline bool operator==(detail::function::useless_clear_type*, + const function_base& f) +{ + return f.empty(); +} + +inline bool operator!=(detail::function::useless_clear_type*, + const function_base& f) +{ + return !f.empty(); +} +#endif + +#ifdef BOOST_NO_SFINAE +// Comparisons between boost::function objects and arbitrary function objects +template + inline bool operator==(const function_base& f, Functor g) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_equal(f, g, 0, integral()); + } + +template + inline bool operator==(Functor g, const function_base& f) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_equal(f, g, 0, integral()); + } + +template + inline bool operator!=(const function_base& f, Functor g) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_not_equal(f, g, 0, integral()); + } + +template + inline bool operator!=(Functor g, const function_base& f) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_not_equal(f, g, 0, integral()); + } +#else + +# if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) +// Comparisons between boost::function objects and arbitrary function +// objects. GCC 3.3 and before has an obnoxious bug that prevents this +// from working. +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(const function_base& f, Functor g) + { + if (const Functor* fp = f.template target()) + return function_equal(*fp, g); + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(Functor g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return function_equal(g, *fp); + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(const function_base& f, Functor g) + { + if (const Functor* fp = f.template target()) + return !function_equal(*fp, g); + else return true; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(Functor g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return !function_equal(g, *fp); + else return true; + } +# endif + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(const function_base& f, reference_wrapper g) + { + if (const Functor* fp = f.template target()) + return fp == g.get_pointer(); + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(reference_wrapper g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return g.get_pointer() == fp; + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(const function_base& f, reference_wrapper g) + { + if (const Functor* fp = f.template target()) + return fp != g.get_pointer(); + else return true; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(reference_wrapper g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return g.get_pointer() != fp; + else return true; + } + +#endif // Compiler supporting SFINAE + +namespace detail { + namespace function { + inline bool has_empty_target(const function_base* f) + { + return f->empty(); + } + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) + inline bool has_empty_target(const void*) + { + return false; + } +#else + inline bool has_empty_target(...) + { + return false; + } +#endif + } // end namespace function +} // end namespace detail +} // end namespace boost + +#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL +#undef BOOST_FUNCTION_COMPARE_TYPE_ID + +#endif // BOOST_FUNCTION_BASE_HEADER diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function_fwd.hpp new file mode 100644 index 0000000000..d2f713a5dc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function_fwd.hpp @@ -0,0 +1,70 @@ +// Boost.Function library +// Copyright (C) Douglas Gregor 2008 +// +// Use, modification and distribution is subject to the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org +#ifndef BOOST_FUNCTION_FWD_HPP +#define BOOST_FUNCTION_FWD_HPP +#include + +#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) +// Work around a compiler bug. +// boost::python::objects::function has to be seen by the compiler before the +// boost::function class template. +namespace boost { namespace python { namespace objects { + class function; +}}} +#endif + +#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ + || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) +# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX +#endif + +namespace boost { + class bad_function_call; + +#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) + // Preferred syntax + template class function; + + template + inline void swap(function& f1, function& f2) + { + f1.swap(f2); + } +#endif // have partial specialization + + // Portable syntax + template class function0; + template class function1; + template class function2; + template class function3; + template + class function4; + template + class function5; + template + class function6; + template + class function7; + template + class function8; + template + class function9; + template + class function10; +} + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function_template.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function_template.hpp new file mode 100644 index 0000000000..584abe96ba --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function_template.hpp @@ -0,0 +1,1134 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2001-2006 +// Copyright Emil Dotchevski 2007 +// Use, modification and distribution is subject to the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +// Note: this header is a header template and must NOT have multiple-inclusion +// protection. +#include + +#if defined(BOOST_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4127 ) // "conditional expression is constant" +#endif + +#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) + +#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T) + +#define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I) + +#define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY) + +#define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) + +#define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ + typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(I)),_type); + +#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) + +// Comma if nonzero number of arguments +#if BOOST_FUNCTION_NUM_ARGS == 0 +# define BOOST_FUNCTION_COMMA +#else +# define BOOST_FUNCTION_COMMA , +#endif // BOOST_FUNCTION_NUM_ARGS > 0 + +// Class names used in this version of the code +#define BOOST_FUNCTION_FUNCTION BOOST_JOIN(function,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_FUNCTION_INVOKER \ + BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ + BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ + BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ + BOOST_JOIN(void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_FUNCTION_REF_INVOKER \ + BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \ + BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_MEMBER_INVOKER \ + BOOST_JOIN(function_mem_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_MEMBER_INVOKER \ + BOOST_JOIN(function_void_mem_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ + BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ + BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \ + BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_MEMBER_INVOKER \ + BOOST_JOIN(get_member_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_INVOKER \ + BOOST_JOIN(get_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS) + +#ifndef BOOST_NO_VOID_RETURNS +# define BOOST_FUNCTION_VOID_RETURN_TYPE void +# define BOOST_FUNCTION_RETURN(X) X +#else +# define BOOST_FUNCTION_VOID_RETURN_TYPE boost::detail::function::unusable +# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE () +#endif + +namespace boost { + namespace detail { + namespace function { + template< + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_FUNCTION_INVOKER + { + static R invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + { + FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); + return f(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); + BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS)); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER + { + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f; + if (function_allows_small_object_optimization::value) + f = reinterpret_cast(&function_obj_ptr.data); + else + f = reinterpret_cast(function_obj_ptr.obj_ptr); + return (*f)(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f; + if (function_allows_small_object_optimization::value) + f = reinterpret_cast(&function_obj_ptr.data); + else + f = reinterpret_cast(function_obj_ptr.obj_ptr); + BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_FUNCTION_REF_INVOKER + { + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f = + reinterpret_cast(function_obj_ptr.obj_ptr); + return (*f)(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f = + reinterpret_cast(function_obj_ptr.obj_ptr); + BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); + } + }; + +#if BOOST_FUNCTION_NUM_ARGS > 0 + /* Handle invocation of member pointers. */ + template< + typename MemberPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_MEMBER_INVOKER + { + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + MemberPtr* f = + reinterpret_cast(&function_obj_ptr.data); + return boost::mem_fn(*f)(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename MemberPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_MEMBER_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + MemberPtr* f = + reinterpret_cast(&function_obj_ptr.data); + BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS)); + } + }; +#endif + + template< + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_FUNCTION_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_REF_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; + +#if BOOST_FUNCTION_NUM_ARGS > 0 + /* Retrieve the appropriate invoker for a member pointer. */ + template< + typename MemberPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_MEMBER_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; +#endif + + /* Given the tag returned by get_function_tag, retrieve the + actual invoker that will be used for the given function + object. + + Each specialization contains an "apply" nested class template + that accepts the function object, return type, function + argument types, and allocator. The resulting "apply" class + contains two typedefs, "invoker_type" and "manager_type", + which correspond to the invoker and manager types. */ + template + struct BOOST_FUNCTION_GET_INVOKER { }; + + /* Retrieve the invoker for a function pointer. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + }; + +#if BOOST_FUNCTION_NUM_ARGS > 0 + /* Retrieve the invoker for a member pointer. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + }; +#endif + + /* Retrieve the invoker for a function object. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager_a manager_type; + }; + }; + + /* Retrieve the invoker for a reference to a function object. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< + typename RefWrapper::type, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef reference_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< + typename RefWrapper::type, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef reference_manager manager_type; + }; + }; + + + /** + * vtable for a specific boost::function instance. This + * structure must be an aggregate so that we can use static + * initialization in boost::function's assign_to and assign_to_a + * members. It therefore cannot have any constructors, + * destructors, base classes, etc. + */ + template + struct BOOST_FUNCTION_VTABLE + { +#ifndef BOOST_NO_VOID_RETURNS + typedef R result_type; +#else + typedef typename function_return_type::type result_type; +#endif // BOOST_NO_VOID_RETURNS + + typedef result_type (*invoker_type)(function_buffer& + BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS); + + template + bool assign_to(F f, function_buffer& functor) + { + typedef typename get_function_tag::type tag; + return assign_to(f, functor, tag()); + } + template + bool assign_to_a(F f, function_buffer& functor, Allocator a) + { + typedef typename get_function_tag::type tag; + return assign_to_a(f, functor, a, tag()); + } + + void clear(function_buffer& functor) + { + if (base.manager) + base.manager(functor, functor, destroy_functor_tag); + } + + private: + // Function pointers + template + bool + assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) + { + this->clear(functor); + if (f) { + // should be a reinterpret cast, but some compilers insist + // on giving cv-qualifiers to free functions + functor.func_ptr = (void (*)())(f); + return true; + } else { + return false; + } + } + template + bool + assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) + { + return assign_to(f,functor,function_ptr_tag()); + } + + // Member pointers +#if BOOST_FUNCTION_NUM_ARGS > 0 + template + bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) + { + // DPG TBD: Add explicit support for member function + // objects, so we invoke through mem_fn() but we retain the + // right target_type() values. + if (f) { + this->assign_to(mem_fn(f), functor); + return true; + } else { + return false; + } + } + template + bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) + { + // DPG TBD: Add explicit support for member function + // objects, so we invoke through mem_fn() but we retain the + // right target_type() values. + if (f) { + this->assign_to_a(mem_fn(f), functor, a); + return true; + } else { + return false; + } + } +#endif // BOOST_FUNCTION_NUM_ARGS > 0 + + // Function objects + // Assign to a function object using the small object optimization + template + void + assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) + { + new ((void*)&functor.data) FunctionObj(f); + } + template + void + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) + { + assign_functor(f,functor,mpl::true_()); + } + + // Assign to a function object allocated on the heap. + template + void + assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) + { + functor.obj_ptr = new FunctionObj(f); + } + template + void + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) + { + typedef functor_wrapper functor_wrapper_type; + typedef typename Allocator::template rebind::other + wrapper_allocator_type; + typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; + wrapper_allocator_type wrapper_allocator(a); + wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); + wrapper_allocator.construct(copy, functor_wrapper_type(f,a)); + functor_wrapper_type* new_f = static_cast(copy); + functor.obj_ptr = new_f; + } + + template + bool + assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) + { + if (!boost::detail::function::has_empty_target(boost::addressof(f))) { + assign_functor(f, functor, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + return true; + } else { + return false; + } + } + template + bool + assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) + { + if (!boost::detail::function::has_empty_target(boost::addressof(f))) { + assign_functor_a(f, functor, a, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + return true; + } else { + return false; + } + } + + // Reference to a function object + template + bool + assign_to(const reference_wrapper& f, + function_buffer& functor, function_obj_ref_tag) + { + if (!boost::detail::function::has_empty_target(f.get_pointer())) { + functor.obj_ref.obj_ptr = (void *)f.get_pointer(); + functor.obj_ref.is_const_qualified = is_const::value; + functor.obj_ref.is_volatile_qualified = is_volatile::value; + return true; + } else { + return false; + } + } + template + bool + assign_to_a(const reference_wrapper& f, + function_buffer& functor, Allocator, function_obj_ref_tag) + { + return assign_to(f,functor,function_obj_ref_tag()); + } + + public: + vtable_base base; + invoker_type invoker; + }; + } // end namespace function + } // end namespace detail + + template< + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + class BOOST_FUNCTION_FUNCTION : public function_base + +#if BOOST_FUNCTION_NUM_ARGS == 1 + + , public std::unary_function + +#elif BOOST_FUNCTION_NUM_ARGS == 2 + + , public std::binary_function + +#endif + + { + public: +#ifndef BOOST_NO_VOID_RETURNS + typedef R result_type; +#else + typedef typename boost::detail::function::function_return_type::type + result_type; +#endif // BOOST_NO_VOID_RETURNS + + private: + typedef boost::detail::function::BOOST_FUNCTION_VTABLE< + R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> + vtable_type; + + struct clear_type {}; + + public: + BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); + + // add signature for boost::lambda + template + struct sig + { + typedef result_type type; + }; + +#if BOOST_FUNCTION_NUM_ARGS == 1 + typedef T0 argument_type; +#elif BOOST_FUNCTION_NUM_ARGS == 2 + typedef T0 first_argument_type; + typedef T1 second_argument_type; +#endif + + BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS); + BOOST_FUNCTION_ARG_TYPES + + typedef BOOST_FUNCTION_FUNCTION self_type; + + BOOST_FUNCTION_FUNCTION() : function_base() { } + + // MSVC chokes if the following two constructors are collapsed into + // one with a default parameter. + template + BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< + (boost::type_traits::ice_not< + (is_integral::value)>::value), + int>::type = 0 +#endif // BOOST_NO_SFINAE + ) : + function_base() + { + this->assign_to(f); + } + template + BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< + (boost::type_traits::ice_not< + (is_integral::value)>::value), + int>::type = 0 +#endif // BOOST_NO_SFINAE + ) : + function_base() + { + this->assign_to_a(f,a); + } + +#ifndef BOOST_NO_SFINAE + BOOST_FUNCTION_FUNCTION(clear_type*) : function_base() { } +#else + BOOST_FUNCTION_FUNCTION(int zero) : function_base() + { + BOOST_ASSERT(zero == 0); + } +#endif + + BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() + { + this->assign_to_own(f); + } + + ~BOOST_FUNCTION_FUNCTION() { clear(); } + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + // MSVC 6.0 and prior require all definitions to be inline, but + // these definitions can become very costly. + result_type operator()(BOOST_FUNCTION_PARMS) const + { + if (this->empty()) + boost::throw_exception(bad_function_call()); + + return static_cast(vtable)->invoker + (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); + } +#else + result_type operator()(BOOST_FUNCTION_PARMS) const; +#endif + + // The distinction between when to use BOOST_FUNCTION_FUNCTION and + // when to use self_type is obnoxious. MSVC cannot handle self_type as + // the return type of these assignment operators, but Borland C++ cannot + // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to + // construct. + template +#ifndef BOOST_NO_SFINAE + typename enable_if_c< + (boost::type_traits::ice_not< + (is_integral::value)>::value), + BOOST_FUNCTION_FUNCTION&>::type +#else + BOOST_FUNCTION_FUNCTION& +#endif + operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) + { + this->clear(); + try { + this->assign_to(f); + } catch (...) { + vtable = 0; + throw; + } + return *this; + } + template + void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a) + { + this->clear(); + try { + this->assign_to_a(f,a); + } catch (...) { + vtable = 0; + throw; + } + } + +#ifndef BOOST_NO_SFINAE + BOOST_FUNCTION_FUNCTION& operator=(clear_type*) + { + this->clear(); + return *this; + } +#else + BOOST_FUNCTION_FUNCTION& operator=(int zero) + { + BOOST_ASSERT(zero == 0); + this->clear(); + return *this; + } +#endif + + // Assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) + { + if (&f == this) + return *this; + + this->clear(); + try { + this->assign_to_own(f); + } catch (...) { + vtable = 0; + throw; + } + return *this; + } + + void swap(BOOST_FUNCTION_FUNCTION& other) + { + if (&other == this) + return; + + BOOST_FUNCTION_FUNCTION tmp; + tmp.move_assign(*this); + this->move_assign(other); + other.move_assign(tmp); + } + + // Clear out a target, if there is one + void clear() + { + if (vtable) { + reinterpret_cast(vtable)->clear(this->functor); + vtable = 0; + } + } + +#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) + // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it + operator bool () const { return !this->empty(); } +#else + private: + struct dummy { + void nonnull() {}; + }; + + typedef void (dummy::*safe_bool)(); + + public: + operator safe_bool () const + { return (this->empty())? 0 : &dummy::nonnull; } + + bool operator!() const + { return this->empty(); } +#endif + + private: + void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) + { + if (!f.empty()) { + this->vtable = f.vtable; + f.vtable->manager(f.functor, this->functor, + boost::detail::function::clone_functor_tag); + } + } + + template + void assign_to(Functor f) + { + using detail::function::vtable_base; + + typedef typename detail::function::get_function_tag::type tag; + typedef detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; + typedef typename get_invoker:: + template apply + handler_type; + + typedef typename handler_type::invoker_type invoker_type; + typedef typename handler_type::manager_type manager_type; + + // Note: it is extremely important that this initialization use + // static initialization. Otherwise, we will have a race + // condition here in multi-threaded code. See + // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. + static vtable_type stored_vtable = + { { &manager_type::manage }, &invoker_type::invoke }; + + if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable.base; + else vtable = 0; + } + + template + void assign_to_a(Functor f,Allocator a) + { + using detail::function::vtable_base; + + typedef typename detail::function::get_function_tag::type tag; + typedef detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; + typedef typename get_invoker:: + template apply_a + handler_type; + + typedef typename handler_type::invoker_type invoker_type; + typedef typename handler_type::manager_type manager_type; + + // Note: it is extremely important that this initialization use + // static initialization. Otherwise, we will have a race + // condition here in multi-threaded code. See + // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. + static vtable_type stored_vtable = + { { &manager_type::manage }, &invoker_type::invoke }; + + if (stored_vtable.assign_to_a(f, functor, a)) vtable = &stored_vtable.base; + else vtable = 0; + } + + // Moves the value from the specified argument to *this. If the argument + // has its function object allocated on the heap, move_assign will pass + // its buffer to *this, and set the argument's buffer pointer to NULL. + void move_assign(BOOST_FUNCTION_FUNCTION& f) + { + if (&f == this) + return; + +#if !defined(BOOST_NO_EXCEPTIONS) + try { +#endif + if (!f.empty()) { + this->vtable = f.vtable; + f.vtable->manager(f.functor, this->functor, + boost::detail::function::move_functor_tag); + f.vtable = 0; +#if !defined(BOOST_NO_EXCEPTIONS) + } else { + clear(); + } + } catch (...) { + vtable = 0; + throw; + } +#endif + } + }; + + template + inline void swap(BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >& f1, + BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >& f2) + { + f1.swap(f2); + } + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template + typename BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>::result_type + BOOST_FUNCTION_FUNCTION + ::operator()(BOOST_FUNCTION_PARMS) const + { + if (this->empty()) + boost::throw_exception(bad_function_call()); + + return reinterpret_cast(vtable)->invoker + (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); + } +#endif + +// Poison comparisons between boost::function objects of the same type. +template + void operator==(const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>&, + const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>&); +template + void operator!=(const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>&, + const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>& ); + +#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) + +#if BOOST_FUNCTION_NUM_ARGS == 0 +#define BOOST_FUNCTION_PARTIAL_SPEC R (void) +#else +#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T)) +#endif + +template +class function + : public BOOST_FUNCTION_FUNCTION +{ + typedef BOOST_FUNCTION_FUNCTION base_type; + typedef function self_type; + + struct clear_type {}; + +public: + + function() : base_type() {} + + template + function(Functor f +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< + (boost::type_traits::ice_not< + (is_integral::value)>::value), + int>::type = 0 +#endif + ) : + base_type(f) + { + } + template + function(Functor f, Allocator a +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< + (boost::type_traits::ice_not< + (is_integral::value)>::value), + int>::type = 0 +#endif + ) : + base_type(f,a) + { + } + +#ifndef BOOST_NO_SFINAE + function(clear_type*) : base_type() {} +#endif + + function(const self_type& f) : base_type(static_cast(f)){} + + function(const base_type& f) : base_type(static_cast(f)){} + + self_type& operator=(const self_type& f) + { + self_type(f).swap(*this); + return *this; + } + + template +#ifndef BOOST_NO_SFINAE + typename enable_if_c< + (boost::type_traits::ice_not< + (is_integral::value)>::value), + self_type&>::type +#else + self_type& +#endif + operator=(Functor f) + { + self_type(f).swap(*this); + return *this; + } + +#ifndef BOOST_NO_SFINAE + self_type& operator=(clear_type*) + { + this->clear(); + return *this; + } +#endif + + self_type& operator=(const base_type& f) + { + self_type(f).swap(*this); + return *this; + } +}; + +#undef BOOST_FUNCTION_PARTIAL_SPEC +#endif // have partial specialization + +} // end namespace boost + +// Cleanup after ourselves... +#undef BOOST_FUNCTION_VTABLE +#undef BOOST_FUNCTION_COMMA +#undef BOOST_FUNCTION_FUNCTION +#undef BOOST_FUNCTION_FUNCTION_INVOKER +#undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER +#undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER +#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER +#undef BOOST_FUNCTION_MEMBER_INVOKER +#undef BOOST_FUNCTION_VOID_MEMBER_INVOKER +#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER +#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER +#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER +#undef BOOST_FUNCTION_GET_INVOKER +#undef BOOST_FUNCTION_TEMPLATE_PARMS +#undef BOOST_FUNCTION_TEMPLATE_ARGS +#undef BOOST_FUNCTION_PARMS +#undef BOOST_FUNCTION_PARM +#undef BOOST_FUNCTION_ARGS +#undef BOOST_FUNCTION_ARG_TYPE +#undef BOOST_FUNCTION_ARG_TYPES +#undef BOOST_FUNCTION_VOID_RETURN_TYPE +#undef BOOST_FUNCTION_RETURN + +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/function_typeof.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function/function_typeof.hpp new file mode 100644 index 0000000000..246dc15d09 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/function_typeof.hpp @@ -0,0 +1,45 @@ +// Boost.Function library - Typeof support +// Copyright (C) Douglas Gregor 2008 +// +// Use, modification and distribution is subject to the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org +#ifndef BOOST_FUNCTION_TYPEOF_HPP +#define BOOST_FUNCTION_TYPEOF_HPP +#include +#include + +#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() + +BOOST_TYPEOF_REGISTER_TYPE(boost::bad_function_call) + +#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, (typename)) +#endif + +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function0, (typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, (typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function2, (typename)(typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function3, + (typename)(typename)(typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function4, + (typename)(typename)(typename)(typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function5, + (typename)(typename)(typename)(typename)(typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function6, + (typename)(typename)(typename)(typename)(typename)(typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function7, + (typename)(typename)(typename)(typename)(typename)(typename)(typename) + (typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function8, + (typename)(typename)(typename)(typename)(typename)(typename)(typename) + (typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function9, + (typename)(typename)(typename)(typename)(typename)(typename)(typename) + (typename)(typename)(typename)) +BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function10, + (typename)(typename)(typename)(typename)(typename)(typename)(typename) + (typename)(typename)(typename)(typename)) +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function/gen_function_N.pl b/deal.II/contrib/boost/include/boost-1.37.0/function/gen_function_N.pl new file mode 100644 index 0000000000..d8f1249b07 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function/gen_function_N.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl -w +# +# Boost.Function library +# +# Copyright Douglas Gregor 2001-2003. Use, modification and +# distribution is subject to the Boost Software License, Version +# 1.0. (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# For more information, see http://www.boost.org +use English; + +if ($#ARGV < 0) { + print "Usage: perl gen_function_N \n"; + exit; +} + + +$totalNumArgs = $ARGV[0]; +for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) { + open OUT, ">function$numArgs.hpp"; + print OUT "#define BOOST_FUNCTION_NUM_ARGS $numArgs\n"; + print OUT "#include \n"; + print OUT "#undef BOOST_FUNCTION_NUM_ARGS\n"; + close OUT; +} diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_equal.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_equal.hpp new file mode 100644 index 0000000000..2d76c75bc9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_equal.hpp @@ -0,0 +1,28 @@ +// Copyright Douglas Gregor 2004. +// Copyright 2005 Peter Dimov + +// Use, modification and distribution is subject to +// the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org +#ifndef BOOST_FUNCTION_EQUAL_HPP +#define BOOST_FUNCTION_EQUAL_HPP + +namespace boost { + +template + bool function_equal_impl(const F& f, const G& g, long) + { return f == g; } + +// function_equal_impl needs to be unqualified to pick +// user overloads on two-phase compilers + +template + bool function_equal(const F& f, const G& g) + { return function_equal_impl(f, g, 0); } + +} // end namespace boost + +#endif // BOOST_FUNCTION_EQUAL_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_output_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_output_iterator.hpp new file mode 100644 index 0000000000..9720f3f3d1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_output_iterator.hpp @@ -0,0 +1,56 @@ +// (C) Copyright Jeremy Siek 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) + +// Revision History: + +// 27 Feb 2001 Jeremy Siek +// Initial checkin. + +#ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP +#define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP + +#include + +namespace boost { + + template + class function_output_iterator { + typedef function_output_iterator self; + public: + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + explicit function_output_iterator() {} + + explicit function_output_iterator(const UnaryFunction& f) + : m_f(f) {} + + struct output_proxy { + output_proxy(UnaryFunction& f) : m_f(f) { } + template output_proxy& operator=(const T& value) { + m_f(value); + return *this; + } + UnaryFunction& m_f; + }; + output_proxy operator*() { return output_proxy(m_f); } + self& operator++() { return *this; } + self& operator++(int) { return *this; } + private: + UnaryFunction m_f; + }; + + template + inline function_output_iterator + make_function_output_iterator(const UnaryFunction& f = UnaryFunction()) { + return function_output_iterator(f); + } + +} // namespace boost + +#endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/components.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/components.hpp new file mode 100644 index 0000000000..a4432c558d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/components.hpp @@ -0,0 +1,431 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_COMPONENTS_HPP_INCLUDED +#define BOOST_FT_COMPONENTS_HPP_INCLUDED + +#include + +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x656)) +# include + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include +#endif + +#ifndef BOOST_FT_NO_CV_FUNC_SUPPORT +# include +#endif + +#include + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# if BOOST_FT_MAX_ARITY < 10 +# include +# elif BOOST_FT_MAX_ARITY < 20 +# include +# elif BOOST_FT_MAX_ARITY < 30 +# include +# elif BOOST_FT_MAX_ARITY < 40 +# include +# elif BOOST_FT_MAX_ARITY < 50 +# include +# endif +#else +# include +#endif + +#include +#include + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +namespace boost +{ + namespace function_types + { + + using mpl::placeholders::_; + + template< typename T, typename ClassTypeTransform = add_reference<_> > + struct components; + + namespace detail + { + template struct components_impl; +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x565)) + template struct components_bcc; +#endif + } + + template + struct components +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x565)) + : detail::components_impl +#else + : detail::components_bcc::type,T, + ClassTypeTransform> +#endif + { + typedef components type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,components,(T,ClassTypeTransform)) + }; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + namespace detail { + + struct components_mpl_sequence_tag; + + struct components_non_func_base + { + typedef mpl::vector0<> types; + typedef void function_arity; + + typedef detail::constant<0> bits; + typedef detail::constant<0> mask; + + typedef components_mpl_sequence_tag tag; + }; + + template + < typename Components + , typename IfTagged + , typename ThenTag + , typename DefaultBase = components_non_func_base + > + struct retagged_if + : mpl::if_ + < detail::represents_impl + , detail::changed_tag + , DefaultBase + >::type + { }; + + // We detect plain function types and function references as function + // pointers by recursive instantiation of components_impl. + // The third specialization of components_impl makes sure the recursion + // terminates (when adding pointers). + template + struct components_impl + : detail::retagged_if + < detail::components_impl + , pointer_tag, /* --> */ function_tag > + { }; + template + struct components_impl + : detail::retagged_if + < detail::components_impl + , pointer_tag, /* --> */ reference_tag > + { }; + +#if !BOOST_FT_NO_CV_FUNC_SUPPORT + // Retry the type with a member pointer attached to detect cv functions + class a_class; + + template + struct cv_func_base + : detail::retagged_if + { + typedef typename + mpl::remove + < typename Base::types + , typename detail::class_transform::type>::type + types; + }; + + template + struct components_impl + : mpl::if_ + < detail::represents_impl< detail::components_impl + , member_pointer_tag > + , detail::cv_func_base< detail::components_impl, T, L> + , components_non_func_base + >::type + { }; + + template + struct components_impl + : components_non_func_base + { }; +#else + template + struct components_impl + : components_non_func_base + { }; +#endif + + template + struct components_impl + : components_impl + { }; + + template + struct components_impl + : components_impl + { }; + + template + struct components_impl + : components_impl + { }; + + template + struct components_impl + : components_impl + { }; + + template + struct components_impl + : components_impl + { }; + + template + struct components_impl + : components_impl + { }; + + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T const & type; }; + + template + struct member_obj_ptr_result + { typedef T volatile & type; }; + + template + struct member_obj_ptr_result + { typedef T const volatile & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_result + { typedef T & type; }; + + template + struct member_obj_ptr_components + : member_object_pointer_base + { + typedef function_types::components type; + typedef components_mpl_sequence_tag tag; + + typedef mpl::integral_c function_arity; + + typedef mpl::vector2< typename detail::member_obj_ptr_result::type, + typename detail::class_transform::type > types; + }; + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x565)) +# define BOOST_FT_variations BOOST_FT_pointer|BOOST_FT_member_pointer + + template + struct components_impl + : member_obj_ptr_components + { }; + +#else +# define BOOST_FT_variations BOOST_FT_pointer + + // This workaround removes the member pointer from the type to allow + // detection of member function pointers with BCC. + template + struct components_impl + : detail::retagged_if + < detail::components_impl::type *, L> + , pointer_tag, /* --> */ member_function_pointer_tag + , member_obj_ptr_components > + { }; + + // BCC lets us test the cv-qualification of a function type by template + // partial specialization - so we use this bug feature to find out the + // member function's cv-qualification (unfortunately there are some + // invisible modifiers that impose some limitations on these types even if + // we remove the qualifiers, So we cannot exploit the same bug to make the + // library work for cv-qualified function types). + template struct encode_cv + { typedef char (& type)[1]; BOOST_STATIC_CONSTANT(std::size_t, value = 1); }; + template struct encode_cv + { typedef char (& type)[2]; BOOST_STATIC_CONSTANT(std::size_t, value = 2); }; + template struct encode_cv + { typedef char (& type)[3]; BOOST_STATIC_CONSTANT(std::size_t, value = 3); }; + template struct encode_cv + { typedef char (& type)[4]; BOOST_STATIC_CONSTANT(std::size_t, value = 4); }; + + // For member function pointers we have to use a function template (partial + // template specialization for a member pointer drops the cv qualification + // of the function type). + template + typename encode_cv::type mfp_cv_tester(T C::*); + + template struct encode_mfp_cv + { + BOOST_STATIC_CONSTANT(std::size_t, value = + sizeof(detail::mfp_cv_tester((T)0L))); + }; + + // Associate bits with the CV codes above. + template struct cv_tag_mfp_impl; + + template struct cv_tag_mfp + : detail::cv_tag_mfp_impl + < ::boost::function_types::detail::encode_mfp_cv::value > + { }; + + template<> struct cv_tag_mfp_impl<1> : non_cv { }; + template<> struct cv_tag_mfp_impl<2> : const_non_volatile { }; + template<> struct cv_tag_mfp_impl<3> : volatile_non_const { }; + template<> struct cv_tag_mfp_impl<4> : cv_qualified { }; + + // Metafunction to decode the cv code and apply it to a type. + // We add a pointer, because otherwise cv-qualifiers won't stick (another bug). + template struct decode_cv; + + template struct decode_cv : mpl::identity {}; + template struct decode_cv : mpl::identity {}; + template struct decode_cv : mpl::identity {}; + template struct decode_cv + : mpl::identity {}; + + // The class type transformation comes after adding cv-qualifiers. We have + // wrap it to remove the pointer added in decode_cv_impl. + template struct bcc_class_transform_impl; + template struct bcc_class_transform_impl + : class_transform + { }; + + template struct bcc_class_transform + : bcc_class_transform_impl + < typename decode_cv + < T + , ::boost::function_types::detail::encode_mfp_cv::value + >::type + , L + > + { }; + + // After extracting the member pointee from the type the class type is still + // in the type (somewhere -- you won't see with RTTI, that is) and that type + // is flagged unusable and *not* identical to the nonmember function type. + // We can, however, decompose this type via components_impl but surprisingly + // a pointer to the const qualified class type pops up again as the first + // parameter type. + // We have to replace this type with the properly cv-qualified and + // transformed class type, integrate the cv qualification into the bits. + template + struct mfp_components; + + + template + struct mfp_components + { + private: + typedef typename mpl::front::type result_type; + typedef typename detail::bcc_class_transform::type class_type; + + typedef mpl::vector2 result_and_class_type; + + typedef typename + mpl::advance + < typename mpl::begin::type + , typename mpl::if_ + < mpl::equal_to< typename detail::classifier::function_arity + , typename Base::function_arity > + , mpl::integral_c , mpl::integral_c + >::type + >::type + from; + typedef typename mpl::end::type to; + + typedef mpl::iterator_range param_types; + + typedef mpl::joint_view< result_and_class_type, param_types> types_view; + public: + + typedef typename + mpl::reverse_copy > >::type + types; + + typedef typename + function_types::tag< Base, detail::cv_tag_mfp >::bits + bits; + + typedef typename Base::mask mask; + + typedef typename detail::classifier::function_arity function_arity; + + typedef components_mpl_sequence_tag tag; + }; + + // Now put it all together: detect cv-qualification of function types and do + // the weird transformations above for member function pointers. + template + struct components_bcc + : mpl::if_ + < detail::represents_impl< detail::components_impl + , member_function_pointer_tag> + , detail::mfp_components,T,OrigT,L> + , detail::components_impl + >::type + { }; + +#endif // end of BORLAND WORKAROUND + +#define BOOST_FT_al_path boost/function_types/detail/components_impl +#include + + } } // namespace function_types::detail + + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::components) + +} // namespace ::boost + +#include +#include + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/cc_names.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/cc_names.hpp new file mode 100644 index 0000000000..ab69d64624 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/cc_names.hpp @@ -0,0 +1,31 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_CONFIG_CC_NAMES_HPP_INCLUDED +#define BOOST_FT_CONFIG_CC_NAMES_HPP_INCLUDED + +#define BOOST_FT_BUILTIN_CC_NAMES \ + (( IMPLICIT , implicit_cc , BOOST_PP_EMPTY ))\ + (( CDECL , cdecl_cc , BOOST_PP_IDENTITY(__cdecl ) ))\ + (( STDCALL , stdcall_cc , BOOST_PP_IDENTITY(__stdcall ) ))\ + (( PASCAL , pascal_cc , BOOST_PP_IDENTITY(pascal ) ))\ + (( FASTCALL , fastcall_cc , BOOST_PP_IDENTITY(__fastcall) ))\ + (( CLRCALL , clrcall_cc , BOOST_PP_IDENTITY(__clrcall ) ))\ + (( THISCALL , thiscall_cc , BOOST_PP_IDENTITY(__thiscall) ))\ + (( IMPLICIT_THISCALL , thiscall_cc , BOOST_PP_EMPTY )) + +// append user-defined cc names to builtin ones +#ifdef BOOST_FT_CC_NAMES +# define BOOST_FT_CC_NAMES_SEQ BOOST_FT_BUILTIN_CC_NAMES BOOST_FT_CC_NAMES +# define BOOST_FT_CC_PREPROCESSING 1 +#else +# define BOOST_FT_CC_NAMES_SEQ BOOST_FT_BUILTIN_CC_NAMES +#endif + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/compiler.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/compiler.hpp new file mode 100644 index 0000000000..151c856740 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/compiler.hpp @@ -0,0 +1,116 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_CONFIG_COMPILER_HPP_INCLUDED +#define BOOST_FT_CONFIG_COMPILER_HPP_INCLUDED + +#include +#include + +#if defined(BOOST_MSVC) + +# if BOOST_MSVC < 1310 +# error "unsupported compiler version" +# endif + +# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS + + // enable clrcall calling covention (call to .NET managed code) when + // compiling with /clr +# if BOOST_MSVC >= 1400 && defined(__cplusplus_cli) +# ifndef BOOST_FT_CC_CLRCALL +# define BOOST_FT_CC_CLRCALL callable_builtin +# endif +# endif + + // Intel x86 architecture specific calling conventions +# ifdef _M_IX86 +# define BOOST_FT_COMMON_X86_CCs callable_builtin +# if BOOST_MSVC < 1400 + // version 7.1 is missing a keyword to specify the thiscall cc ... +# ifndef BOOST_FT_CC_IMPLICIT_THISCALL +# define BOOST_FT_CC_IMPLICIT_THISCALL non_variadic|member|callable_builtin +# ifndef BOOST_FT_CONFIG_OK +# pragma message("INFO| /Gd /Gr /Gz will compiler options will cause") +# pragma message("INFO| a compile error.") +# pragma message("INFO| Reconfigure Boost.FunctionTypes in this case.") +# pragma message("INFO| This message can be suppressed by defining") +# pragma message("INFO| BOOST_FT_CONFIG_OK.") +# endif +# endif +# else + // ...introduced in version 8 +# ifndef BOOST_FT_CC_THISCALL +# define BOOST_FT_CC_THISCALL non_variadic|member|callable_builtin +# endif +# endif +# endif +# endif + +#elif defined(__GNUC__) && !defined(BOOST_INTEL_LINUX) + +# if __GNUC__ < 3 +# error "unsupported compiler version" +# endif + +# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS + +# if defined(__i386__) +# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20439 +# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29328 +# if BOOST_WORKAROUND(__GNUC__,BOOST_TESTED_AT(4)) +# ifndef BOOST_FT_CC_IMPLICIT +# define BOOST_FT_CC_IMPLICIT member|callable_builtin +# endif +# define BOOST_FT_COMMON_X86_CCs non_member|callable_builtin +# else +# define BOOST_FT_COMMON_X86_CCs callable_builtin +# endif +# else +# ifndef BOOST_FT_CC_IMPLICIT +# define BOOST_FT_CC_IMPLICIT callable_builtin +# endif +# endif +# endif + +# if (defined(BOOST_FT_CC_CDECL) || defined(BOOST_FT_COMMON_X86_CCs)) \ + && !defined(__cdecl) +# define __cdecl __attribute__((__cdecl__)) +# endif +# if (defined(BOOST_FT_CC_STDCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \ + && !defined(__stdcall) +# define __stdcall __attribute__((__stdcall__)) +# endif +# if (defined(BOOST_FT_CC_FASTCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \ + && !defined(__fastcall) +# define __fastcall __attribute__((__fastcall__)) +# endif + +#elif defined(__BORLANDC__) + +# if __BORLANDC__ < 0x550 +# error "unsupported compiler version" +# elif __BORLANDC__ > 0x565 +# pragma message("WARNING: library untested with this compiler version") +# endif + +# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS +# define BOOST_FT_COMMON_X86_CCs callable_builtin +# endif + + // syntactic specialities of cc specifier +# define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \ + result() cc_spec() lparen() type_mod() name() rparen() +#else + // only enable default calling convention +# define BOOST_FT_CC_IMPLICIT callable_builtin +#endif + + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/config.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/config.hpp new file mode 100644 index 0000000000..7ec8e1e8fe --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/config/config.hpp @@ -0,0 +1,59 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_CONFIG_HPP_INCLUDED +#define BOOST_FT_CONFIG_HPP_INCLUDED + +#include +#include + +// maximum allowed arity +#ifndef BOOST_FT_MAX_ARITY +#define BOOST_FT_MAX_ARITY 20 +#endif + +// the most common calling conventions for x86 architecture can be enabled at +// once in the compiler config +#ifdef BOOST_FT_COMMON_X86_CCs +# ifndef BOOST_FT_CC_CDECL +# define BOOST_FT_CC_CDECL BOOST_FT_COMMON_X86_CCs +# endif +# ifndef BOOST_FT_CC_STDCALL +# define BOOST_FT_CC_STDCALL non_variadic|BOOST_FT_COMMON_X86_CCs +# endif +# ifndef BOOST_FT_CC_FASTCALL +# define BOOST_FT_CC_FASTCALL non_variadic|BOOST_FT_COMMON_X86_CCs +# endif +#endif + +// where to place the cc specifier (the common way) +#ifndef BOOST_FT_SYNTAX +# define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \ + result() lparen() cc_spec() type_mod() name() rparen() +#endif + +// param for nullary functions +// set to "void" for compilers that require nullary functions to read +// "R (void)" in template partial specialization +#ifndef BOOST_FT_NULLARY_PARAM +#define BOOST_FT_NULLARY_PARAM +#endif + +// there is a pending defect report on cv qualified function types, so support +// for these types is disabled, unless for compilers where it's known to work +#ifndef BOOST_FT_NO_CV_FUNC_SUPPORT +#define BOOST_FT_NO_CV_FUNC_SUPPORT 1 +#endif + +// full preprocessing implies preprocessing of the ccs +#if defined(BOOST_FT_PREPROCESSING_MODE) && !defined(BOOST_FT_CC_PREPROCESSING) +# define BOOST_FT_CC_PREPROCESSING 1 +#endif + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/class_transform.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/class_transform.hpp new file mode 100644 index 0000000000..ef9a2253b3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/class_transform.hpp @@ -0,0 +1,62 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_CLASS_TRANSFORM_HPP_INCLUDED +#define BOOST_FT_DETAIL_CLASS_TRANSFORM_HPP_INCLUDED + +#include +#include +#include +#include + +#include +#include +#include + +namespace boost { namespace function_types { namespace detail { + +using mpl::placeholders::_; + +// Transformation metafunction for the class type of member function pointers. +template +struct class_transform +{ typedef typename mpl::apply1::type type; }; + + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +// We can short-circuit the mechanism implemented in the primary template for +// the most common lambda expression and save both the "un-lambdaing" and the +// type traits invocation (we know that T can only be a class type). + +template struct class_transform< T, mpl::identity<_> > +{ typedef T type; }; + +template struct class_transform< T, add_reference<_> > +{ typedef T & type; }; + +template struct class_transform< T, add_pointer<_> > +{ typedef T * type; }; + +template struct class_transform< T, remove_cv<_> > +{ typedef typename boost::remove_cv::type type; }; + +template struct class_transform< T, add_reference< remove_cv<_> > > +{ typedef typename boost::remove_cv::type & type; }; + +template struct class_transform< T, add_pointer< remove_cv<_> > > +{ typedef typename boost::remove_cv::type * type; }; + +template struct class_transform< T, mpl::always > +{ typedef U type; }; +#endif + + +} } } // namespace ::boost::function_types::detail + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier.hpp new file mode 100644 index 0000000000..03f3419b9f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier.hpp @@ -0,0 +1,82 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_CLASSIFIER_HPP_INCLUDED +#define BOOST_FT_DETAIL_CLASSIFIER_HPP_INCLUDED + +#include +#include +#include +#include +#include + +#include +#include + +namespace boost { namespace function_types { namespace detail { + +template struct classifier; + +template struct char_array { typedef char (&type)[S]; }; + +template struct encode_charr +{ + typedef typename char_array< + ::boost::function_types::detail::encode_charr_impl::value + >::type type; +}; + +char BOOST_TT_DECL classifier_impl(...); + +#define BOOST_FT_variations BOOST_FT_function|BOOST_FT_pointer|\ + BOOST_FT_member_pointer + +#define BOOST_FT_type_function(cc,name) BOOST_FT_SYNTAX( \ + R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,* BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) + +#define BOOST_FT_type_function_pointer(cc,name) BOOST_FT_SYNTAX( \ + R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,** BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) + +#define BOOST_FT_type_member_function_pointer(cc,name) BOOST_FT_SYNTAX( \ + R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,T0::** BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) + +#define BOOST_FT_al_path boost/function_types/detail/classifier_impl +#include + +template struct classifier_bits +{ + static typename boost::add_reference::type tester; + + BOOST_STATIC_CONSTANT(bits_t,value = (bits_t)sizeof( + boost::function_types::detail::classifier_impl(& tester) + )-1); +}; + +template struct classifier +{ + typedef detail::constant< + ::boost::function_types::detail::decode_bits< + ::boost::function_types::detail::classifier_bits::value + >::tag_bits > + bits; + + typedef detail::full_mask mask; + + typedef detail::constant< + ::boost::function_types::detail::decode_bits< + ::boost::function_types::detail::classifier_bits::value + >::arity > + function_arity; +}; + + + +} } } // namespace ::boost::function_types::detail + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity10_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity10_0.hpp new file mode 100644 index 0000000000..e27f3c2d67 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity10_0.hpp @@ -0,0 +1,55 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +template< typename R > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (BOOST_FT_nullary_param BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity10_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity10_1.hpp new file mode 100644 index 0000000000..cca8027a00 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity10_1.hpp @@ -0,0 +1,52 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +template< typename R , typename T0 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) ( BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity20_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity20_0.hpp new file mode 100644 index 0000000000..f7a25169e4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity20_0.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity20_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity20_1.hpp new file mode 100644 index 0000000000..1cee2ba35a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity20_1.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity30_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity30_0.hpp new file mode 100644 index 0000000000..6bc60f86e8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity30_0.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity30_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity30_1.hpp new file mode 100644 index 0000000000..743c263bef --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity30_1.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity40_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity40_0.hpp new file mode 100644 index 0000000000..161ac1751e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity40_0.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity40_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity40_1.hpp new file mode 100644 index 0000000000..e3a99887d4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity40_1.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity50_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity50_0.hpp new file mode 100644 index 0000000000..d05719a3f9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity50_0.hpp @@ -0,0 +1,53 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49 BOOST_FT_ell) BOOST_FT_cv); + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity50_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity50_1.hpp new file mode 100644 index 0000000000..944eabaa06 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/arity50_1.hpp @@ -0,0 +1,52 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 BOOST_FT_ell) BOOST_FT_cv); +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49 > +typename encode_charr ::type +classifier_impl(BOOST_FT_syntax(BOOST_FT_cc, BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49 BOOST_FT_ell) BOOST_FT_cv); diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/master.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/master.hpp new file mode 100644 index 0000000000..00b722e345 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/classifier_impl/master.hpp @@ -0,0 +1,33 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +#if BOOST_FT_ARITY_LOOP_PREFIX + +# ifndef BOOST_FT_DETAIL_CLASSIFIER_IMPL_MASTER_HPP_INCLUDED +# define BOOST_FT_DETAIL_CLASSIFIER_IMPL_MASTER_HPP_INCLUDED +# include +# endif + +# define BOOST_FT_type_name + +#elif BOOST_FT_ARITY_LOOP_IS_ITERATING + +template< BOOST_FT_tplargs(BOOST_PP_IDENTITY(typename)) > +typename encode_charr::type +classifier_impl(BOOST_FT_type); + +#elif BOOST_FT_ARITY_LOOP_SUFFIX + +# undef BOOST_FT_type_name + +#else +# error "attempt to use arity loop master file without loop" +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_as_mpl_sequence.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_as_mpl_sequence.hpp new file mode 100644 index 0000000000..637b1b52bb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_as_mpl_sequence.hpp @@ -0,0 +1,138 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_COMPONENTS_AS_MPL_SEQUENCE_HPP_INCLUDED +#define BOOST_FT_DETAIL_COMPONENTS_AS_MPL_SEQUENCE_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace mpl { + +template<> struct size_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > struct apply + : mpl::size + { }; +}; +template<> struct empty_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > struct apply + : mpl::empty + { }; +}; +template<> struct front_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > struct apply + : mpl::front + { }; +}; +template<> struct back_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > struct apply + : mpl::back + { }; +}; +template<> struct at_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S, typename N > struct apply + : mpl::at + { }; +}; +template<> struct begin_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > struct apply + : mpl::begin + { }; +}; +template<> struct end_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > struct apply + : mpl::end + { }; +}; +template<> struct clear_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > + struct apply + : S + { + typedef apply type; + typedef typename mpl::clear< typename S::types >::type types; + }; +}; +template<> +struct push_front_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S, typename T > + struct apply + : S + { + typedef apply type; + typedef typename mpl::push_front< typename S::types, T >::type types; + }; +}; +template<> +struct pop_front_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > + struct apply + : S + { + typedef apply type; + typedef typename mpl::pop_front< typename S::types >::type types; + }; +}; +template<> +struct push_back_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S, typename T > + struct apply + : S + { + typedef apply type; + typedef typename mpl::push_back< typename S::types, T >::type types; + }; +}; +template<> +struct pop_back_impl +< function_types::detail::components_mpl_sequence_tag > +{ + template< typename S > + struct apply + : S + { + typedef apply type; + typedef typename mpl::pop_back< typename S::types >::type types; + }; +}; + +} } // namespace ::boost::mpl + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity10_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity10_0.hpp new file mode 100644 index 0000000000..f96c6a9f73 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity10_0.hpp @@ -0,0 +1,132 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +template< typename R, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector1< R BOOST_FT_nullary_param > types; +}; +template< typename R , typename T0, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector2< R , T0 > types; +}; +template< typename R , typename T0 , typename T1, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector3< R , T0 , T1 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector4< R , T0 , T1 , T2 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector5< R , T0 , T1 , T2 , T3 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector6< R , T0 , T1 , T2 , T3 , T4 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector7< R , T0 , T1 , T2 , T3 , T4 , T5 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector8< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector9< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector10< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector11< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity10_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity10_1.hpp new file mode 100644 index 0000000000..1b06a97a78 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity10_1.hpp @@ -0,0 +1,122 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +template< typename R , typename T0, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector2< R, typename class_transform ::type > types; +}; +template< typename R , typename T0 , typename T1, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector3< R, typename class_transform ::type , T1 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector4< R, typename class_transform ::type , T1 , T2 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector5< R, typename class_transform ::type , T1 , T2 , T3 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector6< R, typename class_transform ::type , T1 , T2 , T3 , T4 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector7< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector8< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector9< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector10< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector11< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity20_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity20_0.hpp new file mode 100644 index 0000000000..f6b2ca8a44 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity20_0.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector12< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector13< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector14< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector15< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector16< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector17< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector18< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector19< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector20< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector21< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity20_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity20_1.hpp new file mode 100644 index 0000000000..1688e6b3ed --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity20_1.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector12< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector13< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector14< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector15< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector16< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector17< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector18< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector19< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector20< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector21< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity30_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity30_0.hpp new file mode 100644 index 0000000000..e85eb3a09c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity30_0.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector22< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector23< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector24< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector25< R , T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector26< R , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector27< R , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector28< R , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector29< R , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector30< R , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector31< R , 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 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity30_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity30_1.hpp new file mode 100644 index 0000000000..290d21efa7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity30_1.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector22< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector23< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector24< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector25< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector26< R, typename class_transform ::type , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector27< R, typename class_transform ::type , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector28< R, typename class_transform ::type , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector29< R, typename class_transform ::type , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector30< R, typename class_transform ::type , 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 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector31< R, typename class_transform ::type , 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 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity40_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity40_0.hpp new file mode 100644 index 0000000000..f1a2410173 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity40_0.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector32< R , 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 , T30 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector33< R , 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 , T30 , T31 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector34< R , 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 , T30 , T31 , T32 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector35< R , 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 , T30 , T31 , T32 , T33 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector36< R , 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 , T30 , T31 , T32 , T33 , T34 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector37< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector38< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector39< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector40< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector41< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity40_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity40_1.hpp new file mode 100644 index 0000000000..e1741cbbac --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity40_1.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector32< R, typename class_transform ::type , 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 , T30 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector33< R, typename class_transform ::type , 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 , T30 , T31 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector34< R, typename class_transform ::type , 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 , T30 , T31 , T32 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector35< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector36< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector37< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector38< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector39< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector40< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector41< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity50_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity50_0.hpp new file mode 100644 index 0000000000..693a05dfe1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity50_0.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector42< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector43< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector44< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector45< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector46< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector47< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector48< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector49< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector50< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector51< R , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity50_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity50_1.hpp new file mode 100644 index 0000000000..9bc1616242 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/arity50_1.hpp @@ -0,0 +1,123 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector42< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector43< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector44< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector45< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector46< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector47< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector48< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector49< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector50< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 > types; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49, typename L> +struct components_impl +{ +typedef encode_bits bits; +typedef constant mask; +typedef function_types::components type; +typedef components_mpl_sequence_tag tag; +typedef mpl::integral_c function_arity; +typedef mpl::vector51< R, typename class_transform ::type , 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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49 > types; +}; + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/master.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/master.hpp new file mode 100644 index 0000000000..cd83726231 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/components_impl/master.hpp @@ -0,0 +1,61 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +#if BOOST_FT_ARITY_LOOP_PREFIX + +# ifndef BOOST_FT_DETAIL_COMPONENTS_IMPL_MASTER_HPP_INCLUDED +# define BOOST_FT_DETAIL_COMPONENTS_IMPL_MASTER_HPP_INCLUDED +# include +# include +# include +# include +# include +# endif + +# define BOOST_FT_type_name + +# if !BOOST_FT_mfp + +# define BOOST_FT_types \ + R BOOST_PP_COMMA_IF(BOOST_FT_arity) BOOST_FT_params(BOOST_PP_EMPTY) +# else + +# define BOOST_FT_types \ + R, typename class_transform::type \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(BOOST_FT_arity)) \ + BOOST_FT_params(BOOST_PP_EMPTY) + +# endif + +#elif BOOST_FT_ARITY_LOOP_IS_ITERATING + +template< BOOST_FT_tplargs(BOOST_PP_IDENTITY(typename)), typename L> +struct components_impl +{ + typedef encode_bits bits; + typedef constant mask; + + typedef function_types::components type; + typedef components_mpl_sequence_tag tag; + + typedef mpl::integral_c function_arity; + + typedef BOOST_PP_CAT(mpl::vector,BOOST_FT_n)< BOOST_FT_types > types; +}; + +#elif BOOST_FT_ARITY_LOOP_SUFFIX + +# undef BOOST_FT_types +# undef BOOST_FT_type_name + +#else +# error "attempt to use arity loop master file without loop" +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/cv_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/cv_traits.hpp new file mode 100644 index 0000000000..242f45b3b1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/cv_traits.hpp @@ -0,0 +1,134 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_CV_TRAITS_HPP_INCLUDED +#define BOOST_FT_DETAIL_CV_TRAITS_HPP_INCLUDED + +#include +#include + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || BOOST_WORKAROUND(__BORLANDC__, <= 0x582) +# include +# include +# include +#endif + +#include + +namespace boost { namespace function_types { namespace detail { + +#if ! (defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || BOOST_WORKAROUND(__BORLANDC__, <= 0x582)) + +template struct cv_traits +{ typedef non_cv tag; typedef T type; }; +template struct cv_traits +{ typedef non_cv tag; typedef T type; }; +template struct cv_traits +{ typedef non_cv tag; typedef T type; }; +template struct cv_traits +{ typedef non_cv tag; typedef T type; }; +template struct cv_traits +{ typedef non_cv tag; typedef T type; }; +template struct cv_traits +{ typedef non_cv tag; typedef T type; }; + +template struct cv_traits +{ typedef const_non_volatile tag; typedef T type; }; +template struct cv_traits +{ typedef const_non_volatile tag; typedef T type; }; +template struct cv_traits +{ typedef const_non_volatile tag; typedef T type; }; +template struct cv_traits +{ typedef const_non_volatile tag; typedef T type; }; +template struct cv_traits +{ typedef const_non_volatile tag; typedef T type; }; +template struct cv_traits +{ typedef const_non_volatile tag; typedef T type; }; + +template struct cv_traits +{ typedef volatile_non_const tag; typedef T type; }; +template struct cv_traits +{ typedef volatile_non_const tag; typedef T type; }; +template struct cv_traits +{ typedef volatile_non_const tag; typedef T type; }; +template struct cv_traits +{ typedef volatile_non_const tag; typedef T type; }; +template struct cv_traits +{ typedef volatile_non_const tag; typedef T type; }; +template struct cv_traits +{ typedef volatile_non_const tag; typedef T type; }; + +template struct cv_traits +{ typedef cv_qualified tag; typedef T type; }; +template struct cv_traits +{ typedef cv_qualified tag; typedef T type; }; +template struct cv_traits +{ typedef cv_qualified tag; typedef T type; }; +template struct cv_traits +{ typedef cv_qualified tag; typedef T type; }; +template struct cv_traits +{ typedef cv_qualified tag; typedef T type; }; +template struct cv_traits +{ typedef cv_qualified tag; typedef T type; }; + +#else +template struct cv_tag_impl; + +template<> struct cv_tag_impl<1> { typedef non_cv type;}; +template<> struct cv_tag_impl<2> { typedef const_non_volatile type; }; +template<> struct cv_tag_impl<3> { typedef volatile_non_const type; }; +template<> struct cv_tag_impl<4> { typedef cv_qualified type; }; + +typedef char (& case_1)[1]; +typedef char (& case_2)[2]; +typedef char (& case_3)[3]; +typedef char (& case_4)[4]; + +template case_1 switch_cv(T *); +template case_2 switch_cv(T const *); +template case_3 switch_cv(T volatile *); +template case_4 switch_cv(T const volatile *); + +template T * ref_to_ptr(T &); +template T const * ref_to_ptr(T const &); +template T volatile * ref_to_ptr(T volatile &); +template T const volatile * ref_to_ptr(T const volatile &); + +template T * ref_to_ptr(T * const volatile &); + +template +struct cv_code +{ + static T _t; + BOOST_STATIC_CONSTANT(std::size_t, value = + sizeof(::boost::function_types::detail::switch_cv( + ::boost::function_types::detail::ref_to_ptr(_t) ) )); +}; + +template struct cv_traits +{ + typedef typename boost::function_types::detail::cv_tag_impl< + ::boost::function_types::detail::cv_code::value >::type + tag; + + // may require Boost.TypeTraits broken compiler specializations + // to work + typedef typename boost::remove_cv< + typename boost::remove_pointer< + typename boost::remove_reference::type + >::type + >::type type; +}; +#endif + +} } } // namespace boost::function_types::detail + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/aliases_def.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/aliases_def.hpp new file mode 100644 index 0000000000..4d4833179c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/aliases_def.hpp @@ -0,0 +1,16 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusions + +#define callable_builtin BOOST_FT_callable_builtin +#define member BOOST_FT_member_pointer +#define non_member BOOST_FT_non_member +#define variadic BOOST_FT_variadic +#define non_variadic BOOST_FT_non_variadic + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/aliases_undef.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/aliases_undef.hpp new file mode 100644 index 0000000000..1d4e577d80 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/aliases_undef.hpp @@ -0,0 +1,16 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusions + +#undef callable_builtin +#undef member +#undef non_member +#undef variadic +#undef non_variadic + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/def.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/def.hpp new file mode 100644 index 0000000000..08074fb38b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/def.hpp @@ -0,0 +1,51 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusions + +// Type encoding: +// +// bit 0: callable builtin +// bit 1: non member +// bit 2: naked function +// bit 3: pointer +// bit 4: reference +// bit 5: member pointer +// bit 6: member function pointer +// bit 7: member object pointer + +#define BOOST_FT_type_mask 0x000000ff // 1111 1111 +#define BOOST_FT_callable_builtin 0x00000001 // 0000 0001 +#define BOOST_FT_non_member 0x00000002 // 0000 0010 +#define BOOST_FT_function 0x00000007 // 0000 0111 +#define BOOST_FT_pointer 0x0000000b // 0000 1011 +#define BOOST_FT_reference 0x00000013 // 0001 0011 +#define BOOST_FT_non_member_callable_builtin 0x00000003 // 0000 0011 +#define BOOST_FT_member_pointer 0x00000020 // 0010 0000 +#define BOOST_FT_member_function_pointer 0x00000061 // 0110 0001 +#define BOOST_FT_member_object_pointer 0x000000a3 // 1010 0001 +#define BOOST_FT_member_object_pointer_flags 0x000002a3 + +#define BOOST_FT_variadic 0x00000100 +#define BOOST_FT_non_variadic 0x00000200 +#define BOOST_FT_variadic_mask 0x00000300 + +#define BOOST_FT_const 0x00000400 +#define BOOST_FT_volatile 0x00000800 + +#define BOOST_FT_default_cc 0x00008000 +#define BOOST_FT_cc_mask 0x00ff8000 + +#define BOOST_FT_kind_mask 0x000000fc + +#define BOOST_FT_flags_mask 0x00000fff +#define BOOST_FT_full_mask 0x00ff0fff + +#define BOOST_FT_arity_shift 24 +#define BOOST_FT_arity_mask 0x7f000000 + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/undef.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/undef.hpp new file mode 100644 index 0000000000..1920d6fcb1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/encoding/undef.hpp @@ -0,0 +1,38 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +#undef BOOST_FT_type_mask +#undef BOOST_FT_kind_mask +#undef BOOST_FT_callable_builtin +#undef BOOST_FT_non_member +#undef BOOST_FT_function +#undef BOOST_FT_pointer +#undef BOOST_FT_reference +#undef BOOST_FT_non_member_callable_builtin +#undef BOOST_FT_member_pointer +#undef BOOST_FT_member_function_pointer +#undef BOOST_FT_member_object_pointer +#undef BOOST_FT_member_object_pointer_flags + +#undef BOOST_FT_variadic +#undef BOOST_FT_non_variadic +#undef BOOST_FT_variadic_mask + +#undef BOOST_FT_const +#undef BOOST_FT_volatile + +#undef BOOST_FT_default_cc +#undef BOOST_FT_cc_mask + +#undef BOOST_FT_flags_mask +#undef BOOST_FT_full_mask + +#undef BOOST_FT_arity_mask + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_arity_loop.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_arity_loop.hpp new file mode 100644 index 0000000000..b6dbff59f3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_arity_loop.hpp @@ -0,0 +1,149 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +#ifndef BOOST_FT_PREPROCESSING_MODE +// input: BOOST_FT_mfp 0 or 1 <=> member function pointer? +// input: BOOST_FT_type_name BOOST_FT_type --> "R (* ..._type_name)()" (pass2) +#endif +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +#ifdef __WAVE__ +# pragma wave option(preserve: 0) +#endif + +#ifndef BOOST_FT_ARITY_LOOP_IS_ITERATING + +# define BOOST_FT_AL_PREPROCESSED \ + BOOST_FT_AL_FILE(BOOST_FT_al_path,BOOST_FT_FROM_ARITY,BOOST_FT_mfp) + +# define BOOST_FT_AL_FILE(base_path,max_arity,mfp) \ + BOOST_FT_AL_FILE_I(base_path,max_arity,mfp) +# define BOOST_FT_AL_FILE_I(base_path,max_arity,mfp) \ + + +# if !defined(BOOST_FT_PREPROCESSING_MODE) + +# if BOOST_FT_MAX_ARITY < 10 +# define BOOST_FT_FROM_ARITY 0 +# elif BOOST_FT_MAX_ARITY < 20 +# define BOOST_FT_FROM_ARITY 10 +# elif BOOST_FT_MAX_ARITY < 30 +# define BOOST_FT_FROM_ARITY 20 +# elif BOOST_FT_MAX_ARITY < 40 +# define BOOST_FT_FROM_ARITY 30 +# endif + +# if BOOST_FT_FROM_ARITY +# include BOOST_FT_AL_PREPROCESSED +# endif + +# elif !defined(BOOST_FT_FROM_ARITY) // single pass preprocessing +# define BOOST_FT_FROM_ARITY 0 + +# elif BOOST_FT_FROM_ARITY > 0 // arity20 includes arity10 +BOOST_PP_EXPAND(#) include BOOST_FT_AL_PREPROCESSED +# endif + +# undef BOOST_FT_AL_PREPROCESSED + +# undef BOOST_FT_AL_FILE +# undef BOOST_FT_AL_FILE_I + +# if BOOST_FT_MAX_ARITY > BOOST_FT_FROM_ARITY + +# ifndef BOOST_FT_DETAIL_ARITY_LOOP_HPP_INCLUDED +# define BOOST_FT_DETAIL_ARITY_LOOP_HPP_INCLUDED +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# endif + +# define BOOST_FT_AL_INCLUDE_FILE + +# define BOOST_FT_ARITY_LOOP_PREFIX 1 +# include BOOST_FT_AL_INCLUDE_FILE +# undef BOOST_FT_ARITY_LOOP_PREFIX + +# if !BOOST_PP_IS_ITERATING +# define BOOST_PP_FILENAME_1 BOOST_FT_AL_INCLUDE_FILE +# elif BOOST_PP_ITERATION_DEPTH() == 1 +# define BOOST_PP_FILENAME_2 BOOST_FT_AL_INCLUDE_FILE +# else +# error "loops nested too deeply" +# endif + +# define BOOST_FT_arity BOOST_PP_ITERATION() +# define BOOST_FT_n BOOST_PP_INC(BOOST_FT_arity) + +# define BOOST_FT_type \ + BOOST_FT_syntax(BOOST_FT_cc,BOOST_FT_type_name BOOST_PP_EMPTY)\ + (BOOST_FT_params(BOOST_PP_EMPTY) BOOST_FT_ell) BOOST_FT_cv + +# define BOOST_FT_tplargs(prefx) \ + prefx() R BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_FT_arity,prefx() T) + +# if !BOOST_FT_mfp + +# define BOOST_FT_params(prefx) \ + BOOST_PP_IF(BOOST_FT_arity,BOOST_PP_ENUM_PARAMS, \ + BOOST_FT_nullary_param BOOST_PP_TUPLE_EAT(2))( \ + BOOST_FT_arity,prefx() T) +# else + +# define BOOST_FT_params(prefx) \ + BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_FT_arity,prefx() T) + +# endif + +# if !BOOST_FT_FROM_ARITY +# define BOOST_PP_ITERATION_LIMITS (BOOST_FT_mfp, BOOST_FT_MAX_ARITY) +# else +# define BOOST_PP_ITERATION_LIMITS \ + (BOOST_FT_FROM_ARITY+1, BOOST_FT_MAX_ARITY) +# endif + +# define BOOST_FT_ARITY_LOOP_IS_ITERATING 1 +# include BOOST_PP_ITERATE() +# undef BOOST_FT_ARITY_LOOP_IS_ITERATING + +# undef BOOST_FT_arity +# undef BOOST_FT_params +# undef BOOST_FT_tplargs +# undef BOOST_FT_type + +# define BOOST_FT_ARITY_LOOP_SUFFIX 1 +# include BOOST_FT_AL_INCLUDE_FILE +# undef BOOST_FT_ARITY_LOOP_SUFFIX + +# undef BOOST_FT_AL_INCLUDE_FILE +# endif + +# undef BOOST_FT_FROM_ARITY + +#else +# error "attempt to nest arity loops" +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_cc_loop/master.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_cc_loop/master.hpp new file mode 100644 index 0000000000..60e958cec7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_cc_loop/master.hpp @@ -0,0 +1,136 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusions + +#ifdef __WAVE__ +// this file has been generated from the master.hpp file in the same directory +# pragma wave option(preserve: 0) +#endif + + +#if !BOOST_PP_IS_ITERATING + +# ifndef BOOST_FT_DETAIL_CC_LOOP_MASTER_HPP_INCLUDED +# define BOOST_FT_DETAIL_CC_LOOP_MASTER_HPP_INCLUDED +# include + +# include +# include +# include +# include +# include +# include +# include +# endif + +# include +# include + +# define BOOST_PP_FILENAME_1 \ + +# define BOOST_PP_ITERATION_LIMITS \ + (0,BOOST_PP_SEQ_SIZE(BOOST_FT_CC_NAMES_SEQ)-1) +# include BOOST_PP_ITERATE() +# if !defined(BOOST_FT_config_valid) && BOOST_FT_CC_PREPROCESSING +# define BOOST_FT_cc_id 1 +# define BOOST_FT_cc_name implicit_cc +# define BOOST_FT_cc BOOST_PP_EMPTY +# define BOOST_FT_cond callable_builtin +# include BOOST_FT_cc_file +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# elif !defined(BOOST_FT_config_valid) // and generating preprocessed file +BOOST_PP_EXPAND(#) ifndef BOOST_FT_config_valid +BOOST_PP_EXPAND(#) define BOOST_FT_cc_id 1 +BOOST_PP_EXPAND(#) define BOOST_FT_cc_name implicit_cc +BOOST_PP_EXPAND(#) define BOOST_FT_cc BOOST_PP_EMPTY +BOOST_PP_EXPAND(#) define BOOST_FT_cond callable_builtin +#define _() +BOOST_PP_EXPAND(#) include BOOST_FT_cc_file +#undef _ +BOOST_PP_EXPAND(#) undef BOOST_FT_cond +BOOST_PP_EXPAND(#) undef BOOST_FT_cc_name +BOOST_PP_EXPAND(#) undef BOOST_FT_cc +BOOST_PP_EXPAND(#) undef BOOST_FT_cc_id +BOOST_PP_EXPAND(#) else +BOOST_PP_EXPAND(#) undef BOOST_FT_config_valid +BOOST_PP_EXPAND(#) endif + +# else +# undef BOOST_FT_config_valid +# endif + +# include +# include + +#elif BOOST_FT_CC_PREPROCESSING + +# define BOOST_FT_cc_id BOOST_PP_INC(BOOST_PP_FRAME_ITERATION(1)) +# define BOOST_FT_cc_inf \ + BOOST_PP_SEQ_ELEM(BOOST_PP_FRAME_ITERATION(1),BOOST_FT_CC_NAMES_SEQ) + +# define BOOST_FT_cc_pp_name BOOST_PP_TUPLE_ELEM(3,0,BOOST_FT_cc_inf) +# define BOOST_FT_cc_name BOOST_PP_TUPLE_ELEM(3,1,BOOST_FT_cc_inf) +# define BOOST_FT_cc BOOST_PP_TUPLE_ELEM(3,2,BOOST_FT_cc_inf) + +# define BOOST_FT_cond BOOST_PP_CAT(BOOST_FT_CC_,BOOST_FT_cc_pp_name) + +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif + +# undef BOOST_FT_cond + +# undef BOOST_FT_cc_pp_name +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc + +# undef BOOST_FT_cc_id +# undef BOOST_FT_cc_inf + +#else // if generating preprocessed file +BOOST_PP_EXPAND(#) define BOOST_FT_cc_id BOOST_PP_INC(BOOST_PP_ITERATION()) + +# define BOOST_FT_cc_inf \ + BOOST_PP_SEQ_ELEM(BOOST_PP_ITERATION(),BOOST_FT_CC_NAMES_SEQ) + +# define BOOST_FT_cc_pp_name BOOST_PP_TUPLE_ELEM(3,0,BOOST_FT_cc_inf) + +# define BOOST_FT_CC_DEF(name,index) \ + name BOOST_PP_TUPLE_ELEM(3,index,BOOST_FT_cc_inf) +BOOST_PP_EXPAND(#) define BOOST_FT_CC_DEF(BOOST_FT_cc_name,1) +BOOST_PP_EXPAND(#) define BOOST_FT_CC_DEF(BOOST_FT_cc,2) +# undef BOOST_FT_CC_DEF + +# define BOOST_FT_cc_cond_v BOOST_PP_CAT(BOOST_FT_CC_,BOOST_FT_cc_pp_name) +BOOST_PP_EXPAND(#) define BOOST_FT_cond BOOST_FT_cc_cond_v +# undef BOOST_FT_cc_cond_v + +# undef BOOST_FT_cc_pp_name +# undef BOOST_FT_cc_inf + +BOOST_PP_EXPAND(#) if BOOST_FT_cond +BOOST_PP_EXPAND(#) define BOOST_FT_config_valid 1 +#define _() +BOOST_PP_EXPAND(#) include BOOST_FT_cc_file +#undef _ +BOOST_PP_EXPAND(#) endif + +BOOST_PP_EXPAND(#) undef BOOST_FT_cond + +BOOST_PP_EXPAND(#) undef BOOST_FT_cc_name +BOOST_PP_EXPAND(#) undef BOOST_FT_cc + +BOOST_PP_EXPAND(#) undef BOOST_FT_cc_id + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_cc_loop/preprocessed.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_cc_loop/preprocessed.hpp new file mode 100644 index 0000000000..da4079c6ad --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_cc_loop/preprocessed.hpp @@ -0,0 +1,120 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusions + +// this file has been generated from the master.hpp file in the same directory +# define BOOST_FT_cc_id 1 +# define BOOST_FT_cc_name implicit_cc +# define BOOST_FT_cc BOOST_PP_EMPTY +# define BOOST_FT_cond BOOST_FT_CC_IMPLICIT +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# define BOOST_FT_cc_id 2 +# define BOOST_FT_cc_name cdecl_cc +# define BOOST_FT_cc BOOST_PP_IDENTITY(__cdecl ) +# define BOOST_FT_cond BOOST_FT_CC_CDECL +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# define BOOST_FT_cc_id 3 +# define BOOST_FT_cc_name stdcall_cc +# define BOOST_FT_cc BOOST_PP_IDENTITY(__stdcall ) +# define BOOST_FT_cond BOOST_FT_CC_STDCALL +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# define BOOST_FT_cc_id 4 +# define BOOST_FT_cc_name pascal_cc +# define BOOST_FT_cc BOOST_PP_IDENTITY(pascal ) +# define BOOST_FT_cond BOOST_FT_CC_PASCAL +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# define BOOST_FT_cc_id 5 +# define BOOST_FT_cc_name fastcall_cc +# define BOOST_FT_cc BOOST_PP_IDENTITY(__fastcall) +# define BOOST_FT_cond BOOST_FT_CC_FASTCALL +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# define BOOST_FT_cc_id 6 +# define BOOST_FT_cc_name clrcall_cc +# define BOOST_FT_cc BOOST_PP_IDENTITY(__clrcall ) +# define BOOST_FT_cond BOOST_FT_CC_CLRCALL +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# define BOOST_FT_cc_id 7 +# define BOOST_FT_cc_name thiscall_cc +# define BOOST_FT_cc BOOST_PP_IDENTITY(__thiscall) +# define BOOST_FT_cond BOOST_FT_CC_THISCALL +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# define BOOST_FT_cc_id 8 +# define BOOST_FT_cc_name thiscall_cc +# define BOOST_FT_cc BOOST_PP_EMPTY +# define BOOST_FT_cond BOOST_FT_CC_IMPLICIT_THISCALL +# if BOOST_FT_cond +# define BOOST_FT_config_valid 1 +# include BOOST_FT_cc_file +# endif +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# ifndef BOOST_FT_config_valid +# define BOOST_FT_cc_id 1 +# define BOOST_FT_cc_name implicit_cc +# define BOOST_FT_cc BOOST_PP_EMPTY +# define BOOST_FT_cond 0x00000001 +# include BOOST_FT_cc_file +# undef BOOST_FT_cond +# undef BOOST_FT_cc_name +# undef BOOST_FT_cc +# undef BOOST_FT_cc_id +# else +# undef BOOST_FT_config_valid +# endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_loop.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_loop.hpp new file mode 100644 index 0000000000..7d8c347c99 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_loop.hpp @@ -0,0 +1,80 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusions + +#ifndef BOOST_FT_DETAIL_PP_LOOP_HPP_INCLUDED +#define BOOST_FT_DETAIL_PP_LOOP_HPP_INCLUDED +# include +# include +# include +#endif + +#include +#include + +#if defined(BOOST_FT_PREPROCESSING_MODE) +# define BOOST_FT_loop +#else +# define BOOST_FT_loop \ + +#endif + +#if defined(BOOST_FT_al_path) + +# define BOOST_FT_cc_file \ + +# define BOOST_FT_variate_file \ + + +# ifndef BOOST_FT_type_function +# define BOOST_FT_type_function(cc,name) BOOST_FT_SYNTAX( \ + R BOOST_PP_EMPTY,BOOST_PP_EMPTY,cc,BOOST_PP_EMPTY,name,BOOST_PP_EMPTY) +# endif +# ifndef BOOST_FT_type_function_pointer +# define BOOST_FT_type_function_pointer(cc,name) BOOST_FT_SYNTAX( \ + R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,* BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) +# endif +# ifndef BOOST_FT_type_function_reference +# define BOOST_FT_type_function_reference(cc,name) BOOST_FT_SYNTAX( \ + R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,& BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) +# endif +# ifndef BOOST_FT_type_member_function_pointer +# define BOOST_FT_type_member_function_pointer(cc,name) BOOST_FT_SYNTAX( \ + R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,T0::* BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) +# endif + +# include BOOST_FT_loop + +# undef BOOST_FT_type_function +# undef BOOST_FT_type_function_pointer +# undef BOOST_FT_type_function_reference +# undef BOOST_FT_type_member_function_pointer + +# undef BOOST_FT_variations +# undef BOOST_FT_variate_file +# undef BOOST_FT_cc_file +# undef BOOST_FT_al_path + +#elif defined(BOOST_FT_cc_file) + +# include BOOST_FT_loop +# undef BOOST_FT_cc_file + +#else + +# error "argument missing" + +#endif + +#undef BOOST_FT_loop + +#include +#include + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_retag_default_cc/master.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_retag_default_cc/master.hpp new file mode 100644 index 0000000000..f97d385ed7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_retag_default_cc/master.hpp @@ -0,0 +1,103 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is guarded externally + +#ifdef __WAVE__ +// this file has been generated from the master.hpp file in the same directory +# pragma wave option(preserve: 0) +#endif + +#if !defined(BOOST_PP_VALUE) +# include +# include + +# include +# include + +namespace boost { namespace function_types { + +namespace detail +{ + template struct selector_bits + { +# define BOOST_PP_VALUE non_member|member|non_variadic|variadic +# include BOOST_PP_ASSIGN_SLOT(1) + + BOOST_STATIC_CONSTANT(bits_t, value = ( + ::boost::function_types::detail::bits::value & BOOST_FT_default_cc + | ::boost::function_types::detail::bits::value & BOOST_PP_SLOT(1) + )); + }; + + template struct default_cc_tag; + + template struct retag_default_cc + : detail::compound_tag + < Tag, detail::default_cc_tag< + ::boost::function_types::detail::selector_bits::value > > + { }; + + template struct default_cc_tag + { + typedef null_tag::bits bits; + typedef null_tag::mask mask; + }; + + class test_class; + typedef constant cc_mask_constant; + +# define BOOST_FT_self \ + + +# define default_cc_ BOOST_FT_default_cc + +# define BOOST_PP_VALUE default_cc_|non_member|non_variadic +# define BOOST_FT_tester void (*tester)() +# define BOOST_PP_INDIRECT_SELF BOOST_FT_self +# include BOOST_PP_INCLUDE_SELF() + +# define BOOST_PP_VALUE default_cc_|non_member|variadic +# define BOOST_FT_tester void (*tester)(...) +# define BOOST_PP_INDIRECT_SELF BOOST_FT_self +# include BOOST_PP_INCLUDE_SELF() + +# define BOOST_PP_VALUE default_cc_|member|non_variadic +# define BOOST_FT_tester void (test_class::*tester)() +# define BOOST_PP_INDIRECT_SELF BOOST_FT_self +# include BOOST_PP_INCLUDE_SELF() + +# define BOOST_PP_VALUE default_cc_|member|variadic +# define BOOST_FT_tester void (test_class::*tester)(...) +# define BOOST_PP_INDIRECT_SELF BOOST_FT_self +# include BOOST_PP_INCLUDE_SELF() + +# undef default_cc_ + +# undef BOOST_FT_self + +} } } // namespace ::boost::function_types::detail + +# include +# include + +#else // if defined(BOOST_PP_VALUE) + +# include BOOST_PP_ASSIGN_SLOT(1) + + template<> struct default_cc_tag + { + typedef BOOST_FT_tester; + typedef mpl::bitand_::bits,cc_mask_constant> bits; + typedef cc_mask_constant mask; + }; + +# undef BOOST_FT_tester + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_retag_default_cc/preprocessed.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_retag_default_cc/preprocessed.hpp new file mode 100644 index 0000000000..c21a4fd2bd --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_retag_default_cc/preprocessed.hpp @@ -0,0 +1,59 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is guarded externally + +// this file has been generated from the master.hpp file in the same directory +namespace boost { namespace function_types { +namespace detail +{ +template struct selector_bits +{ +BOOST_STATIC_CONSTANT(bits_t, value = ( +::boost::function_types::detail::bits ::value & 0x00008000 +| ::boost::function_types::detail::bits ::value & 802 +)); +}; +template struct default_cc_tag; +template struct retag_default_cc +: detail::compound_tag +< Tag, detail::default_cc_tag< +::boost::function_types::detail::selector_bits ::value > > +{ }; +template struct default_cc_tag +{ +typedef null_tag::bits bits; +typedef null_tag::mask mask; +}; +class test_class; +typedef constant<0x00ff8000> cc_mask_constant; +template< > struct default_cc_tag<33282> +{ +typedef void ( *tester)(); +typedef mpl::bitand_ ::bits,cc_mask_constant> bits; +typedef cc_mask_constant mask; +}; +template< > struct default_cc_tag<33026> +{ +typedef void ( *tester)( ... ); +typedef mpl::bitand_ ::bits,cc_mask_constant> bits; +typedef cc_mask_constant mask; +}; +template< > struct default_cc_tag<33312> +{ +typedef void (test_class:: *tester)(); +typedef mpl::bitand_ ::bits,cc_mask_constant> bits; +typedef cc_mask_constant mask; +}; +template< > struct default_cc_tag<33056> +{ +typedef void (test_class:: *tester)( ... ); +typedef mpl::bitand_ ::bits,cc_mask_constant> bits; +typedef cc_mask_constant mask; +}; +} } } diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/cc_tag.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/cc_tag.hpp new file mode 100644 index 0000000000..81f1d89e74 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/cc_tag.hpp @@ -0,0 +1,17 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusions + + struct BOOST_FT_cc_name + { + typedef detail::encode_bits<0,BOOST_FT_cc_id> bits; + typedef detail::constant mask; + }; + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/master.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/master.hpp new file mode 100644 index 0000000000..783b93cdf7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/master.hpp @@ -0,0 +1,126 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is guarded externally + +#ifdef __WAVE__ +// this file has been generated from the master.hpp file in the same directory +# pragma wave option(preserve: 0) +#endif + +#if !defined(BOOST_FT_PREPROCESSING_MODE) || defined(BOOST_FT_CONFIG_HPP_INCLUDED) +# error "this file used with two-pass preprocessing, only" +#endif + +#include +#include + +namespace boost { namespace function_types { + +typedef detail::property_tag non_variadic; +typedef detail::property_tag variadic; + +typedef detail::property_tag<0,BOOST_FT_const> non_const; +typedef detail::property_tag const_qualified; + +typedef detail::property_tag<0,BOOST_FT_volatile> non_volatile; +typedef detail::property_tag volatile_qualified; + +typedef detail::property_tag default_cc; + +#define BOOST_PP_VALUE BOOST_FT_const|BOOST_FT_volatile +#include BOOST_PP_ASSIGN_SLOT(1) + +typedef detail::property_tag<0 , BOOST_PP_SLOT(1)> non_cv; +typedef detail::property_tag const_non_volatile; +typedef detail::property_tag volatile_non_const; +typedef detail::property_tag cv_qualified; + +namespace detail { + + typedef constant full_mask; + + template struct encode_bits_impl + { + BOOST_STATIC_CONSTANT( bits_t, value = + Flags | (BOOST_FT_default_cc * CCID) << 1 ); + }; + + template + struct encode_charr_impl + { + BOOST_STATIC_CONSTANT(std::size_t, value = (std::size_t)(1+ + Flags | (BOOST_FT_default_cc * CCID) << 1 | Arity << BOOST_FT_arity_shift + )); + }; + + template struct decode_bits + { + BOOST_STATIC_CONSTANT(bits_t, flags = Bits & BOOST_FT_flags_mask); + + BOOST_STATIC_CONSTANT(bits_t, cc_id = + ( (Bits & BOOST_FT_full_mask) / BOOST_FT_default_cc) >> 1 + ); + + BOOST_STATIC_CONSTANT(bits_t, tag_bits = (Bits & BOOST_FT_full_mask)); + + BOOST_STATIC_CONSTANT(std::size_t, arity = (std::size_t) + (Bits >> BOOST_FT_arity_shift) + ); + }; + + template + struct tag_ice + { + BOOST_STATIC_CONSTANT(bool, match = + RHS_bits == (LHS_bits & RHS_mask & (RHS_bits |~BOOST_FT_type_mask)) + ); + + BOOST_STATIC_CONSTANT(bits_t, combined_bits = + LHS_bits & ~RHS_mask | RHS_bits + ); + + BOOST_STATIC_CONSTANT(bits_t, combined_mask = + LHS_mask | RHS_mask + ); + + BOOST_STATIC_CONSTANT(bits_t, extracted_bits = + LHS_bits & RHS_mask + ); + + }; + +#define BOOST_FT_mask BOOST_FT_type_mask + typedef property_tag callable_builtin_tag; + typedef property_tag nonmember_callable_builtin_tag; + typedef property_tag function_tag; + typedef property_tag reference_tag; + typedef property_tag pointer_tag; + typedef property_tag member_function_pointer_tag; + typedef property_tag member_object_pointer_tag; + typedef property_tag member_object_pointer_base; + typedef property_tag member_pointer_tag; +#undef BOOST_FT_mask + +#define BOOST_PP_VALUE BOOST_FT_function|BOOST_FT_non_variadic|BOOST_FT_default_cc +#include BOOST_PP_ASSIGN_SLOT(1) +#define BOOST_PP_VALUE BOOST_FT_type_mask|BOOST_FT_variadic_mask|BOOST_FT_cc_mask +#include BOOST_PP_ASSIGN_SLOT(2) + + typedef property_tag< BOOST_PP_SLOT(1) , BOOST_PP_SLOT(2) > nv_dcc_func; + +#define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_non_variadic|BOOST_FT_default_cc +#include BOOST_PP_ASSIGN_SLOT(1) + + typedef property_tag< BOOST_PP_SLOT(1) , BOOST_PP_SLOT(2) > nv_dcc_mfp; + +} // namespace detail + +} } // namespace ::boost::function_types + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/preprocessed.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/preprocessed.hpp new file mode 100644 index 0000000000..811d62a74d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_tags/preprocessed.hpp @@ -0,0 +1,77 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is guarded externally + +// this file has been generated from the master.hpp file in the same directory +namespace boost { namespace function_types { +typedef detail::property_tag<0x00000200,0x00000300> non_variadic; +typedef detail::property_tag<0x00000100,0x00000300> variadic; +typedef detail::property_tag<0,0x00000400> non_const; +typedef detail::property_tag<0x00000400,0x00000400> const_qualified; +typedef detail::property_tag<0,0x00000800> non_volatile; +typedef detail::property_tag<0x00000800,0x00000800> volatile_qualified; +typedef detail::property_tag<0x00008000,0x00ff8000> default_cc; +typedef detail::property_tag<0 , 3072> non_cv; +typedef detail::property_tag<0x00000400 , 3072> const_non_volatile; +typedef detail::property_tag<0x00000800, 3072> volatile_non_const; +typedef detail::property_tag<3072 , 3072> cv_qualified; +namespace detail { +typedef constant<0x00ff0fff> full_mask; +template struct encode_bits_impl +{ +BOOST_STATIC_CONSTANT( bits_t, value = +Flags | (0x00008000 * CCID) << 1 ); +}; +template +struct encode_charr_impl +{ +BOOST_STATIC_CONSTANT(std::size_t, value = (std::size_t)(1+ +Flags | (0x00008000 * CCID) << 1 | Arity << 24 +)); +}; +template struct decode_bits +{ +BOOST_STATIC_CONSTANT(bits_t, flags = Bits & 0x00000fff); +BOOST_STATIC_CONSTANT(bits_t, cc_id = +( (Bits & 0x00ff0fff) / 0x00008000) >> 1 +); +BOOST_STATIC_CONSTANT(bits_t, tag_bits = (Bits & 0x00ff0fff)); +BOOST_STATIC_CONSTANT(std::size_t, arity = (std::size_t) +(Bits >> 24) +); +}; +template +struct tag_ice +{ +BOOST_STATIC_CONSTANT(bool, match = +RHS_bits == (LHS_bits & RHS_mask & (RHS_bits | ~0x000000ff)) +); +BOOST_STATIC_CONSTANT(bits_t, combined_bits = +LHS_bits & ~RHS_mask | RHS_bits +); +BOOST_STATIC_CONSTANT(bits_t, combined_mask = +LHS_mask | RHS_mask +); +BOOST_STATIC_CONSTANT(bits_t, extracted_bits = +LHS_bits & RHS_mask +); +}; +typedef property_tag<0x00000001,0x000000ff> callable_builtin_tag; +typedef property_tag<0x00000003,0x000000ff> nonmember_callable_builtin_tag; +typedef property_tag<0x00000007,0x000000ff> function_tag; +typedef property_tag<0x00000013,0x000000ff> reference_tag; +typedef property_tag<0x0000000b,0x000000ff> pointer_tag; +typedef property_tag<0x00000061,0x000000ff> member_function_pointer_tag; +typedef property_tag<0x000000a3,0x000000ff> member_object_pointer_tag; +typedef property_tag<0x000002a3,0x00ff0fff> member_object_pointer_base; +typedef property_tag<0x00000020,0x000000ff> member_pointer_tag; +typedef property_tag< 33287 , 16745471 > nv_dcc_func; +typedef property_tag< 33377 , 16745471 > nv_dcc_mfp; +} +} } diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_variate_loop/master.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_variate_loop/master.hpp new file mode 100644 index 0000000000..50263429d7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_variate_loop/master.hpp @@ -0,0 +1,152 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifdef __WAVE__ +// this file has been generated from the master.hpp file in the same directory +# pragma wave option(preserve: 0) +#endif + +#if !defined(BOOST_FT_PREPROCESSING_MODE) +# error "this file is only for two-pass preprocessing" +#endif + +#if !defined(BOOST_PP_VALUE) +# include +# include +# include +# include + +BOOST_PP_EXPAND(#) define BOOST_FT_mfp 0 +BOOST_PP_EXPAND(#) define BOOST_FT_syntax BOOST_FT_type_function + +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_non_variadic +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_variadic +# include __FILE__ + +BOOST_PP_EXPAND(#) if !BOOST_FT_NO_CV_FUNC_SUPPORT +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_non_variadic|BOOST_FT_const +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_variadic|BOOST_FT_const +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_non_variadic|BOOST_FT_volatile +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_variadic|BOOST_FT_volatile +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_non_variadic|BOOST_FT_const|BOOST_FT_volatile +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_function|BOOST_FT_variadic|BOOST_FT_const|BOOST_FT_volatile +# include __FILE__ +BOOST_PP_EXPAND(#) endif + + +BOOST_PP_EXPAND(#) undef BOOST_FT_syntax +BOOST_PP_EXPAND(#) define BOOST_FT_syntax BOOST_FT_type_function_pointer + +# define BOOST_PP_VALUE \ + BOOST_FT_pointer|BOOST_FT_non_variadic +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_pointer|BOOST_FT_variadic +# include __FILE__ + +BOOST_PP_EXPAND(#) undef BOOST_FT_syntax +BOOST_PP_EXPAND(#) define BOOST_FT_syntax BOOST_FT_type_function_reference + +# define BOOST_PP_VALUE \ + BOOST_FT_reference|BOOST_FT_non_variadic +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_reference|BOOST_FT_variadic +# include __FILE__ + +BOOST_PP_EXPAND(#) undef BOOST_FT_syntax +BOOST_PP_EXPAND(#) undef BOOST_FT_mfp + +BOOST_PP_EXPAND(#) define BOOST_FT_mfp 1 +BOOST_PP_EXPAND(#) define BOOST_FT_syntax BOOST_FT_type_member_function_pointer + +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_non_variadic +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_variadic +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_non_variadic|BOOST_FT_const +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_variadic|BOOST_FT_const +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_non_variadic|BOOST_FT_volatile +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_variadic|BOOST_FT_volatile +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_non_variadic|BOOST_FT_const|BOOST_FT_volatile +# include __FILE__ +# define BOOST_PP_VALUE \ + BOOST_FT_member_function_pointer|BOOST_FT_variadic|BOOST_FT_const|BOOST_FT_volatile +# include __FILE__ + +BOOST_PP_EXPAND(#) undef BOOST_FT_syntax +BOOST_PP_EXPAND(#) undef BOOST_FT_mfp + +# include +#else + +# include BOOST_PP_ASSIGN_SLOT(1) + +# define BOOST_PP_VALUE BOOST_PP_SLOT(1) & BOOST_FT_kind_mask +# include BOOST_PP_ASSIGN_SLOT(2) + +BOOST_PP_EXPAND(#) if !!(BOOST_PP_SLOT(2) & (BOOST_FT_variations)) +BOOST_PP_EXPAND(#) if (BOOST_PP_SLOT(1) & (BOOST_FT_cond)) == (BOOST_FT_cond) + +# if ( BOOST_PP_SLOT(1) & (BOOST_FT_variadic) ) +BOOST_PP_EXPAND(#) define BOOST_FT_ell ... +BOOST_PP_EXPAND(#) define BOOST_FT_nullary_param +# else +BOOST_PP_EXPAND(#) define BOOST_FT_ell +BOOST_PP_EXPAND(#) define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# endif + +# if !( BOOST_PP_SLOT(1) & (BOOST_FT_volatile) ) +# if !( BOOST_PP_SLOT(1) & (BOOST_FT_const) ) +BOOST_PP_EXPAND(#) define BOOST_FT_cv +# else +BOOST_PP_EXPAND(#) define BOOST_FT_cv const +# endif +# else +# if !( BOOST_PP_SLOT(1) & (BOOST_FT_const) ) +BOOST_PP_EXPAND(#) define BOOST_FT_cv volatile +# else +BOOST_PP_EXPAND(#) define BOOST_FT_cv const volatile +# endif +# endif +BOOST_PP_EXPAND(#) define BOOST_FT_flags BOOST_PP_SLOT(1) +BOOST_PP_EXPAND(#) include BOOST_FT_variate_file + +BOOST_PP_EXPAND(#) undef BOOST_FT_cv +BOOST_PP_EXPAND(#) undef BOOST_FT_ell +BOOST_PP_EXPAND(#) undef BOOST_FT_nullary_param +BOOST_PP_EXPAND(#) undef BOOST_FT_flags +BOOST_PP_EXPAND(#) endif +BOOST_PP_EXPAND(#) endif +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_variate_loop/preprocessed.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_variate_loop/preprocessed.hpp new file mode 100644 index 0000000000..7e7c4f91fa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/pp_variate_loop/preprocessed.hpp @@ -0,0 +1,283 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// this file has been generated from the master.hpp file in the same directory +# define BOOST_FT_mfp 0 +# define BOOST_FT_syntax BOOST_FT_type_function +# if ! ! (4 & (BOOST_FT_variations)) +# if (519 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv +# define BOOST_FT_flags 519 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (4 & (BOOST_FT_variations)) +# if (263 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv +# define BOOST_FT_flags 263 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if !BOOST_FT_NO_CV_FUNC_SUPPORT +# if ! ! (4 & (BOOST_FT_variations)) +# if (1543 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv const +# define BOOST_FT_flags 1543 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (4 & (BOOST_FT_variations)) +# if (1287 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv const +# define BOOST_FT_flags 1287 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (4 & (BOOST_FT_variations)) +# if (2567 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv volatile +# define BOOST_FT_flags 2567 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (4 & (BOOST_FT_variations)) +# if (2311 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv volatile +# define BOOST_FT_flags 2311 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (4 & (BOOST_FT_variations)) +# if (3591 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv const volatile +# define BOOST_FT_flags 3591 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (4 & (BOOST_FT_variations)) +# if (3335 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv const volatile +# define BOOST_FT_flags 3335 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# endif +# undef BOOST_FT_syntax +# define BOOST_FT_syntax BOOST_FT_type_function_pointer +# if ! ! (8 & (BOOST_FT_variations)) +# if (523 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv +# define BOOST_FT_flags 523 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (8 & (BOOST_FT_variations)) +# if (267 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv +# define BOOST_FT_flags 267 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# undef BOOST_FT_syntax +# define BOOST_FT_syntax BOOST_FT_type_function_reference +# if ! ! (16 & (BOOST_FT_variations)) +# if (531 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv +# define BOOST_FT_flags 531 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (16 & (BOOST_FT_variations)) +# if (275 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv +# define BOOST_FT_flags 275 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# undef BOOST_FT_syntax +# undef BOOST_FT_mfp +# define BOOST_FT_mfp 1 +# define BOOST_FT_syntax BOOST_FT_type_member_function_pointer +# if ! ! (96 & (BOOST_FT_variations)) +# if (609 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv +# define BOOST_FT_flags 609 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (96 & (BOOST_FT_variations)) +# if (353 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv +# define BOOST_FT_flags 353 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (96 & (BOOST_FT_variations)) +# if (1633 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv const +# define BOOST_FT_flags 1633 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (96 & (BOOST_FT_variations)) +# if (1377 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv const +# define BOOST_FT_flags 1377 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (96 & (BOOST_FT_variations)) +# if (2657 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv volatile +# define BOOST_FT_flags 2657 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (96 & (BOOST_FT_variations)) +# if (2401 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv volatile +# define BOOST_FT_flags 2401 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (96 & (BOOST_FT_variations)) +# if (3681 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell +# define BOOST_FT_nullary_param BOOST_FT_NULLARY_PARAM +# define BOOST_FT_cv const volatile +# define BOOST_FT_flags 3681 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# if ! ! (96 & (BOOST_FT_variations)) +# if (3425 & (BOOST_FT_cond)) == (BOOST_FT_cond) +# define BOOST_FT_ell ... +# define BOOST_FT_nullary_param +# define BOOST_FT_cv const volatile +# define BOOST_FT_flags 3425 +# include BOOST_FT_variate_file +# undef BOOST_FT_cv +# undef BOOST_FT_ell +# undef BOOST_FT_nullary_param +# undef BOOST_FT_flags +# endif +# endif +# undef BOOST_FT_syntax +# undef BOOST_FT_mfp diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/retag_default_cc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/retag_default_cc.hpp new file mode 100644 index 0000000000..c8926f6dfc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/retag_default_cc.hpp @@ -0,0 +1,23 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_RETAG_DEFAULT_CC_HPP_INCLUDED +#define BOOST_FT_DETAIL_RETAG_DEFAULT_CC_HPP_INCLUDED + +#include + +#include + +#if defined(BOOST_FT_PREPROCESSING_MODE) +# include +#else +# include +#endif + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize.hpp new file mode 100644 index 0000000000..0b15cbbed2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize.hpp @@ -0,0 +1,79 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_SYNTHESIZE_HPP_INCLUDED +#define BOOST_FT_DETAIL_SYNTHESIZE_HPP_INCLUDED + +#include + +#include +#include + +#include +#include +#include +#include + +namespace boost { namespace function_types { namespace detail { + +template +struct synthesize_impl_o +{ + template struct synthesize_impl_i { }; +}; + +template +struct synthesize_impl + : detail::synthesize_impl_o + < ::boost::function_types::detail::decode_bits::flags + , ::boost::function_types::detail::decode_bits::cc_id + , ::boost::mpl::size::value + > + ::template synthesize_impl_i +{ }; + +template +struct synthesize_func + : detail::synthesize_impl + < Seq + , ::boost::function_types::detail::bits + < detail::retag_default_cc + < function_types::tag > + >::value + > +{ }; + +template +struct synthesize_mfp + : detail::synthesize_impl + < Seq + , ::boost::function_types::detail::bits + < detail::retag_default_cc + < function_types::tag + < typename detail::cv_traits< typename mpl::at_c::type >::tag + , nv_dcc_mfp, Tag + > > + >::value + > +{ }; + +template::type, + typename C = typename mpl::at_c::type> +struct synthesize_mop +{ + typedef R C::* type; +}; + +#define BOOST_FT_variations BOOST_FT_function|BOOST_FT_member_pointer +#define BOOST_FT_al_path boost/function_types/detail/synthesize_impl +#include + +} } } // namespace ::boost::function_types::detail + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity10_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity10_0.hpp new file mode 100644 index 0000000000..ad22e5047a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity10_0.hpp @@ -0,0 +1,334 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,0) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (BOOST_FT_nullary_param BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 1 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,0) +< typename mpl::deref< iter_0 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,1) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 2 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,1) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,2) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 3 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,2) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,3) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 4 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,3) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,4) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 5 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,4) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,5) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 6 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,5) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,6) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 7 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,6) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,7) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 8 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,7) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,8) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 9 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,8) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,9) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 10 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,9) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,10) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 11 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,10) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity10_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity10_1.hpp new file mode 100644 index 0000000000..bbd5963fa0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity10_1.hpp @@ -0,0 +1,326 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,1) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) ( BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 2 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,1) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,2) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 3 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,2) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,3) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 4 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,3) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,4) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 5 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,4) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,5) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 6 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,5) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,6) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 7 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,6) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,7) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 8 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,7) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,8) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 9 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,8) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,9) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 10 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,9) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,10) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 11 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,10) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity20_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity20_0.hpp new file mode 100644 index 0000000000..cb62e69115 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity20_0.hpp @@ -0,0 +1,517 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,11) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 12 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,11) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,12) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 13 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,12) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,13) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 14 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,13) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,14) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 15 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,14) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,15) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 16 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,15) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,16) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 17 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,16) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,17) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 18 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,17) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,18) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 19 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,18) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,19) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 20 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,19) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,20) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 21 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,20) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity20_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity20_1.hpp new file mode 100644 index 0000000000..1c5e1e747c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity20_1.hpp @@ -0,0 +1,527 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,11) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 12 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,11) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,12) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 13 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,12) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,13) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 14 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,13) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,14) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 15 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,14) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,15) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 16 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,15) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,16) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 17 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,16) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,17) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 18 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,17) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,18) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 19 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,18) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,19) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 20 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,19) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,20) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 21 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,20) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity30_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity30_0.hpp new file mode 100644 index 0000000000..63a64f0df5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity30_0.hpp @@ -0,0 +1,717 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,21) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 22 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,21) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,22) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 23 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,22) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,23) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 24 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,23) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,24) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 25 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,24) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,25) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 26 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,25) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,26) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 27 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,26) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,27) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 28 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,27) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,28) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 29 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,28) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,29) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 30 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,29) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,30) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 31 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,30) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity30_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity30_1.hpp new file mode 100644 index 0000000000..6cba73ea9a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity30_1.hpp @@ -0,0 +1,727 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,21) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 22 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,21) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,22) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 23 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,22) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,23) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 24 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,23) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,24) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 25 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,24) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,25) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 26 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,25) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,26) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 27 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,26) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,27) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 28 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,27) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,28) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 29 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,28) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,29) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 30 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,29) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,30) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 31 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,30) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity40_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity40_0.hpp new file mode 100644 index 0000000000..b065757024 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity40_0.hpp @@ -0,0 +1,917 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , 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 , typename T30 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,31) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 32 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,31) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,32) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 33 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,32) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,33) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 34 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,33) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,34) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 35 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,34) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,35) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 36 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,35) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,36) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 37 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,36) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,37) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 38 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,37) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,38) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 39 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,38) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,39) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 40 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,39) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,40) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 41 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,40) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity40_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity40_1.hpp new file mode 100644 index 0000000000..c9f21941b8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity40_1.hpp @@ -0,0 +1,927 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , 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 , typename T30 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,31) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 32 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,31) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,32) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 33 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,32) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,33) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 34 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,33) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,34) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 35 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,34) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,35) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 36 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,35) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,36) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 37 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,36) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,37) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 38 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,37) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,38) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 39 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,38) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,39) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 40 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,39) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,40) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 41 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,40) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity50_0.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity50_0.hpp new file mode 100644 index 0000000000..b1ad7b14c2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity50_0.hpp @@ -0,0 +1,1117 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , 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 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,41) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 42 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,41) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,42) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 43 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,42) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,43) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 44 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,43) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,44) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 45 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,44) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,45) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 46 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,45) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,46) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 47 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,46) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,47) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 48 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,47) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,48) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 49 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +typedef typename mpl::next< iter_47 > ::type iter_48; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,48) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +, typename mpl::deref< iter_48 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,49) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 50 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +typedef typename mpl::next< iter_47 > ::type iter_48; +typedef typename mpl::next< iter_48 > ::type iter_49; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,49) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +, typename mpl::deref< iter_48 > ::type +, typename mpl::deref< iter_49 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,50) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (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 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 51 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +typedef typename mpl::next< iter_47 > ::type iter_48; +typedef typename mpl::next< iter_48 > ::type iter_49; +typedef typename mpl::next< iter_49 > ::type iter_50; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,50) +< typename mpl::deref< iter_0 > ::type +, typename mpl::deref< iter_1 > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +, typename mpl::deref< iter_48 > ::type +, typename mpl::deref< iter_49 > ::type +, typename mpl::deref< iter_50 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity50_1.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity50_1.hpp new file mode 100644 index 0000000000..2915c412d7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/arity50_1.hpp @@ -0,0 +1,1127 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +// input: BOOST_FT_syntax type macro to use +// input: BOOST_FT_cc empty or cc specifier +// input: BOOST_FT_ell empty or "..." +// input: BOOST_FT_cv empty or cv qualifiers +// input: BOOST_FT_flags single decimal integer encoding the flags +// output: BOOST_FT_n number of component types (arity+1) +// output: BOOST_FT_arity current arity +// output: BOOST_FT_type macro that expands to the type +// output: BOOST_FT_tplargs(p) template arguments with given prefix +// output: BOOST_FT_params(p) parameters with given prefix + +# include +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , 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 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,41) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 42 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,41) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,42) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 43 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,42) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,43) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 44 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,43) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,44) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 45 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,44) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,45) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 46 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,45) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,46) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 47 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,46) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,47) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 48 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,47) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,48) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 49 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +typedef typename mpl::next< iter_47 > ::type iter_48; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,48) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +, typename mpl::deref< iter_48 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,49) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 50 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +typedef typename mpl::next< iter_47 > ::type iter_48; +typedef typename mpl::next< iter_48 > ::type iter_49; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,49) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +, typename mpl::deref< iter_48 > ::type +, typename mpl::deref< iter_49 > ::type +> ::type type; +}; +}; +template< typename R , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49 > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,50) +{ +typedef BOOST_FT_syntax(BOOST_FT_cc,type BOOST_PP_EMPTY) (T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49 BOOST_FT_ell) BOOST_FT_cv ; +}; +template< > +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, 51 > +{ +template struct synthesize_impl_i +{ +private: +typedef typename mpl::begin ::type iter_0; +typedef typename mpl::next< iter_0 > ::type iter_1; +typedef typename mpl::next< iter_1 > ::type iter_2; +typedef typename mpl::next< iter_2 > ::type iter_3; +typedef typename mpl::next< iter_3 > ::type iter_4; +typedef typename mpl::next< iter_4 > ::type iter_5; +typedef typename mpl::next< iter_5 > ::type iter_6; +typedef typename mpl::next< iter_6 > ::type iter_7; +typedef typename mpl::next< iter_7 > ::type iter_8; +typedef typename mpl::next< iter_8 > ::type iter_9; +typedef typename mpl::next< iter_9 > ::type iter_10; +typedef typename mpl::next< iter_10 > ::type iter_11; +typedef typename mpl::next< iter_11 > ::type iter_12; +typedef typename mpl::next< iter_12 > ::type iter_13; +typedef typename mpl::next< iter_13 > ::type iter_14; +typedef typename mpl::next< iter_14 > ::type iter_15; +typedef typename mpl::next< iter_15 > ::type iter_16; +typedef typename mpl::next< iter_16 > ::type iter_17; +typedef typename mpl::next< iter_17 > ::type iter_18; +typedef typename mpl::next< iter_18 > ::type iter_19; +typedef typename mpl::next< iter_19 > ::type iter_20; +typedef typename mpl::next< iter_20 > ::type iter_21; +typedef typename mpl::next< iter_21 > ::type iter_22; +typedef typename mpl::next< iter_22 > ::type iter_23; +typedef typename mpl::next< iter_23 > ::type iter_24; +typedef typename mpl::next< iter_24 > ::type iter_25; +typedef typename mpl::next< iter_25 > ::type iter_26; +typedef typename mpl::next< iter_26 > ::type iter_27; +typedef typename mpl::next< iter_27 > ::type iter_28; +typedef typename mpl::next< iter_28 > ::type iter_29; +typedef typename mpl::next< iter_29 > ::type iter_30; +typedef typename mpl::next< iter_30 > ::type iter_31; +typedef typename mpl::next< iter_31 > ::type iter_32; +typedef typename mpl::next< iter_32 > ::type iter_33; +typedef typename mpl::next< iter_33 > ::type iter_34; +typedef typename mpl::next< iter_34 > ::type iter_35; +typedef typename mpl::next< iter_35 > ::type iter_36; +typedef typename mpl::next< iter_36 > ::type iter_37; +typedef typename mpl::next< iter_37 > ::type iter_38; +typedef typename mpl::next< iter_38 > ::type iter_39; +typedef typename mpl::next< iter_39 > ::type iter_40; +typedef typename mpl::next< iter_40 > ::type iter_41; +typedef typename mpl::next< iter_41 > ::type iter_42; +typedef typename mpl::next< iter_42 > ::type iter_43; +typedef typename mpl::next< iter_43 > ::type iter_44; +typedef typename mpl::next< iter_44 > ::type iter_45; +typedef typename mpl::next< iter_45 > ::type iter_46; +typedef typename mpl::next< iter_46 > ::type iter_47; +typedef typename mpl::next< iter_47 > ::type iter_48; +typedef typename mpl::next< iter_48 > ::type iter_49; +typedef typename mpl::next< iter_49 > ::type iter_50; +public: +typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,50) +< typename mpl::deref< iter_0 > ::type +, typename detail::cv_traits< +typename mpl::deref< iter_1 > ::type > ::type +, typename mpl::deref< iter_2 > ::type +, typename mpl::deref< iter_3 > ::type +, typename mpl::deref< iter_4 > ::type +, typename mpl::deref< iter_5 > ::type +, typename mpl::deref< iter_6 > ::type +, typename mpl::deref< iter_7 > ::type +, typename mpl::deref< iter_8 > ::type +, typename mpl::deref< iter_9 > ::type +, typename mpl::deref< iter_10 > ::type +, typename mpl::deref< iter_11 > ::type +, typename mpl::deref< iter_12 > ::type +, typename mpl::deref< iter_13 > ::type +, typename mpl::deref< iter_14 > ::type +, typename mpl::deref< iter_15 > ::type +, typename mpl::deref< iter_16 > ::type +, typename mpl::deref< iter_17 > ::type +, typename mpl::deref< iter_18 > ::type +, typename mpl::deref< iter_19 > ::type +, typename mpl::deref< iter_20 > ::type +, typename mpl::deref< iter_21 > ::type +, typename mpl::deref< iter_22 > ::type +, typename mpl::deref< iter_23 > ::type +, typename mpl::deref< iter_24 > ::type +, typename mpl::deref< iter_25 > ::type +, typename mpl::deref< iter_26 > ::type +, typename mpl::deref< iter_27 > ::type +, typename mpl::deref< iter_28 > ::type +, typename mpl::deref< iter_29 > ::type +, typename mpl::deref< iter_30 > ::type +, typename mpl::deref< iter_31 > ::type +, typename mpl::deref< iter_32 > ::type +, typename mpl::deref< iter_33 > ::type +, typename mpl::deref< iter_34 > ::type +, typename mpl::deref< iter_35 > ::type +, typename mpl::deref< iter_36 > ::type +, typename mpl::deref< iter_37 > ::type +, typename mpl::deref< iter_38 > ::type +, typename mpl::deref< iter_39 > ::type +, typename mpl::deref< iter_40 > ::type +, typename mpl::deref< iter_41 > ::type +, typename mpl::deref< iter_42 > ::type +, typename mpl::deref< iter_43 > ::type +, typename mpl::deref< iter_44 > ::type +, typename mpl::deref< iter_45 > ::type +, typename mpl::deref< iter_46 > ::type +, typename mpl::deref< iter_47 > ::type +, typename mpl::deref< iter_48 > ::type +, typename mpl::deref< iter_49 > ::type +, typename mpl::deref< iter_50 > ::type +> ::type type; +}; +}; +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/master.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/master.hpp new file mode 100644 index 0000000000..49d38ef4d4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/synthesize_impl/master.hpp @@ -0,0 +1,87 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +// no include guards, this file is intended for multiple inclusion + +#if BOOST_FT_ARITY_LOOP_PREFIX + +# ifndef BOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED +# define BOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED +# include +# include +# include +# include +# include +# endif + +# define BOOST_FT_type_name type + +# ifdef BOOST_FT_flags +# define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +# define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +# else +BOOST_PP_EXPAND(#) define BOOST_FT_make_type(flags,cc,arity) BOOST_FT_make_type_impl(flags,cc,arity) +BOOST_PP_EXPAND(#) define BOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity +# endif + +# define BOOST_FT_iter(i) BOOST_PP_CAT(iter_,i) + +#elif BOOST_FT_ARITY_LOOP_IS_ITERATING + +template< BOOST_FT_tplargs(BOOST_PP_IDENTITY(typename)) > +struct BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,BOOST_FT_arity) +{ + typedef BOOST_FT_type ; +}; + +template<> +struct synthesize_impl_o< BOOST_FT_flags, BOOST_FT_cc_id, BOOST_FT_n > +{ + template struct synthesize_impl_i + { + private: + typedef typename mpl::begin::type BOOST_FT_iter(0); +# if BOOST_FT_n > 1 +# define BOOST_PP_LOCAL_MACRO(i) typedef typename mpl::next< \ + BOOST_FT_iter(BOOST_PP_DEC(i)) >::type BOOST_FT_iter(i); +# define BOOST_PP_LOCAL_LIMITS (1,BOOST_FT_n-1) +# include BOOST_PP_LOCAL_ITERATE() +# endif + public: + typedef typename detail::BOOST_FT_make_type(BOOST_FT_flags,BOOST_FT_cc_id,BOOST_FT_arity) + < typename mpl::deref< BOOST_FT_iter(0) >::type +# if BOOST_FT_mfp + , typename detail::cv_traits< + typename mpl::deref< BOOST_FT_iter(1) >::type >::type +# endif +# if BOOST_FT_n > (BOOST_FT_mfp+1) +# define BOOST_PP_LOCAL_LIMITS (BOOST_FT_mfp+1,BOOST_FT_n-1) +# define BOOST_PP_LOCAL_MACRO(i) \ + , typename mpl::deref< BOOST_FT_iter(i) >::type +# include BOOST_PP_LOCAL_ITERATE() +# endif + >::type type; + }; +}; + +#elif BOOST_FT_ARITY_LOOP_SUFFIX + +# ifdef BOOST_FT_flags +# undef BOOST_FT_make_type +# undef BOOST_FT_make_type_impl +# else +BOOST_PP_EXPAND(#) undef BOOST_FT_make_type +BOOST_PP_EXPAND(#) undef BOOST_FT_make_type_impl +# endif +# undef BOOST_FT_iter +# undef BOOST_FT_type_name + +#else +# error "attempt to use arity loop master file without loop" +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/to_sequence.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/to_sequence.hpp new file mode 100644 index 0000000000..828acd9af2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/detail/to_sequence.hpp @@ -0,0 +1,47 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED +#define BOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED + +#include +#include +#include +#include +#include + +#include + +namespace boost { namespace function_types { namespace detail { + +// wrap first arguments in components, if callable builtin type +template +struct to_sequence +{ + typedef typename + mpl::eval_if + < is_callable_builtin + , to_sequence< components > + , mpl::identity< T > + >::type + type; +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +// reduce template instantiations, if possible +template +struct to_sequence< components > +{ + typedef typename components::types type; +}; +#endif + +} } } // namespace ::boost::function_types::detail + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_arity.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_arity.hpp new file mode 100644 index 0000000000..40f0f653cc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_arity.hpp @@ -0,0 +1,38 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_FUNCTION_ARITY_HPP_INCLUDED +#define BOOST_FT_FUNCTION_ARITY_HPP_INCLUDED + +#include +#include + +#include +#include + +#include +#include + +namespace boost +{ + namespace function_types + { + template struct function_arity + : mpl::if_ + < function_types::is_callable_builtin + , typename components::function_arity, boost::blank + >::type + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,function_arity,(T)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,function_types::function_arity) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_pointer.hpp new file mode 100644 index 0000000000..a8b832f32b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_pointer.hpp @@ -0,0 +1,32 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_FUNCTION_POINTER_HPP_INCLUDED +#define BOOST_FT_FUNCTION_POINTER_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template struct function_pointer + { + typedef typename function_types::function_type::type * type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,function_pointer,(Types,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::function_pointer) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_reference.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_reference.hpp new file mode 100644 index 0000000000..5fe7e3cc8b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_reference.hpp @@ -0,0 +1,32 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_FUNCTION_REFERENCE_HPP_INCLUDED +#define BOOST_FT_FUNCTION_REFERENCE_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template struct function_reference + { + typedef typename function_types::function_type::type & type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,function_reference,(Types,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::function_reference) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_type.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_type.hpp new file mode 100644 index 0000000000..c3b2c96b94 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/function_type.hpp @@ -0,0 +1,29 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_FUNCTION_TYPE_HPP_INCLUDED +#define BOOST_FT_FUNCTION_TYPE_HPP_INCLUDED + +#include +#include + +namespace boost +{ + namespace function_types + { + template struct function_type + : detail::synthesize_func::type, Tag> + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,function_type,(Types,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::function_type) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_callable_builtin.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_callable_builtin.hpp new file mode 100644 index 0000000000..b1a7c833ba --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_callable_builtin.hpp @@ -0,0 +1,35 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_CALLABLE_BUILTIN_HPP_INCLUDED +#define BOOST_FT_IS_CALLABLE_BUILTIN_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T, typename Tag = null_tag > + struct is_callable_builtin + : function_types::represents + < function_types::components + , function_types::tag + > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_callable_builtin,(T,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_callable_builtin) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function.hpp new file mode 100644 index 0000000000..d29229bb69 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function.hpp @@ -0,0 +1,34 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_FUNCTION_HPP_INCLUDED +#define BOOST_FT_IS_FUNCTION_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T, typename Tag = null_tag > + struct is_function + : function_types::represents + < function_types::components + , function_types::tag + > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_function,(T,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_function) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function_pointer.hpp new file mode 100644 index 0000000000..5bff6d36d9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function_pointer.hpp @@ -0,0 +1,34 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_FUNCTION_POINTER_HPP_INCLUDED +#define BOOST_FT_IS_FUNCTION_POINTER_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T, typename Tag = null_tag > + struct is_function_pointer + : function_types::represents + < function_types::components + , function_types::tag + > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_function_pointer,(T,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_function_pointer) +} + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function_reference.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function_reference.hpp new file mode 100644 index 0000000000..f2e4c1c605 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_function_reference.hpp @@ -0,0 +1,34 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_FUNCTION_REFERENCE_HPP_INCLUDED +#define BOOST_FT_IS_FUNCTION_REFERENCE_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T, typename Tag = null_tag > + struct is_function_reference + : function_types::represents + < function_types::components + , function_types::tag > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_function_reference,(T,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_function_reference) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_function_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_function_pointer.hpp new file mode 100644 index 0000000000..a51903520b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_function_pointer.hpp @@ -0,0 +1,33 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED +#define BOOST_FT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T, typename Tag = null_tag > + struct is_member_function_pointer + : function_types::represents + < function_types::components + , function_types::tag > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_member_function_pointer,(T,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_member_function_pointer) +} +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_object_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_object_pointer.hpp new file mode 100644 index 0000000000..77527d9a3d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_object_pointer.hpp @@ -0,0 +1,34 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED +#define BOOST_FT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T > + struct is_member_object_pointer + : function_types::detail::represents_impl + < function_types::components + , detail::member_object_pointer_tag > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_member_object_pointer,(T)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,function_types::is_member_object_pointer) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_pointer.hpp new file mode 100644 index 0000000000..f53e0beb71 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_member_pointer.hpp @@ -0,0 +1,34 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_MEMBER_POINTER_HPP_INCLUDED +#define BOOST_FT_IS_MEMBER_POINTER_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T, typename Tag = null_tag > + struct is_member_pointer + : function_types::represents + < function_types::components + , function_types::tag + > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_member_pointer,(T,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_member_pointer) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_nonmember_callable_builtin.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_nonmember_callable_builtin.hpp new file mode 100644 index 0000000000..3a27a2e7f7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/is_nonmember_callable_builtin.hpp @@ -0,0 +1,35 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_IS_NONMEMBER_CALLABLE_BUILTIN_HPP_INCLUDED +#define BOOST_FT_IS_NONMEMBER_CALLABLE_BUILTIN_HPP_INCLUDED + +#include +#include + +#include + +namespace boost +{ + namespace function_types + { + template< typename T, typename Tag = null_tag > + struct is_nonmember_callable_builtin + : function_types::represents + < function_types::components + , function_types::tag + > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_nonmember_callable_builtin,(T,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::is_nonmember_callable_builtin) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/member_function_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/member_function_pointer.hpp new file mode 100644 index 0000000000..eab61118cb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/member_function_pointer.hpp @@ -0,0 +1,33 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_MEMBER_FUNCTION_POINTER_HPP_INCLUDED +#define BOOST_FT_MEMBER_FUNCTION_POINTER_HPP_INCLUDED + +#include +#include + +#include +#include + +namespace boost +{ + namespace function_types + { + template + struct member_function_pointer + : detail::synthesize_mfp< typename detail::to_sequence::type, Tag > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,member_function_pointer,(Types,Tag)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::member_function_pointer) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/member_object_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/member_object_pointer.hpp new file mode 100644 index 0000000000..d0aa3f3418 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/member_object_pointer.hpp @@ -0,0 +1,34 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_MEMBER_OBJECT_POINTER_HPP_INCLUDED +#define BOOST_FT_MEMBER_OBJECT_POINTER_HPP_INCLUDED + +#include +#include + +#include +#include + +namespace boost +{ + namespace function_types + { + template + struct member_object_pointer + : detail::synthesize_mop< typename detail::to_sequence::type > + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,member_object_pointer,(Types)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,function_types::member_object_pointer) +} + +#endif + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/parameter_types.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/parameter_types.hpp new file mode 100644 index 0000000000..5e049bf59c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/parameter_types.hpp @@ -0,0 +1,55 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_PARAMETER_TYPES_HPP_INCLUDED +#define BOOST_FT_PARAMETER_TYPES_HPP_INCLUDED + +#include +#include + +#include +#include + +#include + +#include +#include + +namespace boost +{ + namespace function_types + { + using mpl::placeholders::_; + + template< typename T, typename ClassTypeTransform = add_reference<_> > + struct parameter_types; + + namespace detail + { + template + struct parameter_types_impl + : mpl::pop_front + < typename function_types::components::types + >::type + { }; + } + + template struct parameter_types + : mpl::if_ + < function_types::is_callable_builtin + , detail::parameter_types_impl, boost::blank + >::type + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,parameter_types,(T,ClassTypeTransform)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,function_types::parameter_types) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/property_tags.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/property_tags.hpp new file mode 100644 index 0000000000..bbc64d53a3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/property_tags.hpp @@ -0,0 +1,149 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_DETAIL_TAGS_HPP_INCLUDED +#define BOOST_FT_DETAIL_TAGS_HPP_INCLUDED + +#include + +#include +#include + + +namespace boost { namespace function_types { + +namespace detail +{ + typedef long bits_t; + + template struct constant + : boost::integral_constant + { }; + + template struct property_tag + { + typedef constant bits; + typedef constant mask; + }; + + template struct bits : T::bits { }; + template struct mask : T::mask { }; + + // forward declaration, defined in pp_tags + template struct encode_bits_impl; + + // forward declaration, defined in pp_tags + template + struct tag_ice; + + // forward declaration, defined in retag_default_cc + template struct retag_default_cc; + + template struct encode_bits + : constant< + ::boost::function_types::detail::encode_bits_impl::value + > + { }; + + template struct compound_tag + { + typedef constant< + ::boost::function_types::detail::tag_ice + < ::boost::function_types::detail::bits::value + , ::boost::function_types::detail::mask::value + , ::boost::function_types::detail::bits::value + , ::boost::function_types::detail::mask::value + >::combined_bits + > bits; + + typedef constant< + ::boost::function_types::detail::tag_ice + < ::boost::function_types::detail::bits::value + , ::boost::function_types::detail::mask::value + , ::boost::function_types::detail::bits::value + , ::boost::function_types::detail::mask::value + >::combined_mask + > mask; + }; + + template + struct changed_tag + : Base + { + typedef mpl::bitxor_ + + bits; + }; + + template struct represents_impl + : boost::integral_constant::value + , ::boost::function_types::detail::mask::value + , ::boost::function_types::detail::bits::value + , ::boost::function_types::detail::mask::value + >::match + > + { }; + +} // namespace detail + +typedef detail::property_tag<0,0> null_tag; + +template +struct tag + : detail::compound_tag< detail::compound_tag, + detail::compound_tag > +{ }; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct tag + : detail::compound_tag,Tag3> +{ }; +template struct tag + : detail::compound_tag +{ }; +template struct tag + : Tag1 +{ }; +#endif + + +template struct represents + : detail::represents_impl > +{ }; + + +template struct extract +{ + typedef detail::constant< + ::boost::function_types::detail::tag_ice + < ::boost::function_types::detail::bits::value + , ::boost::function_types::detail::mask::value + , ::boost::function_types::detail::bits::value + , ::boost::function_types::detail::mask::value + >::extracted_bits + > bits; + + typedef detail::constant< + ::boost::function_types::detail::mask::value + > mask; +}; + +} } // namespace ::boost::function_types + +#include + +namespace boost { namespace function_types { +#define BOOST_FT_cc_file +#include +} } // namespace boost::function_types + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/function_types/result_type.hpp b/deal.II/contrib/boost/include/boost-1.37.0/function_types/result_type.hpp new file mode 100644 index 0000000000..1fcaba6622 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/function_types/result_type.hpp @@ -0,0 +1,50 @@ + +// (C) Copyright Tobias Schwinger +// +// Use modification and distribution are subject to the boost Software License, +// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). + +//------------------------------------------------------------------------------ + +#ifndef BOOST_FT_RESULT_TYPE_HPP_INCLUDED +#define BOOST_FT_RESULT_TYPE_HPP_INCLUDED + +#include +#include + +#include +#include + +#include + +#include +#include + +namespace boost +{ + namespace function_types + { + template< typename T > struct result_type; + + namespace detail + { + template struct result_type_impl + : mpl::at_c + < typename function_types::components::types, 0 > + { }; + } + + template struct result_type + : mpl::if_ + < function_types::is_callable_builtin + , detail::result_type_impl, boost::blank + >::type + { + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,result_type,(T)) + }; + } + BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,function_types::result_type) +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional.hpp new file mode 100644 index 0000000000..3e0588e00f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional.hpp @@ -0,0 +1,548 @@ +// ------------------------------------------------------------------------------ +// Copyright (c) 2000 Cadenza New Zealand Ltd +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// ------------------------------------------------------------------------------ +// Boost functional.hpp header file +// See http://www.boost.org/libs/functional for documentation. +// ------------------------------------------------------------------------------ +// $Id: functional.hpp 36246 2006-12-02 14:17:26Z andreas_huber69 $ +// ------------------------------------------------------------------------------ + +#ifndef BOOST_FUNCTIONAL_HPP +#define BOOST_FUNCTIONAL_HPP + +#include +#include +#include + +namespace boost +{ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // -------------------------------------------------------------------------- + // The following traits classes allow us to avoid the need for ptr_fun + // because the types of arguments and the result of a function can be + // deduced. + // + // In addition to the standard types defined in unary_function and + // binary_function, we add + // + // - function_type, the type of the function or function object itself. + // + // - param_type, the type that should be used for passing the function or + // function object as an argument. + // -------------------------------------------------------------------------- + namespace detail + { + template + struct unary_traits_imp; + + template + struct unary_traits_imp + { + typedef Operation function_type; + typedef const function_type & param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::argument_type argument_type; + }; + + template + struct unary_traits_imp + { + typedef R (*function_type)(A); + typedef R (*param_type)(A); + typedef R result_type; + typedef A argument_type; + }; + + template + struct binary_traits_imp; + + template + struct binary_traits_imp + { + typedef Operation function_type; + typedef const function_type & param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::first_argument_type first_argument_type; + typedef typename Operation::second_argument_type second_argument_type; + }; + + template + struct binary_traits_imp + { + typedef R (*function_type)(A1,A2); + typedef R (*param_type)(A1,A2); + typedef R result_type; + typedef A1 first_argument_type; + typedef A2 second_argument_type; + }; + } // namespace detail + + template + struct unary_traits + { + typedef typename detail::unary_traits_imp::function_type function_type; + typedef typename detail::unary_traits_imp::param_type param_type; + typedef typename detail::unary_traits_imp::result_type result_type; + typedef typename detail::unary_traits_imp::argument_type argument_type; + }; + + template + struct unary_traits + { + typedef R (*function_type)(A); + typedef R (*param_type)(A); + typedef R result_type; + typedef A argument_type; + }; + + template + struct binary_traits + { + typedef typename detail::binary_traits_imp::function_type function_type; + typedef typename detail::binary_traits_imp::param_type param_type; + typedef typename detail::binary_traits_imp::result_type result_type; + typedef typename detail::binary_traits_imp::first_argument_type first_argument_type; + typedef typename detail::binary_traits_imp::second_argument_type second_argument_type; + }; + + template + struct binary_traits + { + typedef R (*function_type)(A1,A2); + typedef R (*param_type)(A1,A2); + typedef R result_type; + typedef A1 first_argument_type; + typedef A2 second_argument_type; + }; +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // -------------------------------------------------------------------------- + // If we have no partial specialisation available, decay to a situation + // that is no worse than in the Standard, i.e., ptr_fun will be required. + // -------------------------------------------------------------------------- + + template + struct unary_traits + { + typedef Operation function_type; + typedef const Operation& param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::argument_type argument_type; + }; + + template + struct binary_traits + { + typedef Operation function_type; + typedef const Operation & param_type; + typedef typename Operation::result_type result_type; + typedef typename Operation::first_argument_type first_argument_type; + typedef typename Operation::second_argument_type second_argument_type; + }; +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // -------------------------------------------------------------------------- + // unary_negate, not1 + // -------------------------------------------------------------------------- + template + class unary_negate + : public std::unary_function::argument_type,bool> + { + public: + explicit unary_negate(typename unary_traits::param_type x) + : + pred(x) + {} + bool operator()(typename call_traits::argument_type>::param_type x) const + { + return !pred(x); + } + private: + typename unary_traits::function_type pred; + }; + + template + unary_negate not1(const Predicate &pred) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return unary_negate((typename unary_traits::param_type)pred); + } + + template + unary_negate not1(Predicate &pred) + { + return unary_negate(pred); + } + + // -------------------------------------------------------------------------- + // binary_negate, not2 + // -------------------------------------------------------------------------- + template + class binary_negate + : public std::binary_function::first_argument_type, + typename binary_traits::second_argument_type, + bool> + { + public: + explicit binary_negate(typename binary_traits::param_type x) + : + pred(x) + {} + bool operator()(typename call_traits::first_argument_type>::param_type x, + typename call_traits::second_argument_type>::param_type y) const + { + return !pred(x,y); + } + private: + typename binary_traits::function_type pred; + }; + + template + binary_negate not2(const Predicate &pred) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return binary_negate((typename binary_traits::param_type)pred); + } + + template + binary_negate not2(Predicate &pred) + { + return binary_negate(pred); + } + + // -------------------------------------------------------------------------- + // binder1st, bind1st + // -------------------------------------------------------------------------- + template + class binder1st + : public std::unary_function::second_argument_type, + typename binary_traits::result_type> + { + public: + binder1st(typename binary_traits::param_type x, + typename call_traits::first_argument_type>::param_type y) + : + op(x), value(y) + {} + + typename binary_traits::result_type + operator()(typename call_traits::second_argument_type>::param_type x) const + { + return op(value, x); + } + + protected: + typename binary_traits::function_type op; + typename binary_traits::first_argument_type value; + }; + + template + inline binder1st bind1st(const Operation &op, + typename call_traits< + typename binary_traits::first_argument_type + >::param_type x) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return binder1st((typename binary_traits::param_type)op, x); + } + + template + inline binder1st bind1st(Operation &op, + typename call_traits< + typename binary_traits::first_argument_type + >::param_type x) + { + return binder1st(op, x); + } + + // -------------------------------------------------------------------------- + // binder2nd, bind2nd + // -------------------------------------------------------------------------- + template + class binder2nd + : public std::unary_function::first_argument_type, + typename binary_traits::result_type> + { + public: + binder2nd(typename binary_traits::param_type x, + typename call_traits::second_argument_type>::param_type y) + : + op(x), value(y) + {} + + typename binary_traits::result_type + operator()(typename call_traits::first_argument_type>::param_type x) const + { + return op(x, value); + } + + protected: + typename binary_traits::function_type op; + typename binary_traits::second_argument_type value; + }; + + template + inline binder2nd bind2nd(const Operation &op, + typename call_traits< + typename binary_traits::second_argument_type + >::param_type x) + { + // The cast is to placate Borland C++Builder in certain circumstances. + // I don't think it should be necessary. + return binder2nd((typename binary_traits::param_type)op, x); + } + + template + inline binder2nd bind2nd(Operation &op, + typename call_traits< + typename binary_traits::second_argument_type + >::param_type x) + { + return binder2nd(op, x); + } + + // -------------------------------------------------------------------------- + // mem_fun, etc + // -------------------------------------------------------------------------- + template + class mem_fun_t : public std::unary_function + { + public: + explicit mem_fun_t(S (T::*p)()) + : + ptr(p) + {} + S operator()(T* p) const + { + return (p->*ptr)(); + } + private: + S (T::*ptr)(); + }; + + template + class mem_fun1_t : public std::binary_function + { + public: + explicit mem_fun1_t(S (T::*p)(A)) + : + ptr(p) + {} + S operator()(T* p, typename call_traits::param_type x) const + { + return (p->*ptr)(x); + } + private: + S (T::*ptr)(A); + }; + + template + class const_mem_fun_t : public std::unary_function + { + public: + explicit const_mem_fun_t(S (T::*p)() const) + : + ptr(p) + {} + S operator()(const T* p) const + { + return (p->*ptr)(); + } + private: + S (T::*ptr)() const; + }; + + template + class const_mem_fun1_t : public std::binary_function + { + public: + explicit const_mem_fun1_t(S (T::*p)(A) const) + : + ptr(p) + {} + S operator()(const T* p, typename call_traits::param_type x) const + { + return (p->*ptr)(x); + } + private: + S (T::*ptr)(A) const; + }; + + template + inline mem_fun_t mem_fun(S (T::*f)()) + { + return mem_fun_t(f); + } + + template + inline mem_fun1_t mem_fun(S (T::*f)(A)) + { + return mem_fun1_t(f); + } + +#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST + template + inline const_mem_fun_t mem_fun(S (T::*f)() const) + { + return const_mem_fun_t(f); + } + + template + inline const_mem_fun1_t mem_fun(S (T::*f)(A) const) + { + return const_mem_fun1_t(f); + } +#endif // BOOST_NO_POINTER_TO_MEMBER_CONST + + // -------------------------------------------------------------------------- + // mem_fun_ref, etc + // -------------------------------------------------------------------------- + template + class mem_fun_ref_t : public std::unary_function + { + public: + explicit mem_fun_ref_t(S (T::*p)()) + : + ptr(p) + {} + S operator()(T& p) const + { + return (p.*ptr)(); + } + private: + S (T::*ptr)(); + }; + + template + class mem_fun1_ref_t : public std::binary_function + { + public: + explicit mem_fun1_ref_t(S (T::*p)(A)) + : + ptr(p) + {} + S operator()(T& p, typename call_traits::param_type x) const + { + return (p.*ptr)(x); + } + private: + S (T::*ptr)(A); + }; + + template + class const_mem_fun_ref_t : public std::unary_function + { + public: + explicit const_mem_fun_ref_t(S (T::*p)() const) + : + ptr(p) + {} + + S operator()(const T &p) const + { + return (p.*ptr)(); + } + private: + S (T::*ptr)() const; + }; + + template + class const_mem_fun1_ref_t : public std::binary_function + { + public: + explicit const_mem_fun1_ref_t(S (T::*p)(A) const) + : + ptr(p) + {} + + S operator()(const T& p, typename call_traits::param_type x) const + { + return (p.*ptr)(x); + } + private: + S (T::*ptr)(A) const; + }; + + template + inline mem_fun_ref_t mem_fun_ref(S (T::*f)()) + { + return mem_fun_ref_t(f); + } + + template + inline mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)) + { + return mem_fun1_ref_t(f); + } + +#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST + template + inline const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const) + { + return const_mem_fun_ref_t(f); + } + + template + inline const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const) + { + return const_mem_fun1_ref_t(f); + } +#endif // BOOST_NO_POINTER_TO_MEMBER_CONST + + // -------------------------------------------------------------------------- + // ptr_fun + // -------------------------------------------------------------------------- + template + class pointer_to_unary_function : public std::unary_function + { + public: + explicit pointer_to_unary_function(Result (*f)(Arg)) + : + func(f) + {} + + Result operator()(typename call_traits::param_type x) const + { + return func(x); + } + + private: + Result (*func)(Arg); + }; + + template + inline pointer_to_unary_function ptr_fun(Result (*f)(Arg)) + { + return pointer_to_unary_function(f); + } + + template + class pointer_to_binary_function : public std::binary_function + { + public: + explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)) + : + func(f) + {} + + Result operator()(typename call_traits::param_type x, typename call_traits::param_type y) const + { + return func(x,y); + } + + private: + Result (*func)(Arg1, Arg2); + }; + + template + inline pointer_to_binary_function ptr_fun(Result (*f)(Arg1, Arg2)) + { + return pointer_to_binary_function(f); + } +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/container_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/container_fwd.hpp new file mode 100644 index 0000000000..8685905cda --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/container_fwd.hpp @@ -0,0 +1,95 @@ + +// Copyright 2005-2008 Daniel James. +// 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_DETAIL_CONTAINER_FWD_HPP) +#define BOOST_DETAIL_CONTAINER_FWD_HPP + +#include +#include + +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +#define BOOST_HASH_CHAR_TRAITS string_char_traits +#else +#define BOOST_HASH_CHAR_TRAITS char_traits +#endif + +#if (defined(__GLIBCXX__) && defined(_GLIBCXX_DEBUG)) \ + || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \ + || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ + || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) + +#include +#include +#include +#include +#include +#include +#include +#include + +#else + +#include + +#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \ + defined(__STL_CONFIG_H) + +#define BOOST_CONTAINER_FWD_BAD_BITSET + +#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) +#define BOOST_CONTAINER_FWD_BAD_DEQUE +#endif + +#endif + +#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE) +#include +#endif + +#if defined(BOOST_CONTAINER_FWD_BAD_BITSET) +#include +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4099) // struct/class mismatch in fwd declarations +#endif + +namespace std +{ + template class allocator; + template class basic_string; + template struct BOOST_HASH_CHAR_TRAITS; + template class complex; +} + +// gcc 3.4 and greater +namespace std +{ +#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE) + template class deque; +#endif + + template class list; + template class vector; + template class map; + template + class multimap; + template class set; + template class multiset; + +#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET) + template class bitset; +#endif + template struct pair; +} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/float_functions.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/float_functions.hpp new file mode 100644 index 0000000000..5cef36e693 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/float_functions.hpp @@ -0,0 +1,158 @@ + +// Copyright 2005-2008 Daniel James. +// 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_FUNCTIONAL_DETAIL_FLOAT_FUNCTIONS_HPP) +#define BOOST_FUNCTIONAL_DETAIL_FLOAT_FUNCTIONS_HPP + +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// The C++ standard requires that the C float functions are overloarded +// for float, double and long double in the std namespace, but some of the older +// library implementations don't support this. On some that don't, the C99 +// float functions (frexpf, frexpl, etc.) are available. +// +// Some of this is based on guess work. If I don't know any better I assume that +// the standard C++ overloaded functions are available. If they're not then this +// means that the argument is cast to a double and back, which is inefficient +// and will give pretty bad results for long doubles - so if you know better +// let me know. + +// STLport: +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +# if (defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__))) || defined(__DMC__) +# define BOOST_HASH_USE_C99_FLOAT_FUNCS +# elif defined(BOOST_MSVC) && BOOST_MSVC < 1300 +# define BOOST_HASH_USE_C99_FLOAT_FUNCS +# else +# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +# endif + +// Roguewave: +// +// On borland 5.51, with roguewave 2.1.1 the standard C++ overloads aren't +// defined, but for the same version of roguewave on sunpro they are. +#elif defined(_RWSTD_VER) +# if defined(__BORLANDC__) +# define BOOST_HASH_USE_C99_FLOAT_FUNCS +# define BOOST_HASH_C99_NO_FLOAT_FUNCS +# elif defined(__DECCXX) +# define BOOST_HASH_USE_C99_FLOAT_FUNCS +# else +# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +# endif + +// libstdc++ (gcc 3.0 onwards, I think) +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS + +// SGI: +#elif defined(__STL_CONFIG_H) +# if defined(linux) || defined(__linux) || defined(__linux__) +# define BOOST_HASH_USE_C99_FLOAT_FUNCS +# else +# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +# endif + +// Dinkumware. +#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) +// Some versions of Visual C++ don't seem to have the C++ overloads but they +// all seem to have the c99 float overloads +# if defined(BOOST_MSVC) +# define BOOST_HASH_USE_C99_FLOAT_FUNCS +// On other platforms the C++ overloads seem to have been introduced sometime +// before 402. +# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 402) +# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +# else +# define BOOST_HASH_USE_C99_FLOAT_FUNCS +# endif + +// Digital Mars +#elif defined(__DMC__) +# define BOOST_HASH_USE_C99_FLOAT_FUNCS + +// Use overloaded float functions by default. +#else +# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#endif + +namespace boost +{ + namespace hash_detail + { + + inline float call_ldexp(float v, int exp) + { + using namespace std; +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \ + defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) + return ldexp(v, exp); +#else + return ldexpf(v, exp); +#endif + } + + inline double call_ldexp(double v, int exp) + { + using namespace std; + return ldexp(v, exp); + } + + inline long double call_ldexp(long double v, int exp) + { + using namespace std; +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) + return ldexp(v, exp); +#else + return ldexpl(v, exp); +#endif + } + + inline float call_frexp(float v, int* exp) + { + using namespace std; +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \ + defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) + return frexp(v, exp); +#else + return frexpf(v, exp); +#endif + } + + inline double call_frexp(double v, int* exp) + { + using namespace std; + return frexp(v, exp); + } + + inline long double call_frexp(long double v, int* exp) + { + using namespace std; +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) + return frexp(v, exp); +#else + return frexpl(v, exp); +#endif + } + } +} + +#if defined(BOOST_HASH_USE_C99_FLOAT_FUNCS) +#undef BOOST_HASH_USE_C99_FLOAT_FUNCS +#endif + +#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) +#undef BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS +#endif + +#if defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) +#undef BOOST_HASH_C99_NO_FLOAT_FUNCS +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/hash_float.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/hash_float.hpp new file mode 100644 index 0000000000..dc35afb905 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/detail/hash_float.hpp @@ -0,0 +1,201 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_DETAIL_HASH_FLOAT_HEADER) +#define BOOST_FUNCTIONAL_DETAIL_HASH_FLOAT_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC >= 1400 +#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does + // not satisfy test. Loop body not executed +#endif +#endif + +#include +#include +#include +#include +#include + +// Select implementation for the current platform. + +// Cygwn +#if defined(__CYGWIN__) +# if defined(__i386__) || defined(_M_IX86) +# define BOOST_HASH_USE_x86_BINARY_HASH +# endif + +// STLport +#elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +// fpclassify aren't good enough on STLport. + +// GNU libstdc++ 3 +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \ + !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) +# define BOOST_HASH_USE_FPCLASSIFY +# endif + +// Dinkumware Library, on Visual C++ +#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) + +// Not using _fpclass because it is only available for double. + +#endif + +// On OpenBSD, numeric_limits is not reliable for long doubles, but +// the macros defined in are. + +#if defined(__OpenBSD__) +#include +#endif + +namespace boost +{ + namespace hash_detail + { + template + struct limits : std::numeric_limits {}; + +#if defined(__OpenBSD__) + template <> + struct limits + : std::numeric_limits + { + static long double epsilon() { + return LDBL_EPSILON; + } + + static long double (max)() { + return LDBL_MAX; + } + + static long double (min)() { + return LDBL_MIN; + } + + BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG); + BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP); + BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP); + }; +#endif // __OpenBSD__ + + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + +// A simple, non-portable hash algorithm for x86. +#if defined(BOOST_HASH_USE_x86_BINARY_HASH) + inline std::size_t float_hash_impl(float v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr; + return seed; + } + + inline std::size_t float_hash_impl(double v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr++; + hash_float_combine(seed, *ptr); + return seed; + } + + inline std::size_t float_hash_impl(long double v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr++; + hash_float_combine(seed, *ptr++); + hash_float_combine(seed, *(boost::uint16_t*)ptr); + return seed; + } + +#else + + template + inline std::size_t float_hash_impl(T v) + { + int exp = 0; + + v = boost::hash_detail::call_frexp(v, &exp); + + // A postive value is easier to hash, so combine the + // sign with the exponent. + if(v < 0) { + v = -v; + exp += limits::max_exponent - + limits::min_exponent; + } + + // The result of frexp is always between 0.5 and 1, so its + // top bit will always be 1. Subtract by 0.5 to remove that. + v -= T(0.5); + v = boost::hash_detail::call_ldexp(v, + limits::digits + 1); + std::size_t seed = static_cast(v); + v -= seed; + + // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; + std::size_t const length + = (limits::digits * + boost::static_log2::radix>::value - 1) + / limits::digits; + + for(std::size_t i = 0; i != length; ++i) + { + v = boost::hash_detail::call_ldexp(v, + limits::digits); + std::size_t part = static_cast(v); + v -= part; + hash_float_combine(seed, part); + } + + hash_float_combine(seed, exp); + + return seed; + } +#endif + + template + inline std::size_t float_hash_value(T v) + { +#if defined(BOOST_HASH_USE_FPCLASSIFY) + using namespace std; + switch (fpclassify(v)) { + case FP_ZERO: + return 0; + case FP_INFINITE: + return (std::size_t)(v > 0 ? -1 : -2); + case FP_NAN: + return (std::size_t)(-3); + case FP_NORMAL: + case FP_SUBNORMAL: + return float_hash_impl(v); + default: + BOOST_ASSERT(0); + return 0; + } +#else + return v == 0 ? 0 : float_hash_impl(v); +#endif + } + } +} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash.hpp new file mode 100644 index 0000000000..46b611b3f5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash.hpp @@ -0,0 +1,11 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#include + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/deque.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/deque.hpp new file mode 100644 index 0000000000..06d23c2200 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/deque.hpp @@ -0,0 +1,27 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_DEQUE_HPP) +#define BOOST_FUNCTIONAL_HASH_DEQUE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(__EDG__) +#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +#pragma message("Warning: boost/functional/hash/deque.hpp is deprecated, use boost/functional/hash.hpp instead.") +#elif defined(__GNUC__) || defined(__HP_aCC) || \ + defined(__SUNPRO_CC) || defined(__IBMCPP__) +#warning "boost/functional/hash/deque.hpp is deprecated, use boost/functional/hash.hpp instead." +#endif + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/extensions.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/extensions.hpp new file mode 100644 index 0000000000..b9d868e7a0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/extensions.hpp @@ -0,0 +1,182 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) +#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +namespace boost +{ + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + namespace hash_detail + { + template + struct call_hash_impl + { + template + struct inner + { + static std::size_t call(T const& v) + { + using namespace boost; + return hash_value(v); + } + }; + }; + + template <> + struct call_hash_impl + { + template + struct inner + { +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + static std::size_t call(Array const& v) +#else + static std::size_t call(Array& v) +#endif + { + const int size = sizeof(v) / sizeof(*v); + return boost::hash_range(v, v + size); + } + }; + }; + + template + struct call_hash + : public call_hash_impl::value> + ::BOOST_NESTED_TEMPLATE inner + { + }; + } +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + + template struct hash + : std::unary_function + { +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + std::size_t operator()(T const& val) const + { + return hash_value(val); + } +#else + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash::call(val); + } +#endif + }; + +#if BOOST_WORKAROUND(__DMC__, <= 0x848) + template struct hash + : std::unary_function + { + std::size_t operator()(const T* val) const + { + return boost::hash_range(val, val+n); + } + }; +#endif + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // On compilers without partial specialization, boost::hash + // has already been declared to deal with pointers, so just + // need to supply the non-pointer version. + + namespace hash_detail + { + template + struct hash_impl; + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + + template <> + struct hash_impl + { + template + struct inner + : std::unary_function + { +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + std::size_t operator()(T const& val) const + { + return hash_value(val); + } +#else + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash::call(val); + } +#endif + }; + }; + +#else // Visual C++ 6.5 + + // There's probably a more elegant way to Visual C++ 6.5 to work + // but I don't know what it is. + + template + struct hash_impl_msvc + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash::call(val); + } + + std::size_t operator()(T& val) const + { + return hash_detail::call_hash::call(val); + } + }; + }; + + template <> + struct hash_impl_msvc + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T& val) const + { + return hash_detail::call_hash::call(val); + } + }; + }; + + template + struct hash_impl_msvc2 + : public hash_impl_msvc::value> + ::BOOST_NESTED_TEMPLATE inner {}; + + template <> + struct hash_impl + { + template + struct inner : public hash_impl_msvc2 {}; + }; + +#endif // Visual C++ 6.5 + } +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +} + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/hash.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/hash.hpp new file mode 100644 index 0000000000..09ca5671e2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/hash.hpp @@ -0,0 +1,529 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) +#define BOOST_FUNCTIONAL_HASH_HASH_HPP + +#include +#include +#include +#include +#include + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#include +#endif + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +#include +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#include +#endif + +namespace boost +{ + std::size_t hash_value(bool); + std::size_t hash_value(char); + std::size_t hash_value(unsigned char); + std::size_t hash_value(signed char); + std::size_t hash_value(short); + std::size_t hash_value(unsigned short); + std::size_t hash_value(int); + std::size_t hash_value(unsigned int); + std::size_t hash_value(long); + std::size_t hash_value(unsigned long); + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + std::size_t hash_value(wchar_t); +#endif + +#if defined(BOOST_HAS_LONG_LONG) + std::size_t hash_value(boost::long_long_type); + std::size_t hash_value(boost::ulong_long_type); +#endif + +#if !BOOST_WORKAROUND(__DMC__, <= 0x848) + template std::size_t hash_value(T* const&); +#else + template std::size_t hash_value(T*); +#endif + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template< class T, unsigned N > + std::size_t hash_value(const T (&array)[N]); + + template< class T, unsigned N > + std::size_t hash_value(T (&array)[N]); +#endif + + std::size_t hash_value(float v); + std::size_t hash_value(double v); + std::size_t hash_value(long double v); + + template + std::size_t hash_value(std::basic_string, A> const&); + + template + std::size_t hash_value(std::pair const&); + template + std::size_t hash_value(std::vector const&); + template + std::size_t hash_value(std::list const& v); + template + std::size_t hash_value(std::deque const& v); + template + std::size_t hash_value(std::set const& v); + template + std::size_t hash_value(std::multiset const& v); + template + std::size_t hash_value(std::map const& v); + template + std::size_t hash_value(std::multimap const& v); + + template + std::size_t hash_value(std::complex const&); + + // Implementation + + namespace hash_detail + { + template + inline std::size_t hash_value_signed(T val) + { + const int size_t_bits = std::numeric_limits::digits; + // ceiling(std::numeric_limits::digits / size_t_bits) - 1 + const int length = (std::numeric_limits::digits - 1) + / size_t_bits; + + std::size_t seed = 0; + T positive = val < 0 ? -1 - val : val; + + // Hopefully, this loop can be unrolled. + for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) + { + seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2); + } + seed ^= (std::size_t) val + (seed<<6) + (seed>>2); + + return seed; + } + + template + inline std::size_t hash_value_unsigned(T val) + { + const int size_t_bits = std::numeric_limits::digits; + // ceiling(std::numeric_limits::digits / size_t_bits) - 1 + const int length = (std::numeric_limits::digits - 1) + / size_t_bits; + + std::size_t seed = 0; + + // Hopefully, this loop can be unrolled. + for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) + { + seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2); + } + seed ^= (std::size_t) val + (seed<<6) + (seed>>2); + + return seed; + } + } + + inline std::size_t hash_value(bool v) + { + return static_cast(v); + } + + inline std::size_t hash_value(char v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned char v) + { + return static_cast(v); + } + + inline std::size_t hash_value(signed char v) + { + return static_cast(v); + } + + inline std::size_t hash_value(short v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned short v) + { + return static_cast(v); + } + + inline std::size_t hash_value(int v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned int v) + { + return static_cast(v); + } + + inline std::size_t hash_value(long v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned long v) + { + return static_cast(v); + } + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + inline std::size_t hash_value(wchar_t v) + { + return static_cast(v); + } +#endif + +#if defined(BOOST_HAS_LONG_LONG) + inline std::size_t hash_value(boost::long_long_type v) + { + return hash_detail::hash_value_signed(v); + } + + inline std::size_t hash_value(boost::ulong_long_type v) + { + return hash_detail::hash_value_unsigned(v); + } +#endif + + // Implementation by Alberto Barbati and Dave Harris. +#if !BOOST_WORKAROUND(__DMC__, <= 0x848) + template std::size_t hash_value(T* const& v) +#else + template std::size_t hash_value(T* v) +#endif + { + std::size_t x = static_cast( + reinterpret_cast(v)); + + return x + (x >> 3); + } + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template + inline void hash_combine(std::size_t& seed, T& v) +#else + template + inline void hash_combine(std::size_t& seed, T const& v) +#endif + { + boost::hash hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + + template + inline std::size_t hash_range(It first, It last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + + return seed; + } + + template + inline void hash_range(std::size_t& seed, It first, It last) + { + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + } + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + template + inline std::size_t hash_range(T* first, T* last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + boost::hash hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + + return seed; + } + + template + inline void hash_range(std::size_t& seed, T* first, T* last) + { + for(; first != last; ++first) + { + boost::hash hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + } +#endif + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template< class T, unsigned N > + inline std::size_t hash_value(const T (&array)[N]) + { + return hash_range(array, array + N); + } + + template< class T, unsigned N > + inline std::size_t hash_value(T (&array)[N]) + { + return hash_range(array, array + N); + } +#endif + + template + inline std::size_t hash_value(std::basic_string, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + inline std::size_t hash_value(float v) + { + return boost::hash_detail::float_hash_value(v); + } + + inline std::size_t hash_value(double v) + { + return boost::hash_detail::float_hash_value(v); + } + + inline std::size_t hash_value(long double v) + { + return boost::hash_detail::float_hash_value(v); + } + + template + std::size_t hash_value(std::pair const& v) + { + std::size_t seed = 0; + hash_combine(seed, v.first); + hash_combine(seed, v.second); + return seed; + } + + template + std::size_t hash_value(std::vector const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::list const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::deque const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::set const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::multiset const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::map const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::multimap const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::complex const& v) + { + boost::hash hasher; + std::size_t seed = hasher(v.imag()); + seed ^= hasher(v.real()) + (seed<<6) + (seed>>2); + return seed; + } + + // + // boost::hash + // + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#define BOOST_HASH_SPECIALIZE(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; +#else +#define BOOST_HASH_SPECIALIZE(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(const type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; +#endif + + BOOST_HASH_SPECIALIZE(bool) + BOOST_HASH_SPECIALIZE(char) + BOOST_HASH_SPECIALIZE(signed char) + BOOST_HASH_SPECIALIZE(unsigned char) +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + BOOST_HASH_SPECIALIZE(wchar_t) +#endif + BOOST_HASH_SPECIALIZE(short) + BOOST_HASH_SPECIALIZE(unsigned short) + BOOST_HASH_SPECIALIZE(int) + BOOST_HASH_SPECIALIZE(unsigned int) + BOOST_HASH_SPECIALIZE(long) + BOOST_HASH_SPECIALIZE(unsigned long) + + BOOST_HASH_SPECIALIZE(float) + BOOST_HASH_SPECIALIZE(double) + BOOST_HASH_SPECIALIZE(long double) + + BOOST_HASH_SPECIALIZE_REF(std::string) +#if !defined(BOOST_NO_STD_WSTRING) + BOOST_HASH_SPECIALIZE_REF(std::wstring) +#endif + +#undef BOOST_HASH_SPECIALIZE +#undef BOOST_HASH_SPECIALIZE_REF + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + template + struct hash + : public std::unary_function + { + std::size_t operator()(T* v) const + { +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) + return boost::hash_value(v); +#else + std::size_t x = static_cast( + reinterpret_cast(v)); + + return x + (x >> 3); +#endif + } + }; +#else + namespace hash_detail + { + template + struct hash_impl; + + template <> + struct hash_impl + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T val) const + { +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590) + return boost::hash_value(val); +#else + std::size_t x = static_cast( + reinterpret_cast(val)); + + return x + (x >> 3); +#endif + } + }; + }; + } + + template struct hash + : public boost::hash_detail::hash_impl::value> + ::BOOST_NESTED_TEMPLATE inner + { + }; +#endif +} + +#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP + +// Include this outside of the include guards in case the file is included +// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it +// undefined. + +#if !defined(BOOST_HASH_NO_EXTENSIONS) \ + && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) +#include +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/list.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/list.hpp new file mode 100644 index 0000000000..201f6d03f0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/list.hpp @@ -0,0 +1,27 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_LIST_HPP) +#define BOOST_FUNCTIONAL_HASH_LIST_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(__EDG__) +#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +#pragma message("Warning: boost/functional/hash/list.hpp is deprecated, use boost/functional/hash.hpp instead.") +#elif defined(__GNUC__) || defined(__HP_aCC) || \ + defined(__SUNPRO_CC) || defined(__IBMCPP__) +#warning "boost/functional/hash/list.hpp is deprecated, use boost/functional/hash.hpp instead." +#endif + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/map.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/map.hpp new file mode 100644 index 0000000000..6713d85447 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/map.hpp @@ -0,0 +1,27 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_MAP_HPP) +#define BOOST_FUNCTIONAL_HASH_MAP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(__EDG__) +#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +#pragma message("Warning: boost/functional/hash/map.hpp is deprecated, use boost/functional/hash.hpp instead.") +#elif defined(__GNUC__) || defined(__HP_aCC) || \ + defined(__SUNPRO_CC) || defined(__IBMCPP__) +#warning "boost/functional/hash/map.hpp is deprecated, use boost/functional/hash.hpp instead." +#endif + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/pair.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/pair.hpp new file mode 100644 index 0000000000..bf076f1dfa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/pair.hpp @@ -0,0 +1,27 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_PAIR_HPP) +#define BOOST_FUNCTIONAL_HASH_PAIR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(__EDG__) +#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +#pragma message("Warning: boost/functional/hash/pair.hpp is deprecated, use boost/functional/hash.hpp instead.") +#elif defined(__GNUC__) || defined(__HP_aCC) || \ + defined(__SUNPRO_CC) || defined(__IBMCPP__) +#warning "boost/functional/hash/pair.hpp is deprecated, use boost/functional/hash.hpp instead." +#endif + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/set.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/set.hpp new file mode 100644 index 0000000000..0533e7635b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/set.hpp @@ -0,0 +1,27 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_SET_HPP) +#define BOOST_FUNCTIONAL_HASH_SET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(__EDG__) +#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +#pragma message("Warning: boost/functional/hash/set.hpp is deprecated, use boost/functional/hash.hpp instead.") +#elif defined(__GNUC__) || defined(__HP_aCC) || \ + defined(__SUNPRO_CC) || defined(__IBMCPP__) +#warning "boost/functional/hash/set.hpp is deprecated, use boost/functional/hash.hpp instead." +#endif + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/vector.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/vector.hpp new file mode 100644 index 0000000000..8bab799592 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash/vector.hpp @@ -0,0 +1,27 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_VECTOR_HPP) +#define BOOST_FUNCTIONAL_HASH_VECTOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(__EDG__) +#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +#pragma message("Warning: boost/functional/hash/vector.hpp is deprecated, use boost/functional/hash.hpp instead.") +#elif defined(__GNUC__) || defined(__HP_aCC) || \ + defined(__SUNPRO_CC) || defined(__IBMCPP__) +#warning "boost/functional/hash/vector.hpp is deprecated, use boost/functional/hash.hpp instead." +#endif + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/functional/hash_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash_fwd.hpp new file mode 100644 index 0000000000..8b7d8e5a41 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/functional/hash_fwd.hpp @@ -0,0 +1,40 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP) +#define BOOST_FUNCTIONAL_HASH_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + template struct hash; + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template void hash_combine(std::size_t& seed, T& v); +#else + template void hash_combine(std::size_t& seed, T const& v); +#endif + + template std::size_t hash_range(It, It); + template void hash_range(std::size_t&, It, It); + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + template inline std::size_t hash_range(T*, T*); + template inline void hash_range(std::size_t&, T*, T*); +#endif +} + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/generator_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/generator_iterator.hpp new file mode 100644 index 0000000000..ebf478b25b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/generator_iterator.hpp @@ -0,0 +1,80 @@ +// (C) Copyright Jens Maurer 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) +// +// Revision History: + +// 15 Nov 2001 Jens Maurer +// created. + +// See http://www.boost.org/libs/utility/iterator_adaptors.htm for documentation. + +#ifndef BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP +#define BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP + +#include +#include + +namespace boost { + +template +class generator_iterator + : public iterator_facade< + generator_iterator + , typename Generator::result_type + , single_pass_traversal_tag + , typename Generator::result_type const& + > +{ + typedef iterator_facade< + generator_iterator + , typename Generator::result_type + , single_pass_traversal_tag + , typename Generator::result_type const& + > super_t; + + public: + generator_iterator() {} + generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {} + + void increment() + { + m_value = (*m_g)(); + } + + const typename Generator::result_type& + dereference() const + { + return m_value; + } + + bool equal(generator_iterator const& y) const + { + return this->m_g == y.m_g && this->m_value == y.m_value; + } + + private: + Generator* m_g; + typename Generator::result_type m_value; +}; + +template +struct generator_iterator_generator +{ + typedef generator_iterator type; +}; + +template +inline generator_iterator +make_generator_iterator(Generator & gen) +{ + typedef generator_iterator result_t; + return result_t(&gen); +} + +} // namespace boost + + +#endif // BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/get_pointer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/get_pointer.hpp new file mode 100644 index 0000000000..17d11b8fef --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/get_pointer.hpp @@ -0,0 +1,29 @@ +// Copyright Peter Dimov and David Abrahams 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef GET_POINTER_DWA20021219_HPP +# define GET_POINTER_DWA20021219_HPP + +# include + +namespace boost { + +// get_pointer(p) extracts a ->* capable pointer from p + +template T * get_pointer(T * p) +{ + return p; +} + +// get_pointer(shared_ptr const & p) has been moved to shared_ptr.hpp + +template T * get_pointer(std::auto_ptr const& p) +{ + return p.get(); +} + + +} // namespace boost + +#endif // GET_POINTER_DWA20021219_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/adj_list_serialize.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/adj_list_serialize.hpp new file mode 100644 index 0000000000..de6ce5c367 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/adj_list_serialize.hpp @@ -0,0 +1,114 @@ +//======================================================================= +// Copyright 2005 Jeremy G. Siek +// Authors: Jeremy G. Siek +// +// 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 ADJ_LIST_SERIALIZE_HPP +#define ADJ_LIST_SERIALIZE_HPP + +#include +#include +#include +#include + +#include +#include +#include + +namespace boost { + +namespace serialization { + +// Turn off tracking for adjacency_list. It's not polymorphic, and we +// need to do this to enable saving of non-const adjacency lists. +template +struct tracking_level > { + typedef mpl::integral_c_tag tag; + typedef mpl::int_ type; + BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value); +}; + +template +inline void save( + Archive & ar, + const boost::adjacency_list &graph, + const unsigned int /* file_version */ +){ + typedef adjacency_list Graph; + typedef typename graph_traits::vertex_descriptor Vertex; + + int V = num_vertices(graph); + int E = num_edges(graph); + ar << BOOST_SERIALIZATION_NVP(V); + ar << BOOST_SERIALIZATION_NVP(E); + + // assign indices to vertices + std::map indices; + int num = 0; + typename graph_traits::vertex_iterator vi; + for (vi = vertices(graph).first; vi != vertices(graph).second; ++vi) { + indices[*vi] = num++; + ar << serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, *vi) ); + } + + // write edges + typename graph_traits::edge_iterator ei; + for (ei = edges(graph).first; ei != edges(graph).second; ++ei){ + ar << serialization::make_nvp("u" , indices[source(*ei,graph)]); + ar << serialization::make_nvp("v" , indices[target(*ei,graph)]); + ar << serialization::make_nvp("edge_property", get(edge_all_t(), graph, *ei) ); + } +} + + +template +inline void load( + Archive & ar, + boost::adjacency_list &graph, + const unsigned int /* file_version */ +){ + typedef adjacency_list Graph; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + + unsigned int V; + ar >> BOOST_SERIALIZATION_NVP(V); + unsigned int E; + ar >> BOOST_SERIALIZATION_NVP(E); + + std::vector verts(V); + int i = 0; + while(V-- > 0){ + Vertex v = add_vertex(graph); + verts[i++] = v; + ar >> serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, v) ); + } + while(E-- > 0){ + int u; int v; + ar >> BOOST_SERIALIZATION_NVP(u); + ar >> BOOST_SERIALIZATION_NVP(v); + Edge e; bool inserted; + tie(e,inserted) = add_edge(verts[u], verts[v], graph); + ar >> serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); + } +} + +template +inline void serialize( + Archive & ar, + boost::adjacency_list &graph, + const unsigned int file_version +){ + boost::serialization::split_free(ar, graph, file_version); +} + +}//serialization +}//boost + + +#endif // ADJ_LIST_SERIALIZE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_iterator.hpp new file mode 100644 index 0000000000..d500606443 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_iterator.hpp @@ -0,0 +1,102 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_ADJACENCY_ITERATOR_HPP +#define BOOST_ADJACENCY_ITERATOR_HPP + +#include +#include + +namespace boost +{ + + template + struct adjacency_iterator + : iterator_adaptor< + adjacency_iterator + , OutEdgeIter + , Vertex + , use_default + , Vertex + , Difference + > + { + typedef iterator_adaptor< + adjacency_iterator + , OutEdgeIter + , Vertex + , use_default + , Vertex + , Difference + > super_t; + + inline adjacency_iterator() {} + inline adjacency_iterator(OutEdgeIter const& i, const Graph* g) : super_t(i), m_g(g) { } + + inline Vertex + dereference() const + { return target(*this->base(), *m_g); } + + const Graph* m_g; + }; + + template ::vertex_descriptor, + class OutEdgeIter=typename graph_traits::out_edge_iterator> + class adjacency_iterator_generator + { + typedef typename boost::detail::iterator_traits + ::difference_type difference_type; + public: + typedef adjacency_iterator type; + }; + + template + struct inv_adjacency_iterator + : iterator_adaptor< + inv_adjacency_iterator + , InEdgeIter + , Vertex + , use_default + , Vertex + , Difference + > + { + typedef iterator_adaptor< + inv_adjacency_iterator + , InEdgeIter + , Vertex + , use_default + , Vertex + , Difference + > super_t; + + inline inv_adjacency_iterator() { } + inline inv_adjacency_iterator(InEdgeIter const& i, const Graph* g) : super_t(i), m_g(g) { } + + inline Vertex + dereference() const + { return source(*this->base(), *m_g); } + + const Graph* m_g; + }; + + template ::vertex_descriptor, + class InEdgeIter = typename graph_traits::in_edge_iterator> + class inv_adjacency_iterator_generator { + typedef typename boost::detail::iterator_traits + ::difference_type difference_type; + public: + typedef inv_adjacency_iterator type; + }; + +} // namespace boost + +#endif // BOOST_DETAIL_ADJACENCY_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_list.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_list.hpp new file mode 100644 index 0000000000..a60916a250 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_list.hpp @@ -0,0 +1,564 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_ADJACENCY_LIST_HPP +#define BOOST_GRAPH_ADJACENCY_LIST_HPP + + +#include + +#include +#include +#include + +#if !defined BOOST_NO_HASH +# ifdef BOOST_HASH_SET_HEADER +# include BOOST_HASH_SET_HEADER +# else +# include +# endif +#endif + +#if !defined BOOST_NO_SLIST +# ifdef BOOST_SLIST_HEADER +# include BOOST_SLIST_HEADER +# else +# include +# endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + //=========================================================================== + // Selectors for the VertexList and EdgeList template parameters of + // adjacency_list, and the container_gen traits class which is used + // to map the selectors to the container type used to implement the + // graph. + // + // The main container_gen traits class uses partial specialization, + // so we also include a workaround. + +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#if !defined BOOST_NO_SLIST + struct slistS {}; +#endif + + struct vecS { }; + struct listS { }; + struct setS { }; + struct multisetS { }; + struct mapS { }; +#if !defined BOOST_NO_HASH + struct hash_mapS { }; + struct hash_setS { }; +#endif + + template + struct container_gen { }; + + template + struct container_gen { + typedef std::list type; + }; +#if !defined BOOST_NO_SLIST + template + struct container_gen { + typedef BOOST_STD_EXTENSION_NAMESPACE::slist type; + }; +#endif + template + struct container_gen { + typedef std::vector type; + }; + + template + struct container_gen { + typedef std::set type; + }; + + template + struct container_gen { + typedef std::set type; + }; + + template + struct container_gen { + typedef std::multiset type; + }; + +#if !defined BOOST_NO_HASH + template + struct container_gen { + typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set type; + }; + + template + struct container_gen { + typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set type; + }; +#endif + +#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#if !defined BOOST_NO_SLIST + struct slistS { + template + struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::slist type; }; + }; +#endif + + struct vecS { + template + struct bind_ { typedef std::vector type; }; + }; + + struct listS { + template + struct bind_ { typedef std::list type; }; + }; + + struct setS { + template + struct bind_ { typedef std::set > type; }; + }; + + struct multisetS { + template + struct bind_ { typedef std::multiset > type; }; + }; + +#if !defined BOOST_NO_HASH + struct hash_setS { + template + struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set > type; }; + }; +#endif + + struct mapS { + template + struct bind_ { typedef std::set > type; }; + }; + +#if !defined BOOST_NO_HASH + struct hash_mapS { + template + struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set > type; }; + }; +#endif + + template struct container_selector { + typedef vecS type; + }; + +#define BOOST_CONTAINER_SELECTOR(NAME) \ + template <> struct container_selector { \ + typedef NAME type; \ + } + + BOOST_CONTAINER_SELECTOR(vecS); + BOOST_CONTAINER_SELECTOR(listS); + BOOST_CONTAINER_SELECTOR(mapS); + BOOST_CONTAINER_SELECTOR(setS); + BOOST_CONTAINER_SELECTOR(multisetS); +#if !defined BOOST_NO_HASH + BOOST_CONTAINER_SELECTOR(hash_mapS); +#endif +#if !defined BOOST_NO_SLIST + BOOST_CONTAINER_SELECTOR(slistS); +#endif + + template + struct container_gen { + typedef typename container_selector::type Select; + typedef typename Select:: template bind_::type type; + }; + +#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + template + struct parallel_edge_traits { }; + + template <> + struct parallel_edge_traits { + typedef allow_parallel_edge_tag type; }; + + template <> + struct parallel_edge_traits { + typedef allow_parallel_edge_tag type; }; + +#if !defined BOOST_NO_SLIST + template <> + struct parallel_edge_traits { + typedef allow_parallel_edge_tag type; }; +#endif + + template <> + struct parallel_edge_traits { + typedef disallow_parallel_edge_tag type; }; + + template <> + struct parallel_edge_traits { + typedef allow_parallel_edge_tag type; }; + +#if !defined BOOST_NO_HASH + template <> + struct parallel_edge_traits { + typedef disallow_parallel_edge_tag type; + }; +#endif + + // mapS is obsolete, replaced with setS + template <> + struct parallel_edge_traits { + typedef disallow_parallel_edge_tag type; }; + +#if !defined BOOST_NO_HASH + template <> + struct parallel_edge_traits { + typedef disallow_parallel_edge_tag type; + }; +#endif + + namespace detail { + template struct is_random_access { + enum { value = false}; + typedef mpl::false_ type; + }; + template <> + struct is_random_access { + enum { value = true }; + typedef mpl::true_ type; + }; + + } // namespace detail + + + + //=========================================================================== + // The adjacency_list_traits class, which provides a way to access + // some of the associated types of an adjacency_list type without + // having to first create the adjacency_list type. This is useful + // when trying to create interior vertex or edge properties who's + // value type is a vertex or edge descriptor. + + template + struct adjacency_list_traits + { + typedef typename detail::is_random_access::type + is_rand_access; + typedef typename DirectedS::is_bidir_t is_bidir; + typedef typename DirectedS::is_directed_t is_directed; + + typedef typename mpl::if_::type + >::type directed_category; + + typedef typename parallel_edge_traits::type + edge_parallel_category; + + typedef void* vertex_ptr; + typedef typename mpl::if_::type vertex_descriptor; + typedef detail::edge_desc_impl + edge_descriptor; + + typedef std::size_t vertices_size_type; + + private: + // Logic to figure out the edges_size_type + struct dummy {}; + typedef typename container_gen::type EdgeContainer; + typedef typename DirectedS::is_bidir_t BidirectionalT; + typedef typename DirectedS::is_directed_t DirectedT; + typedef typename mpl::and_::type >::type on_edge_storage; + public: + typedef typename mpl::if_::type edges_size_type; + + }; + +} // namespace boost + +#include + +namespace boost { + + //=========================================================================== + // The adjacency_list class. + // + + template + class adjacency_list + : public detail::adj_list_gen< + adjacency_list, + VertexListS, OutEdgeListS, DirectedS, +#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) + typename detail::retag_property_list::type, + typename detail::retag_property_list::type, +#else + VertexProperty, EdgeProperty, +#endif + GraphProperty, EdgeListS>::type + { +#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) + typedef typename detail::retag_property_list::retagged + maybe_vertex_bundled; + + typedef typename detail::retag_property_list::retagged + maybe_edge_bundled; +#endif + + public: +#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) + typedef typename detail::retag_property_list::type + vertex_property_type; + typedef typename detail::retag_property_list::type + edge_property_type; + + // The types that are actually bundled + typedef typename mpl::if_c<(is_same::value), + no_vertex_bundle, + maybe_vertex_bundled>::type vertex_bundled; + typedef typename mpl::if_c<(is_same::value), + no_edge_bundle, + maybe_edge_bundled>::type edge_bundled; +#else + typedef VertexProperty vertex_property_type; + typedef EdgeProperty edge_property_type; + typedef no_vertex_bundle vertex_bundled; + typedef no_edge_bundle edge_bundled; +#endif + + private: + typedef adjacency_list self; + typedef typename detail::adj_list_gen< + self, VertexListS, OutEdgeListS, DirectedS, + vertex_property_type, edge_property_type, GraphProperty, EdgeListS + >::type Base; + + public: + typedef typename Base::stored_vertex stored_vertex; + typedef typename Base::vertices_size_type vertices_size_type; + typedef typename Base::edges_size_type edges_size_type; + typedef typename Base::degree_size_type degree_size_type; + typedef typename Base::vertex_descriptor vertex_descriptor; + typedef typename Base::edge_descriptor edge_descriptor; + typedef OutEdgeListS out_edge_list_selector; + typedef VertexListS vertex_list_selector; + typedef DirectedS directed_selector; + typedef EdgeListS edge_list_selector; + + typedef GraphProperty graph_property_type; + + inline adjacency_list(const GraphProperty& p = GraphProperty()) + : m_property(p) { } + + inline adjacency_list(const adjacency_list& x) + : Base(x), m_property(x.m_property) { } + + inline adjacency_list& operator=(const adjacency_list& x) { + // TBD: probably should give the strong guarantee + if (&x != this) { + Base::operator=(x); + m_property = x.m_property; + } + return *this; + } + + // Required by Mutable Graph + inline adjacency_list(vertices_size_type num_vertices, + const GraphProperty& p = GraphProperty()) + : Base(num_vertices), m_property(p) { } + +#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 + // Required by Iterator Constructible Graph + template + inline adjacency_list(EdgeIterator first, EdgeIterator last, + vertices_size_type n, + edges_size_type = 0, + const GraphProperty& p = GraphProperty()) + : Base(n, first, last), m_property(p) { } + + template + inline adjacency_list(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, + edges_size_type = 0, + const GraphProperty& p = GraphProperty()) + : Base(n, first, last, ep_iter), m_property(p) { } +#endif + + void swap(adjacency_list& x) { + // Is there a more efficient way to do this? + adjacency_list tmp(x); + x = *this; + *this = tmp; + } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + // Directly access a vertex or edge bundle + vertex_bundled& operator[](vertex_descriptor v) + { return get(vertex_bundle, *this)[v]; } + + const vertex_bundled& operator[](vertex_descriptor v) const + { return get(vertex_bundle, *this)[v]; } + + edge_bundled& operator[](edge_descriptor e) + { return get(edge_bundle, *this)[e]; } + + const edge_bundled& operator[](edge_descriptor e) const + { return get(edge_bundle, *this)[e]; } +#endif + + // protected: (would be protected if friends were more portable) + GraphProperty m_property; + }; + + template + inline void + set_property(adjacency_list& g, Tag, + const Value& value) { + get_property_value(g.m_property, Tag()) = value;; + } + + template + inline + typename graph_property, Tag>::type& + get_property(adjacency_list& g, Tag) { + return get_property_value(g.m_property, Tag()); + } + + template + inline + const + typename graph_property, Tag>::type& + get_property(const adjacency_list& g, Tag) { + return get_property_value(g.m_property, Tag()); + } + + // dwa 09/25/00 - needed to be more explicit so reverse_graph would work. + template + inline Vertex + source(const detail::edge_base& e, + const adjacency_list&) + { + return e.m_source; + } + + template + inline Vertex + target(const detail::edge_base& e, + const adjacency_list&) + { + return e.m_target; + } + + // Support for bundled properties +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + inline + typename property_map, T Bundle::*>::type + get(T Bundle::* p, adjacency_list& g) + { + typedef typename property_map, T Bundle::*>::type + result_type; + return result_type(&g, p); + } + + template + inline + typename property_map, T Bundle::*>::const_type + get(T Bundle::* p, adjacency_list const & g) + { + typedef typename property_map, T Bundle::*>::const_type + result_type; + return result_type(&g, p); + } + + template + inline T + get(T Bundle::* p, adjacency_list const & g, const Key& key) + { + return get(get(p, g), key); + } + + template + inline void + put(T Bundle::* p, adjacency_list& g, const Key& key, const T& value) + { + put(get(p, g), key, value); + } + +#endif + + +} // namespace boost + + +#endif // BOOST_GRAPH_ADJACENCY_LIST_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_list_io.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_list_io.hpp new file mode 100644 index 0000000000..fb762fe016 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_list_io.hpp @@ -0,0 +1,408 @@ +//======================================================================= +// Copyright 2001 Universite Joseph Fourier, Grenoble. +// Author: François Faure +// +// 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_GRAPH_ADJACENCY_LIST_IO_HPP +#define BOOST_GRAPH_ADJACENCY_LIST_IO_HPP + +#include +#include +#include +#include + +// Method read to parse an adjacency list from an input stream. Examples: +// cin >> read( G ); +// cin >> read( G, NodePropertySubset(), EdgepropertySubset() ); +// +// Method write to print an adjacency list to an output stream. Examples: +// cout << write( G ); +// cout << write( G, NodePropertySubset(), EdgepropertySubset() ); + +namespace boost { + +/* outline + - basic property input + - get property subset + - graph parser + - property printer + - graph printer + - user methods +*/ + +//=========================================================================== +// basic property input + +template +std::istream& operator >> ( std::istream& in, property& p ) +{ + in >> p.m_value >> *(static_cast(&p)); // houpla !! + return in; +} + +template +std::istream& operator >> ( std::istream& in, property& p ) +{ + in >> p.m_value; + return in; +} + +inline std::istream& operator >> ( std::istream& in, no_property& ) +{ + return in; +} + +// basic property input +//=========================================================================== +// get property subsets + +// get a single property tagged Stag +template +void get +( property& p, const V& v, Stag s ) +{ + get( *(static_cast(&p)),v,s ); +} + +template +void get +( property& p, const V& v, Stag ) +{ + p.m_value = v; +} + +// get a subset of properties tagged Stag +template +void getSubset +( property& p, const property& s ) +{ + get( p, s.m_value, Stag() ); + getSubset( p, Snext(s) ); +} + +template +void getSubset +( property& p, const property& s) +{ + get( p, s.m_value, Stag() ); +} + +inline void getSubset +( no_property& p, const no_property& s ) +{ +} + +#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) +template +void getSubset(T& p, const U& s) +{ + p = s; +} + +template +void getSubset(T&, const no_property&) +{ +} + + +#endif + +// get property subset +//=========================================================================== +// graph parser +typedef enum{ PARSE_NUM_NODES, PARSE_VERTEX, PARSE_EDGE } GraphParserState; + +template +struct GraphParser +{ + + typedef Graph_t Graph; + + GraphParser( Graph* g ): graph(g) + {} + + GraphParser& operator () ( std::istream& in ) + { + typedef typename graph_traits::vertex_descriptor Vertex; + std::vector nodes; + + GraphParserState state = PARSE_VERTEX; + + unsigned int numLine = 1; + char c; + while ( in.get(c) ) + { + if( c== '#' ) skip(in); + else if( c== 'n' ) state = PARSE_NUM_NODES; + else if( c== 'v' ) state = PARSE_VERTEX; + else if( c== 'e' ) state = PARSE_EDGE; + else if( c== '\n' ) numLine++; + else if( !std::isspace(c) ){ + in.putback(c); + if( state == PARSE_VERTEX ){ + VertexPropertySubset readProp; + if( in >> readProp ) + { + VertexProperty vp; + getSubset( vp, readProp ); + nodes.push_back( add_vertex(vp, *graph) ); + } + else + std::cerr<<"read vertex, parse error at line"<> source >> target; + if( in >> readProp ) + { + EdgeProperty ep; + getSubset( ep, readProp ); + add_edge(nodes[source], nodes[target], ep, *graph); + } + else + std::cerr<<"read edge, parse error at line"<> n ){ + for( int i=0; i +struct PropertyPrinter +{ + typedef typename Property::value_type Value; + typedef typename Property::tag_type Tag; + typedef typename Property::next_type Next; + + PropertyPrinter( const Graph& g ):graph(&g){} + + template + PropertyPrinter& operator () ( std::ostream& out, Iterator it ) + { + typename property_map::type ps = get(Tag(), *graph); + out << ps[ *it ] <<" "; + PropertyPrinter print(*graph); + print(out, it); + return (*this); + } +private: + const Graph* graph; +}; +#else +template +struct PropertyPrinter +{ + PropertyPrinter( const Graph& g ):graph(&g){} + + template + PropertyPrinter& operator () ( std::ostream& out, Iterator it ) + { + out << (*graph)[ *it ] <<" "; + return (*this); + } +private: + const Graph* graph; +}; + +template +struct PropertyPrinter > +{ + PropertyPrinter( const Graph& g ):graph(&g){} + + template + PropertyPrinter& operator () ( std::ostream& out, Iterator it ) + { + typename property_map::type ps = get(Tag(), *graph); + out << ps[ *it ] <<" "; + PropertyPrinter print(*graph); + print(out, it); + return (*this); + } +private: + const Graph* graph; +}; +#endif + +template +struct PropertyPrinter +{ + PropertyPrinter( const Graph& ){} + + template + PropertyPrinter& operator () ( std::ostream&, Iterator it ){ return *this; } +}; + +// property printer +//========================================================================= +// graph printer + +template +struct EdgePrinter +{ + + typedef Graph_t Graph; + typedef typename graph_traits::vertex_descriptor Vertex; + + EdgePrinter( const Graph& g ) + : graph(g) + {} + + const EdgePrinter& operator () ( std::ostream& out ) const + { + // assign indices to vertices + std::map indices; + int num = 0; + typename graph_traits::vertex_iterator vi; + for (vi = vertices(graph).first; vi != vertices(graph).second; ++vi){ + indices[*vi] = num++; + } + + // write edges + PropertyPrinter print_Edge(graph); + out << "e" << std::endl; + typename graph_traits::edge_iterator ei; + for (ei = edges(graph).first; ei != edges(graph).second; ++ei){ + out << indices[source(*ei,graph)] << " " << indices[target(*ei,graph)] << " "; + print_Edge(out,ei); + out << std::endl; + } + out << std::endl; + return (*this); + } + +protected: + + const Graph& graph; + +}; + +template +struct GraphPrinter: public EdgePrinter +{ + GraphPrinter( const Graph& g ) + : EdgePrinter(g) + {} + + const GraphPrinter& operator () ( std::ostream& out ) const + { + PropertyPrinter printNode(this->graph); + out << "v"<::vertex_iterator vi; + for (vi = vertices(this->graph).first; vi != vertices(this->graph).second; ++vi){ + printNode(out,vi); + out << std::endl; + } + + EdgePrinter::operator ()( out ); + return (*this); + } +}; + +template +struct GraphPrinter + : public EdgePrinter +{ + GraphPrinter( const Graph& g ) + : EdgePrinter(g) + {} + + const GraphPrinter& operator () ( std::ostream& out ) const + { + out << "n "<< num_vertices(this->graph) << std::endl; + EdgePrinter::operator ()( out ); + return (*this); + } +}; + +// graph printer +//========================================================================= +// user methods + +/// input stream for reading a graph +template +std::istream& operator >> ( std::istream& in, GraphParser gp ) +{ + gp(in); + return in; +} + +/// graph parser for given subsets of internal vertex and edge properties +template +GraphParser,VP,EP,VPS,EPS> +read( adjacency_list& g, VPS vps, EPS eps ) +{ + return GraphParser,VP,EP,VPS,EPS>(&g); +} + +/// graph parser for all internal vertex and edge properties +template +GraphParser,VP,EP,VP,EP> +read( adjacency_list& g ) +{ + return GraphParser,VP,EP,VP,EP>(&g); +} + + +/// output stream for writing a graph +template +std::ostream& operator << ( std::ostream& out, const GraphPrinter& gp ) +{ + gp(out); + return out; +} + +/// write the graph with given property subsets +template +GraphPrinter,VPS,EPS> +write( const adjacency_list& g, VPS, EPS ) +{ + return GraphPrinter,VPS,EPS>(g); +} + +/// write the graph with all internal vertex and edge properties +template +GraphPrinter,VP,EP> +write( const adjacency_list& g ) +{ + return GraphPrinter,VP,EP>(g); +} + +// user methods +//========================================================================= +}// boost +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_matrix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_matrix.hpp new file mode 100644 index 0000000000..9770e51af7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/adjacency_matrix.hpp @@ -0,0 +1,1278 @@ +//======================================================================= +// Copyright 2001 University of Notre Dame. +// Copyright 2006 Trustees of Indiana University +// Authors: Jeremy G. Siek and Douglas Gregor +// +// 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_ADJACENCY_MATRIX_HPP +#define BOOST_ADJACENCY_MATRIX_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + namespace detail { + + template + class matrix_edge_desc_impl : public edge_desc_impl + { + typedef edge_desc_impl Base; + public: + matrix_edge_desc_impl() { } + matrix_edge_desc_impl(bool exists, Vertex s, Vertex d, + const void* ep = 0) + : Base(s, d, ep), m_exists(exists) { } + bool exists() const { return m_exists; } + private: + bool m_exists; + }; + + struct does_edge_exist { + template + bool operator()(const Edge& e) const { return e.exists(); } + }; + + template + bool get_edge_exists(const std::pair& stored_edge, int) { + return stored_edge.first; + } + template + void set_edge_exists( + std::pair& stored_edge, + bool flag, + int + ) { + stored_edge.first = flag; + } + + template + bool get_edge_exists(const EdgeProxy& edge_proxy, ...) { + return edge_proxy; + } + template + EdgeProxy& set_edge_exists(EdgeProxy& edge_proxy, bool flag, ...) { + edge_proxy = flag; + return edge_proxy; // just to avoid never used warning + } + + + + template + const EdgeProperty& + get_property(const std::pair& stored_edge) { + return stored_edge.second; + } + template + EdgeProperty& + get_property(std::pair& stored_edge) { + return stored_edge.second; + } + + template + inline void + set_property(std::pair& stored_edge, + const EdgeProperty& ep, int) { + stored_edge.second = ep; + } + + inline const no_property& get_property(const char&) { + static no_property s_prop; + return s_prop; + } + inline no_property& get_property(char&) { + static no_property s_prop; + return s_prop; + } + template + inline void + set_property(EdgeProxy, const EdgeProperty&, ...) {} + + //======================================================================= + // Directed Out Edge Iterator + + template < + typename VertexDescriptor, typename MatrixIter + , typename VerticesSizeType, typename EdgeDescriptor + > + struct dir_adj_matrix_out_edge_iter + : iterator_adaptor< + dir_adj_matrix_out_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > + { + typedef iterator_adaptor< + dir_adj_matrix_out_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > super_t; + + dir_adj_matrix_out_edge_iter() { } + + dir_adj_matrix_out_edge_iter( + const MatrixIter& i + , const VertexDescriptor& src + , const VerticesSizeType& n + ) + : super_t(i), m_src(src), m_targ(0), m_n(n) + { } + + void increment() { + ++this->base_reference(); + ++m_targ; + } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, + &get_property(*this->base())); + } + VertexDescriptor m_src, m_targ; + VerticesSizeType m_n; + }; + + //======================================================================= + // Directed In Edge Iterator + + template < + typename VertexDescriptor, typename MatrixIter + , typename VerticesSizeType, typename EdgeDescriptor + > + struct dir_adj_matrix_in_edge_iter + : iterator_adaptor< + dir_adj_matrix_in_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > + { + typedef iterator_adaptor< + dir_adj_matrix_in_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > super_t; + + dir_adj_matrix_in_edge_iter() { } + + dir_adj_matrix_in_edge_iter( + const MatrixIter& i + , const MatrixIter& last + , const VertexDescriptor& tgt + , const VerticesSizeType& n + ) + : super_t(i), m_last(last), m_src(0), m_targ(tgt), m_n(n) + { } + + void increment() { + if (VerticesSizeType(m_last - this->base_reference()) >= m_n) { + this->base_reference() += m_n; + ++m_src; + } else { + this->base_reference() = m_last; + } + } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, + &get_property(*this->base())); + } + MatrixIter m_last; + VertexDescriptor m_src, m_targ; + VerticesSizeType m_n; + }; + + //======================================================================= + // Undirected Out Edge Iterator + + template < + typename VertexDescriptor, typename MatrixIter + , typename VerticesSizeType, typename EdgeDescriptor + > + struct undir_adj_matrix_out_edge_iter + : iterator_adaptor< + undir_adj_matrix_out_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > + { + typedef iterator_adaptor< + undir_adj_matrix_out_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > super_t; + + undir_adj_matrix_out_edge_iter() { } + + undir_adj_matrix_out_edge_iter( + const MatrixIter& i + , const VertexDescriptor& src + , const VerticesSizeType& n + ) + : super_t(i), m_src(src), m_inc(src), m_targ(0), m_n(n) + {} + + void increment() + { + if (m_targ < m_src) // first half + { + ++this->base_reference(); + } + else if (m_targ < m_n - 1) + { // second half + ++m_inc; + this->base_reference() += m_inc; + } + else + { // past-the-end + this->base_reference() += m_n - m_src; + } + ++m_targ; + } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor( + get_edge_exists(*this->base(), 0), m_src, m_targ + , &get_property(*this->base()) + ); + } + + VertexDescriptor m_src, m_inc, m_targ; + VerticesSizeType m_n; + }; + + //======================================================================= + // Undirected In Edge Iterator + + template < + typename VertexDescriptor, typename MatrixIter + , typename VerticesSizeType, typename EdgeDescriptor + > + struct undir_adj_matrix_in_edge_iter + : iterator_adaptor< + undir_adj_matrix_in_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > + { + typedef iterator_adaptor< + undir_adj_matrix_in_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > super_t; + + undir_adj_matrix_in_edge_iter() { } + + undir_adj_matrix_in_edge_iter( + const MatrixIter& i + , const VertexDescriptor& src + , const VerticesSizeType& n + ) + : super_t(i), m_src(src), m_inc(src), m_targ(0), m_n(n) + {} + + void increment() + { + if (m_targ < m_src) // first half + { + ++this->base_reference(); + } + else if (m_targ < m_n - 1) + { // second half + ++m_inc; + this->base_reference() += m_inc; + } + else + { // past-the-end + this->base_reference() += m_n - m_src; + } + ++m_targ; + } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor( + get_edge_exists(*this->base(), 0), m_targ, m_src + , &get_property(*this->base()) + ); + } + + VertexDescriptor m_src, m_inc, m_targ; + VerticesSizeType m_n; + }; + + //======================================================================= + // Edge Iterator + + template + struct adj_matrix_edge_iter + : iterator_adaptor< + adj_matrix_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > + { + typedef iterator_adaptor< + adj_matrix_edge_iter + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > super_t; + + adj_matrix_edge_iter() { } + + adj_matrix_edge_iter(const MatrixIter& i, const MatrixIter& start, const VerticesSizeType& n) + : super_t(i), m_start(start), m_src(0), m_targ(0), m_n(n) { } + + void increment() + { + increment_dispatch(this->base_reference(), Directed()); + } + + void increment_dispatch(MatrixIter& i, directedS) + { + ++i; + if (m_targ == m_n - 1) + { + m_targ = 0; + ++m_src; + } + else + { + ++m_targ; + } + } + + void increment_dispatch(MatrixIter& i, undirectedS) + { + ++i; + if (m_targ == m_src) + { + m_targ = 0; + ++m_src; + } + else + { + ++m_targ; + } + } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor( + get_edge_exists( + *this->base(), 0), m_src, m_targ, &get_property(*this->base()) + ); + } + + MatrixIter m_start; + VerticesSizeType m_src, m_targ, m_n; + }; + + } // namespace detail + + //========================================================================= + // Adjacency Matrix Traits + template + class adjacency_matrix_traits { + typedef typename Directed::is_directed_t is_directed; + public: + // The bidirectionalS tag is not allowed with the adjacency_matrix + // graph type. Instead, use directedS, which also provides the + // functionality required for a Bidirectional Graph (in_edges, + // in_degree, etc.). +#if !defined(_MSC_VER) || _MSC_VER > 1300 + BOOST_STATIC_ASSERT(type_traits::ice_not<(is_same::value)>::value); +#endif + + typedef typename mpl::if_::type + directed_category; + + typedef disallow_parallel_edge_tag edge_parallel_category; + + typedef std::size_t vertex_descriptor; + + typedef detail::matrix_edge_desc_impl edge_descriptor; + }; + + struct adjacency_matrix_class_tag { }; + + struct adj_matrix_traversal_tag : + public virtual adjacency_matrix_tag, + public virtual vertex_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual edge_list_graph_tag { }; + + //========================================================================= + // Adjacency Matrix Class + template > + class adjacency_matrix { + typedef adjacency_matrix self; + typedef adjacency_matrix_traits Traits; + + public: +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 + // The bidirectionalS tag is not allowed with the adjacency_matrix + // graph type. Instead, use directedS, which also provides the + // functionality required for a Bidirectional Graph (in_edges, + // in_degree, etc.). + BOOST_STATIC_ASSERT(!(is_same::value)); +#endif + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + typedef typename detail::retag_property_list::type + vertex_property_type; + typedef typename detail::retag_property_list::type + edge_property_type; + + private: + typedef typename detail::retag_property_list::retagged + maybe_vertex_bundled; + + typedef typename detail::retag_property_list::retagged + maybe_edge_bundled; + + public: + // The types that are actually bundled + typedef typename mpl::if_c<(is_same::value), + no_vertex_bundle, + maybe_vertex_bundled>::type vertex_bundled; + typedef typename mpl::if_c<(is_same::value), + no_edge_bundle, + maybe_edge_bundled>::type edge_bundled; +#else + typedef EdgeProperty edge_property_type; + typedef VertexProperty vertex_property_type; + typedef no_vertex_bundle vertex_bundled; + typedef no_edge_bundle edge_bundled; +#endif + + public: // should be private + typedef typename mpl::if_::type, + std::pair, char>::type StoredEdge; +#if (defined(BOOST_MSVC) && BOOST_MSVC <= 1300) || defined(BOOST_NO_STD_ALLOCATOR) + typedef std::vector Matrix; +#else + // This causes internal compiler error for MSVC + typedef typename Allocator::template rebind::other Alloc; + typedef std::vector Matrix; +#endif + typedef typename Matrix::iterator MatrixIter; + typedef typename Matrix::size_type size_type; + public: + // Graph concept required types + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::edge_descriptor edge_descriptor; + typedef typename Traits::directed_category directed_category; + typedef typename Traits::edge_parallel_category edge_parallel_category; + typedef adj_matrix_traversal_tag traversal_category; + + static vertex_descriptor null_vertex() + { + return (std::numeric_limits::max)(); + } + + //private: if friends worked, these would be private + + typedef detail::dir_adj_matrix_out_edge_iter< + vertex_descriptor, MatrixIter, size_type, edge_descriptor + > DirOutEdgeIter; + + typedef detail::undir_adj_matrix_out_edge_iter< + vertex_descriptor, MatrixIter, size_type, edge_descriptor + > UnDirOutEdgeIter; + + typedef typename mpl::if_< + typename Directed::is_directed_t, DirOutEdgeIter, UnDirOutEdgeIter + >::type unfiltered_out_edge_iter; + + typedef detail::dir_adj_matrix_in_edge_iter< + vertex_descriptor, MatrixIter, size_type, edge_descriptor + > DirInEdgeIter; + + typedef detail::undir_adj_matrix_in_edge_iter< + vertex_descriptor, MatrixIter, size_type, edge_descriptor + > UnDirInEdgeIter; + + typedef typename mpl::if_< + typename Directed::is_directed_t, DirInEdgeIter, UnDirInEdgeIter + >::type unfiltered_in_edge_iter; + + typedef detail::adj_matrix_edge_iter< + Directed, MatrixIter, size_type, edge_descriptor + > unfiltered_edge_iter; + + public: + + // IncidenceGraph concept required types + typedef filter_iterator + out_edge_iterator; + + typedef size_type degree_size_type; + + // BidirectionalGraph required types + typedef filter_iterator + in_edge_iterator; + + // AdjacencyGraph required types + typedef typename adjacency_iterator_generator::type adjacency_iterator; + + // VertexListGraph required types + typedef size_type vertices_size_type; + typedef integer_range VertexList; + typedef typename VertexList::iterator vertex_iterator; + + // EdgeListGraph required types + typedef size_type edges_size_type; + typedef filter_iterator< + detail::does_edge_exist, unfiltered_edge_iter + > edge_iterator; + + // PropertyGraph required types + typedef adjacency_matrix_class_tag graph_tag; + + // Constructor required by MutableGraph + adjacency_matrix(vertices_size_type n_vertices) + : m_matrix(Directed::is_directed ? + (n_vertices * n_vertices) + : (n_vertices * (n_vertices + 1) / 2)), + m_vertex_set(0, n_vertices), + m_vertex_properties(n_vertices), + m_num_edges(0) { } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + // Directly access a vertex or edge bundle + vertex_bundled& operator[](vertex_descriptor v) + { return get(vertex_bundle, *this)[v]; } + + const vertex_bundled& operator[](vertex_descriptor v) const + { return get(vertex_bundle, *this)[v]; } + + edge_bundled& operator[](edge_descriptor e) + { return get(edge_bundle, *this)[e]; } + + const edge_bundled& operator[](edge_descriptor e) const + { return get(edge_bundle, *this)[e]; } +#endif + + //private: if friends worked, these would be private + + typename Matrix::const_reference + get_edge(vertex_descriptor u, vertex_descriptor v) const { + if (Directed::is_directed) + return m_matrix[u * m_vertex_set.size() + v]; + else { + if (v > u) + std::swap(u, v); + return m_matrix[u * (u + 1)/2 + v]; + } + } + typename Matrix::reference + get_edge(vertex_descriptor u, vertex_descriptor v) { + if (Directed::is_directed) + return m_matrix[u * m_vertex_set.size() + v]; + else { + if (v > u) + std::swap(u, v); + return m_matrix[u * (u + 1)/2 + v]; + } + } + + Matrix m_matrix; + VertexList m_vertex_set; + std::vector m_vertex_properties; + size_type m_num_edges; + }; + + //========================================================================= + // Functions required by the AdjacencyMatrix concept + + template + std::pair::edge_descriptor, + bool> + edge(typename adjacency_matrix::vertex_descriptor u, + typename adjacency_matrix::vertex_descriptor v, + const adjacency_matrix& g) + { + bool exists = detail::get_edge_exists(g.get_edge(u,v), 0); + typename adjacency_matrix::edge_descriptor + e(exists, u, v, &detail::get_property(g.get_edge(u,v))); + return std::make_pair(e, exists); + } + + //========================================================================= + // Functions required by the IncidenceGraph concept + + // O(1) + template + std::pair::out_edge_iterator, + typename adjacency_matrix::out_edge_iterator> + out_edges + (typename adjacency_matrix::vertex_descriptor u, + const adjacency_matrix& g_) + { + typedef adjacency_matrix Graph; + Graph& g = const_cast(g_); + typename Graph::vertices_size_type offset = u * g.m_vertex_set.size(); + typename Graph::MatrixIter f = g.m_matrix.begin() + offset; + typename Graph::MatrixIter l = f + g.m_vertex_set.size(); + typename Graph::unfiltered_out_edge_iter + first(f, u, g.m_vertex_set.size()) + , last(l, u, g.m_vertex_set.size()); + detail::does_edge_exist pred; + typedef typename Graph::out_edge_iterator out_edge_iterator; + return std::make_pair(out_edge_iterator(pred, first, last), + out_edge_iterator(pred, last, last)); + } + + // O(1) + template + std::pair< + typename adjacency_matrix::out_edge_iterator, + typename adjacency_matrix::out_edge_iterator> + out_edges + (typename adjacency_matrix::vertex_descriptor u, + const adjacency_matrix& g_) + { + typedef adjacency_matrix Graph; + Graph& g = const_cast(g_); + typename Graph::vertices_size_type offset = u * (u + 1) / 2; + typename Graph::MatrixIter f = g.m_matrix.begin() + offset; + typename Graph::MatrixIter l = g.m_matrix.end(); + + typename Graph::unfiltered_out_edge_iter + first(f, u, g.m_vertex_set.size()) + , last(l, u, g.m_vertex_set.size()); + + detail::does_edge_exist pred; + typedef typename Graph::out_edge_iterator out_edge_iterator; + return std::make_pair(out_edge_iterator(pred, first, last), + out_edge_iterator(pred, last, last)); + } + + // O(N) + template + typename adjacency_matrix::degree_size_type + out_degree(typename adjacency_matrix::vertex_descriptor u, + const adjacency_matrix& g) + { + typename adjacency_matrix::degree_size_type n = 0; + typename adjacency_matrix::out_edge_iterator f, l; + for (tie(f, l) = out_edges(u, g); f != l; ++f) + ++n; + return n; + } + + // O(1) + template + typename adjacency_matrix::vertex_descriptor + source(const detail::matrix_edge_desc_impl& e, + const adjacency_matrix&) + { + return e.m_source; + } + + // O(1) + template + typename adjacency_matrix::vertex_descriptor + target(const detail::matrix_edge_desc_impl& e, + const adjacency_matrix&) + { + return e.m_target; + } + + //========================================================================= + // Functions required by the BidirectionalGraph concept + + // O(1) + template + std::pair::in_edge_iterator, + typename adjacency_matrix::in_edge_iterator> + in_edges + (typename adjacency_matrix::vertex_descriptor u, + const adjacency_matrix& g_) + { + typedef adjacency_matrix Graph; + Graph& g = const_cast(g_); + typename Graph::MatrixIter f = g.m_matrix.begin() + u; + typename Graph::MatrixIter l = g.m_matrix.end(); + typename Graph::unfiltered_in_edge_iter + first(f, l, u, g.m_vertex_set.size()) + , last(l, l, u, g.m_vertex_set.size()); + detail::does_edge_exist pred; + typedef typename Graph::in_edge_iterator in_edge_iterator; + return std::make_pair(in_edge_iterator(pred, first, last), + in_edge_iterator(pred, last, last)); + } + + // O(1) + template + std::pair< + typename adjacency_matrix::in_edge_iterator, + typename adjacency_matrix::in_edge_iterator> + in_edges + (typename adjacency_matrix::vertex_descriptor u, + const adjacency_matrix& g_) + { + typedef adjacency_matrix Graph; + Graph& g = const_cast(g_); + typename Graph::vertices_size_type offset = u * (u + 1) / 2; + typename Graph::MatrixIter f = g.m_matrix.begin() + offset; + typename Graph::MatrixIter l = g.m_matrix.end(); + + typename Graph::unfiltered_in_edge_iter + first(f, u, g.m_vertex_set.size()) + , last(l, u, g.m_vertex_set.size()); + + detail::does_edge_exist pred; + typedef typename Graph::in_edge_iterator in_edge_iterator; + return std::make_pair(in_edge_iterator(pred, first, last), + in_edge_iterator(pred, last, last)); + } + + // O(N) + template + typename adjacency_matrix::degree_size_type + in_degree(typename adjacency_matrix::vertex_descriptor u, + const adjacency_matrix& g) + { + typename adjacency_matrix::degree_size_type n = 0; + typename adjacency_matrix::in_edge_iterator f, l; + for (tie(f, l) = in_edges(u, g); f != l; ++f) + ++n; + return n; + } + + //========================================================================= + // Functions required by the AdjacencyGraph concept + + template + std::pair::adjacency_iterator, + typename adjacency_matrix::adjacency_iterator> + adjacent_vertices + (typename adjacency_matrix::vertex_descriptor u, + const adjacency_matrix& g_) + { + typedef adjacency_matrix Graph; + const Graph& cg = static_cast(g_); + Graph& g = const_cast(cg); + typedef typename Graph::adjacency_iterator adjacency_iterator; + typename Graph::out_edge_iterator first, last; + boost::tie(first, last) = out_edges(u, g); + return std::make_pair(adjacency_iterator(first, &g), + adjacency_iterator(last, &g)); + } + + //========================================================================= + // Functions required by the VertexListGraph concept + + template + std::pair::vertex_iterator, + typename adjacency_matrix::vertex_iterator> + vertices(const adjacency_matrix& g_) { + typedef adjacency_matrix Graph; + Graph& g = const_cast(g_); + return std::make_pair(g.m_vertex_set.begin(), g.m_vertex_set.end()); + } + + template + typename adjacency_matrix::vertices_size_type + num_vertices(const adjacency_matrix& g) { + return g.m_vertex_set.size(); + } + + //========================================================================= + // Functions required by the EdgeListGraph concept + + template + std::pair::edge_iterator, + typename adjacency_matrix::edge_iterator> + edges(const adjacency_matrix& g_) + { + typedef adjacency_matrix Graph; + Graph& g = const_cast(g_); + + typename Graph::unfiltered_edge_iter + first(g.m_matrix.begin(), g.m_matrix.begin(), + g.m_vertex_set.size()), + last(g.m_matrix.end(), g.m_matrix.begin(), + g.m_vertex_set.size()); + detail::does_edge_exist pred; + typedef typename Graph::edge_iterator edge_iterator; + return std::make_pair(edge_iterator(pred, first, last), + edge_iterator(pred, last, last)); + } + + // O(1) + template + typename adjacency_matrix::edges_size_type + num_edges(const adjacency_matrix& g) + { + return g.m_num_edges; + } + + //========================================================================= + // Functions required by the MutableGraph concept + + // O(1) + template + std::pair::edge_descriptor, bool> + add_edge(typename adjacency_matrix::vertex_descriptor u, + typename adjacency_matrix::vertex_descriptor v, + const EP& ep, + adjacency_matrix& g) + { + typedef typename adjacency_matrix::edge_descriptor + edge_descriptor; + if (detail::get_edge_exists(g.get_edge(u,v), 0) == false) { + ++(g.m_num_edges); + detail::set_property(g.get_edge(u,v), ep, 0); + detail::set_edge_exists(g.get_edge(u,v), true, 0); + return std::make_pair + (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), + true); + } else + return std::make_pair + (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), + false); + } + // O(1) + template + std::pair::edge_descriptor, bool> + add_edge(typename adjacency_matrix::vertex_descriptor u, + typename adjacency_matrix::vertex_descriptor v, + adjacency_matrix& g) + { + EP ep; + return add_edge(u, v, ep, g); + } + + // O(1) + template + void + remove_edge(typename adjacency_matrix::vertex_descriptor u, + typename adjacency_matrix::vertex_descriptor v, + adjacency_matrix& g) + { + --(g.m_num_edges); + detail::set_edge_exists(g.get_edge(u,v), false, 0); + } + + // O(1) + template + void + remove_edge(typename adjacency_matrix::edge_descriptor e, + adjacency_matrix& g) + { + remove_edge(source(e, g), target(e, g), g); + } + + + template + inline typename adjacency_matrix::vertex_descriptor + add_vertex(adjacency_matrix& g) { + // UNDER CONSTRUCTION + assert(false); + return *vertices(g).first; + } + + template + inline typename adjacency_matrix::vertex_descriptor + add_vertex(const VP& vp, adjacency_matrix& g) { + // UNDER CONSTRUCTION + assert(false); + return *vertices(g).first; + } + + template + inline void + remove_vertex(typename adjacency_matrix::vertex_descriptor u, + adjacency_matrix& g) + { + // UNDER CONSTRUCTION + assert(false); + } + + // O(V) + template + void + clear_vertex + (typename adjacency_matrix::vertex_descriptor u, + adjacency_matrix& g) + { + typename adjacency_matrix::vertex_iterator + vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + remove_edge(u, *vi, g); + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + remove_edge(*vi, u, g); + } + + // O(V) + template + void + clear_vertex + (typename adjacency_matrix::vertex_descriptor u, + adjacency_matrix& g) + { + typename adjacency_matrix::vertex_iterator + vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + remove_edge(u, *vi, g); + } + + //========================================================================= + // Vertex Property Map + + template + class adj_matrix_vertex_property_map + : public put_get_helper > + { + public: + typedef T value_type; + typedef R reference; + typedef Vertex key_type; + typedef boost::lvalue_property_map_tag category; + adj_matrix_vertex_property_map() { } + adj_matrix_vertex_property_map(GraphPtr g) : m_g(g) { } + inline reference operator[](key_type v) const { + return get_property_value(m_g->m_vertex_properties[v], Tag()); + } + GraphPtr m_g; + }; + + template + struct adj_matrix_vertex_id_map + : public boost::put_get_helper > + { + typedef Vertex value_type; + typedef Vertex reference; + typedef Vertex key_type; + typedef boost::readable_property_map_tag category; + adj_matrix_vertex_id_map() { } + template + inline adj_matrix_vertex_id_map(const Graph&) { } + inline value_type operator[](key_type v) const { return v; } + }; + + namespace detail { + + struct adj_matrix_any_vertex_pa { + template + struct bind_ { + typedef typename property_value::type Value; + typedef typename boost::graph_traits::vertex_descriptor Vertex; + + typedef adj_matrix_vertex_property_map type; + typedef adj_matrix_vertex_property_map const_type; + }; + }; + struct adj_matrix_id_vertex_pa { + template + struct bind_ { + typedef typename Graph::vertex_descriptor Vertex; + typedef adj_matrix_vertex_id_map type; + typedef adj_matrix_vertex_id_map const_type; + }; + }; + + template + struct adj_matrix_choose_vertex_pa_helper { + typedef adj_matrix_any_vertex_pa type; + }; + template <> + struct adj_matrix_choose_vertex_pa_helper { + typedef adj_matrix_id_vertex_pa type; + }; + + template + struct adj_matrix_choose_vertex_pa { + typedef typename adj_matrix_choose_vertex_pa_helper::type Helper; + typedef typename Helper::template bind_ Bind; + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; + }; + + struct adj_matrix_vertex_property_selector { + template + struct bind_ { + typedef adj_matrix_choose_vertex_pa Choice; + typedef typename Choice::type type; + typedef typename Choice::const_type const_type; + }; + }; + + } // namespace detail + + template <> + struct vertex_property_selector { + typedef detail::adj_matrix_vertex_property_selector type; + }; + + //========================================================================= + // Edge Property Map + + + template + class adj_matrix_edge_property_map + : public put_get_helper > + { + public: + typedef T value_type; + typedef R reference; + typedef detail::matrix_edge_desc_impl key_type; + typedef boost::lvalue_property_map_tag category; + inline reference operator[](key_type e) const { + Property& p = *(Property*)e.get_property(); + return get_property_value(p, Tag()); + } + }; + struct adj_matrix_edge_property_selector { + template + struct bind_ { + typedef typename property_value::type T; + typedef typename Graph::vertex_descriptor Vertex; + typedef adj_matrix_edge_property_map type; + typedef adj_matrix_edge_property_map const_type; + }; + }; + template <> + struct edge_property_selector { + typedef adj_matrix_edge_property_selector type; + }; + + //========================================================================= + // Functions required by PropertyGraph + + namespace detail { + + template + typename boost::property_map, + Property>::type + get_dispatch(adjacency_matrix& g, Property, + vertex_property_tag) + { + typedef adjacency_matrix Graph; + typedef typename boost::property_map, + Property>::type PA; + return PA(&g); + } + template + typename boost::property_map, + Property>::type + get_dispatch(adjacency_matrix&, Property, + edge_property_tag) + { + typedef typename boost::property_map, + Property>::type PA; + return PA(); + } + template + typename boost::property_map, + Property>::const_type + get_dispatch(const adjacency_matrix& g, Property, + vertex_property_tag) + { + typedef adjacency_matrix Graph; + typedef typename boost::property_map, + Property>::const_type PA; + return PA(&g); + } + template + typename boost::property_map, + Property>::const_type + get_dispatch(const adjacency_matrix&, Property, + edge_property_tag) + { + typedef typename boost::property_map, + Property>::const_type PA; + return PA(); + } + + } // namespace detail + + template + inline + typename property_map, Property>::type + get(Property p, adjacency_matrix& g) + { + typedef typename property_kind::type Kind; + return detail::get_dispatch(g, p, Kind()); + } + + template + inline + typename property_map, Property>::const_type + get(Property p, const adjacency_matrix& g) + { + typedef typename property_kind::type Kind; + return detail::get_dispatch(g, p, Kind()); + } + + template + inline + typename property_traits< + typename property_map, Property>::const_type + >::value_type + get(Property p, const adjacency_matrix& g, + const Key& key) + { + return get(get(p, g), key); + } + + template + inline void + put(Property p, adjacency_matrix& g, + const Key& key, const Value& value) + { + typedef adjacency_matrix Graph; + typedef typename boost::property_map::type Map; + Map pmap = get(p, g); + put(pmap, key, value); + } + + //========================================================================= + // Other Functions + + template + typename adjacency_matrix::vertex_descriptor + vertex(typename adjacency_matrix::vertices_size_type n, + const adjacency_matrix& g) + { + return n; + } + + // Support for bundled properties +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + inline + typename property_map, + T Bundle::*>::type + get(T Bundle::* p, adjacency_matrix& g) + { + typedef typename property_map, + T Bundle::*>::type + result_type; + return result_type(&g, p); + } + + template + inline + typename property_map, + T Bundle::*>::const_type + get(T Bundle::* p, adjacency_matrix const & g) + { + typedef typename property_map, + T Bundle::*>::const_type + result_type; + return result_type(&g, p); + } + + template + inline T + get(T Bundle::* p, adjacency_matrix const & g, + const Key& key) + { + return get(get(p, g), key); + } + + template + inline void + put(T Bundle::* p, adjacency_matrix& g, + const Key& key, const T& value) + { + put(get(p, g), key, value); + } + +#endif + +} // namespace boost + +#endif // BOOST_ADJACENCY_MATRIX_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/astar_search.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/astar_search.hpp new file mode 100644 index 0000000000..e1b95c4aaa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/astar_search.hpp @@ -0,0 +1,407 @@ + + +// +//======================================================================= +// Copyright (c) 2004 Kristopher Beevers +// +// 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_GRAPH_ASTAR_SEARCH_HPP +#define BOOST_GRAPH_ASTAR_SEARCH_HPP + + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost { + + + template + struct AStarHeuristicConcept { + void constraints() + { + function_requires< CopyConstructibleConcept >(); + h(u); + } + Heuristic h; + typename graph_traits::vertex_descriptor u; + }; + + + template + class astar_heuristic : public std::unary_function< + typename graph_traits::vertex_descriptor, CostType> + { + public: + typedef typename graph_traits::vertex_descriptor Vertex; + astar_heuristic() {} + CostType operator()(Vertex u) { return static_cast(0); } + }; + + + + template + struct AStarVisitorConcept { + void constraints() + { + function_requires< CopyConstructibleConcept >(); + vis.initialize_vertex(u, g); + vis.discover_vertex(u, g); + vis.examine_vertex(u, g); + vis.examine_edge(e, g); + vis.edge_relaxed(e, g); + vis.edge_not_relaxed(e, g); + vis.black_target(e, g); + vis.finish_vertex(u, g); + } + Visitor vis; + Graph g; + typename graph_traits::vertex_descriptor u; + typename graph_traits::edge_descriptor e; + }; + + + template + class astar_visitor : public bfs_visitor { + public: + astar_visitor() {} + astar_visitor(Visitors vis) + : bfs_visitor(vis) {} + + template + void edge_relaxed(Edge e, Graph& g) { + invoke_visitors(this->m_vis, e, g, on_edge_relaxed()); + } + template + void edge_not_relaxed(Edge e, Graph& g) { + invoke_visitors(this->m_vis, e, g, on_edge_not_relaxed()); + } + private: + template + void tree_edge(Edge e, Graph& g) {} + template + void non_tree_edge(Edge e, Graph& g) {} + }; + template + astar_visitor + make_astar_visitor(Visitors vis) { + return astar_visitor(vis); + } + typedef astar_visitor<> default_astar_visitor; + + + namespace detail { + + template + struct astar_bfs_visitor + { + + typedef typename property_traits::value_type C; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typedef typename property_traits::value_type distance_type; + + astar_bfs_visitor(AStarHeuristic h, UniformCostVisitor vis, + UpdatableQueue& Q, PredecessorMap p, + CostMap c, DistanceMap d, WeightMap w, + ColorMap col, BinaryFunction combine, + BinaryPredicate compare, C zero) + : m_h(h), m_vis(vis), m_Q(Q), m_predecessor(p), m_cost(c), + m_distance(d), m_weight(w), m_color(col), + m_combine(combine), m_compare(compare), m_zero(zero) {} + + + template + void initialize_vertex(Vertex u, Graph& g) { + m_vis.initialize_vertex(u, g); + } + template + void discover_vertex(Vertex u, Graph& g) { + m_vis.discover_vertex(u, g); + } + template + void examine_vertex(Vertex u, Graph& g) { + m_vis.examine_vertex(u, g); + } + template + void finish_vertex(Vertex u, Graph& g) { + m_vis.finish_vertex(u, g); + } + template + void examine_edge(Edge e, Graph& g) { + if (m_compare(get(m_weight, e), m_zero)) + throw negative_edge(); + m_vis.examine_edge(e, g); + } + template + void non_tree_edge(Edge, Graph&) {} + + + + template + void tree_edge(Edge e, Graph& g) { + m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + + if(m_decreased) { + m_vis.edge_relaxed(e, g); + put(m_cost, target(e, g), + m_combine(get(m_distance, target(e, g)), + m_h(target(e, g)))); + } else + m_vis.edge_not_relaxed(e, g); + } + + + template + void gray_target(Edge e, Graph& g) { + distance_type old_distance = get(m_distance, target(e, g)); + + m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + + /* On x86 Linux with optimization, we sometimes get into a + horrible case where m_decreased is true but the distance hasn't + actually changed. This occurs when the comparison inside + relax() occurs with the 80-bit precision of the x87 floating + point unit, but the difference is lost when the resulting + values are written back to lower-precision memory (e.g., a + double). With the eager Dijkstra's implementation, this results + in looping. */ + if(m_decreased && old_distance != get(m_distance, target(e, g))) { + put(m_cost, target(e, g), + m_combine(get(m_distance, target(e, g)), + m_h(target(e, g)))); + m_Q.update(target(e, g)); + m_vis.edge_relaxed(e, g); + } else + m_vis.edge_not_relaxed(e, g); + } + + + template + void black_target(Edge e, Graph& g) { + distance_type old_distance = get(m_distance, target(e, g)); + + m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + + /* See comment in gray_target */ + if(m_decreased && old_distance != get(m_distance, target(e, g))) { + m_vis.edge_relaxed(e, g); + put(m_cost, target(e, g), + m_combine(get(m_distance, target(e, g)), + m_h(target(e, g)))); + m_Q.push(target(e, g)); + put(m_color, target(e, g), Color::gray()); + m_vis.black_target(e, g); + } else + m_vis.edge_not_relaxed(e, g); + } + + + + AStarHeuristic m_h; + UniformCostVisitor m_vis; + UpdatableQueue& m_Q; + PredecessorMap m_predecessor; + CostMap m_cost; + DistanceMap m_distance; + WeightMap m_weight; + ColorMap m_color; + BinaryFunction m_combine; + BinaryPredicate m_compare; + bool m_decreased; + C m_zero; + + }; + + } // namespace detail + + + + template + inline void + astar_search_no_init + (VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, AStarVisitor vis, + PredecessorMap predecessor, CostMap cost, + DistanceMap distance, WeightMap weight, + ColorMap color, VertexIndexMap index_map, + CompareFunction compare, CombineFunction combine, + CostInf inf, CostZero zero) + { + typedef indirect_cmp IndirectCmp; + IndirectCmp icmp(cost, compare); + + typedef typename graph_traits::vertex_descriptor + Vertex; + typedef mutable_queue, + IndirectCmp, VertexIndexMap> + MutableQueue; + MutableQueue Q(num_vertices(g), icmp, index_map); + + detail::astar_bfs_visitor + bfs_vis(h, vis, Q, predecessor, cost, distance, weight, + color, combine, compare, zero); + + breadth_first_visit(g, s, Q, bfs_vis, color); + } + + + // Non-named parameter interface + template + inline void + astar_search + (VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, AStarVisitor vis, + PredecessorMap predecessor, CostMap cost, + DistanceMap distance, WeightMap weight, + VertexIndexMap index_map, ColorMap color, + CompareFunction compare, CombineFunction combine, + CostInf inf, CostZero zero) + { + + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(color, *ui, Color::white()); + put(distance, *ui, inf); + put(cost, *ui, inf); + put(predecessor, *ui, *ui); + vis.initialize_vertex(*ui, g); + } + put(distance, s, zero); + put(cost, s, h(s)); + + astar_search_no_init + (g, s, h, vis, predecessor, cost, distance, weight, + color, index_map, compare, combine, inf, zero); + + } + + + + namespace detail { + template + inline void + astar_dispatch2 + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, CostMap cost, DistanceMap distance, + WeightMap weight, IndexMap index_map, ColorMap color, + const Params& params) + { + dummy_property_map p_map; + typedef typename property_traits::value_type C; + astar_search + (g, s, h, + choose_param(get_param(params, graph_visitor), + make_astar_visitor(null_visitor())), + choose_param(get_param(params, vertex_predecessor), p_map), + cost, distance, weight, index_map, color, + choose_param(get_param(params, distance_compare_t()), + std::less()), + choose_param(get_param(params, distance_combine_t()), + closed_plus()), + choose_param(get_param(params, distance_inf_t()), + std::numeric_limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()), + choose_param(get_param(params, distance_zero_t()), + C())); + } + + template + inline void + astar_dispatch1 + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, CostMap cost, DistanceMap distance, + WeightMap weight, IndexMap index_map, ColorMap color, + const Params& params) + { + typedef typename property_traits::value_type D; + typename std::vector::size_type + n = is_default_param(distance) ? num_vertices(g) : 1; + std::vector distance_map(n); + n = is_default_param(cost) ? num_vertices(g) : 1; + std::vector cost_map(n); + std::vector color_map(num_vertices(g)); + default_color_type c = white_color; + + detail::astar_dispatch2 + (g, s, h, + choose_param(cost, make_iterator_property_map + (cost_map.begin(), index_map, + cost_map[0])), + choose_param(distance, make_iterator_property_map + (distance_map.begin(), index_map, + distance_map[0])), + weight, index_map, + choose_param(color, make_iterator_property_map + (color_map.begin(), index_map, c)), + params); + } + } // namespace detail + + + // Named parameter interface + template + void + astar_search + (VertexListGraph &g, + typename graph_traits::vertex_descriptor s, + AStarHeuristic h, const bgl_named_params& params) + { + + detail::astar_dispatch1 + (g, s, h, + get_param(params, vertex_rank), + get_param(params, vertex_distance), + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + get_param(params, vertex_color), + params); + + } + +} // namespace boost + +#endif // BOOST_GRAPH_ASTAR_SEARCH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/bandwidth.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/bandwidth.hpp new file mode 100644 index 0000000000..ea44b31791 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/bandwidth.hpp @@ -0,0 +1,83 @@ +// Copyright (c) Jeremy Siek 2001, Marc Wintermantel 2002 +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GRAPH_BANDWIDTH_HPP +#define BOOST_GRAPH_BANDWIDTH_HPP + +#include // for std::min and std::max +#include +#include +#include + +namespace boost { + + template + typename graph_traits::vertices_size_type + ith_bandwidth(typename graph_traits::vertex_descriptor i, + const Graph& g, + VertexIndexMap index) + { + BOOST_USING_STD_MAX(); + typedef typename graph_traits::vertices_size_type size_type; + size_type b = 0; + typename graph_traits::out_edge_iterator e, end; + for (tie(e, end) = out_edges(i, g); e != end; ++e) { + int f_i = get(index, i); + int f_j = get(index, target(*e, g)); + using namespace std; // to call abs() unqualified + if(f_i > f_j) + b = max BOOST_PREVENT_MACRO_SUBSTITUTION (b, size_type(f_i - f_j)); + } + return b; + } + + template + typename graph_traits::vertices_size_type + ith_bandwidth(typename graph_traits::vertex_descriptor i, + const Graph& g) + { + return ith_bandwidth(i, g, get(vertex_index, g)); + } + + template + typename graph_traits::vertices_size_type + bandwidth(const Graph& g, VertexIndexMap index) + { + BOOST_USING_STD_MAX(); + typename graph_traits::vertices_size_type b = 0; + typename graph_traits::vertex_iterator i, end; + for (tie(i, end) = vertices(g); i != end; ++i) + b = max BOOST_PREVENT_MACRO_SUBSTITUTION (b, ith_bandwidth(*i, g, index)); + return b; + } + + template + typename graph_traits::vertices_size_type + bandwidth(const Graph& g) + { + return bandwidth(g, get(vertex_index, g)); + } + + template + typename graph_traits::vertices_size_type + edgesum(const Graph& g, VertexIndexMap index_map) + { + typedef typename graph_traits::vertices_size_type size_type; + typedef typename detail::numeric_traits::difference_type diff_t; + size_type sum = 0; + typename graph_traits::edge_iterator i, end; + for (tie(i, end) = edges(g); i != end; ++i) { + diff_t f_u = get(index_map, source(*i, g)); + diff_t f_v = get(index_map, target(*i, g)); + using namespace std; // to call abs() unqualified + sum += abs(f_u - f_v); + } + return sum; + } + +} // namespace boost + +#endif // BOOST_GRAPH_BANDWIDTH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/bc_clustering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/bc_clustering.hpp new file mode 100644 index 0000000000..eb438c1425 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/bc_clustering.hpp @@ -0,0 +1,164 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_BETWEENNESS_CENTRALITY_CLUSTERING_HPP +#define BOOST_GRAPH_BETWEENNESS_CENTRALITY_CLUSTERING_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { + +/** Threshold termination function for the betweenness centrality + * clustering algorithm. + */ +template +struct bc_clustering_threshold +{ + typedef T centrality_type; + + /// Terminate clustering when maximum absolute edge centrality is + /// below the given threshold. + explicit bc_clustering_threshold(T threshold) + : threshold(threshold), dividend(1.0) {} + + /** + * Terminate clustering when the maximum edge centrality is below + * the given threshold. + * + * @param threshold the threshold value + * + * @param g the graph on which the threshold will be calculated + * + * @param normalize when true, the threshold is compared against the + * normalized edge centrality based on the input graph; otherwise, + * the threshold is compared against the absolute edge centrality. + */ + template + bc_clustering_threshold(T threshold, const Graph& g, bool normalize = true) + : threshold(threshold), dividend(1.0) + { + if (normalize) { + typename graph_traits::vertices_size_type n = num_vertices(g); + dividend = T((n - 1) * (n - 2)) / T(2); + } + } + + /** Returns true when the given maximum edge centrality (potentially + * normalized) falls below the threshold. + */ + template + bool operator()(T max_centrality, Edge, const Graph&) + { + return (max_centrality / dividend) < threshold; + } + + protected: + T threshold; + T dividend; +}; + +/** Graph clustering based on edge betweenness centrality. + * + * This algorithm implements graph clustering based on edge + * betweenness centrality. It is an iterative algorithm, where in each + * step it compute the edge betweenness centrality (via @ref + * brandes_betweenness_centrality) and removes the edge with the + * maximum betweenness centrality. The @p done function object + * determines when the algorithm terminates (the edge found when the + * algorithm terminates will not be removed). + * + * @param g The graph on which clustering will be performed. The type + * of this parameter (@c MutableGraph) must be a model of the + * VertexListGraph, IncidenceGraph, EdgeListGraph, and Mutable Graph + * concepts. + * + * @param done The function object that indicates termination of the + * algorithm. It must be a ternary function object thats accepts the + * maximum centrality, the descriptor of the edge that will be + * removed, and the graph @p g. + * + * @param edge_centrality (UTIL/OUT) The property map that will store + * the betweenness centrality for each edge. When the algorithm + * terminates, it will contain the edge centralities for the + * graph. The type of this property map must model the + * ReadWritePropertyMap concept. Defaults to an @c + * iterator_property_map whose value type is + * @c Done::centrality_type and using @c get(edge_index, g) for the + * index map. + * + * @param vertex_index (IN) The property map that maps vertices to + * indices in the range @c [0, num_vertices(g)). This type of this + * property map must model the ReadablePropertyMap concept and its + * value type must be an integral type. Defaults to + * @c get(vertex_index, g). + */ +template +void +betweenness_centrality_clustering(MutableGraph& g, Done done, + EdgeCentralityMap edge_centrality, + VertexIndexMap vertex_index) +{ + typedef typename property_traits::value_type + centrality_type; + typedef typename graph_traits::edge_iterator edge_iterator; + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::vertices_size_type + vertices_size_type; + + if (edges(g).first == edges(g).second) return; + + // Function object that compares the centrality of edges + indirect_cmp > + cmp(edge_centrality); + + bool is_done; + do { + brandes_betweenness_centrality(g, + edge_centrality_map(edge_centrality) + .vertex_index_map(vertex_index)); + edge_descriptor e = *max_element(edges(g).first, edges(g).second, cmp); + is_done = done(get(edge_centrality, e), e, g); + if (!is_done) remove_edge(e, g); + } while (!is_done && edges(g).first != edges(g).second); +} + +/** + * \overload + */ +template +void +betweenness_centrality_clustering(MutableGraph& g, Done done, + EdgeCentralityMap edge_centrality) +{ + betweenness_centrality_clustering(g, done, edge_centrality, + get(vertex_index, g)); +} + +/** + * \overload + */ +template +void +betweenness_centrality_clustering(MutableGraph& g, Done done) +{ + typedef typename Done::centrality_type centrality_type; + std::vector edge_centrality(num_edges(g)); + betweenness_centrality_clustering(g, done, + make_iterator_property_map(edge_centrality.begin(), get(edge_index, g)), + get(vertex_index, g)); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_BETWEENNESS_CENTRALITY_CLUSTERING_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/bellman_ford_shortest_paths.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/bellman_ford_shortest_paths.hpp new file mode 100644 index 0000000000..4001c288e7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/bellman_ford_shortest_paths.hpp @@ -0,0 +1,241 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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 file implements the function + + template + bool bellman_ford_shortest_paths(EdgeListGraph& g, Size N, + const bgl_named_params& params) + + */ + + +#ifndef BOOST_GRAPH_BELLMAN_FORD_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_BELLMAN_FORD_SHORTEST_PATHS_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + struct BellmanFordVisitorConcept { + void constraints() { + function_requires< CopyConstructibleConcept >(); + vis.examine_edge(e, g); + vis.edge_relaxed(e, g); + vis.edge_not_relaxed(e, g); + vis.edge_minimized(e, g); + vis.edge_not_minimized(e, g); + } + Visitor vis; + Graph g; + typename graph_traits::edge_descriptor e; + }; + + template + class bellman_visitor { + public: + bellman_visitor() { } + bellman_visitor(Visitors vis) : m_vis(vis) { } + + template + void examine_edge(Edge u, Graph& g) { + invoke_visitors(m_vis, u, g, on_examine_edge()); + } + template + void edge_relaxed(Edge u, Graph& g) { + invoke_visitors(m_vis, u, g, on_edge_relaxed()); + } + template + void edge_not_relaxed(Edge u, Graph& g) { + invoke_visitors(m_vis, u, g, on_edge_not_relaxed()); + } + template + void edge_minimized(Edge u, Graph& g) { + invoke_visitors(m_vis, u, g, on_edge_minimized()); + } + template + void edge_not_minimized(Edge u, Graph& g) { + invoke_visitors(m_vis, u, g, on_edge_not_minimized()); + } + protected: + Visitors m_vis; + }; + template + bellman_visitor + make_bellman_visitor(Visitors vis) { + return bellman_visitor(vis); + } + typedef bellman_visitor<> default_bellman_visitor; + + template + bool bellman_ford_shortest_paths(EdgeListGraph& g, Size N, + WeightMap weight, + PredecessorMap pred, + DistanceMap distance, + BinaryFunction combine, + BinaryPredicate compare, + BellmanFordVisitor v) + { + function_requires >(); + typedef graph_traits GTraits; + typedef typename GTraits::edge_descriptor Edge; + typedef typename GTraits::vertex_descriptor Vertex; + function_requires >(); + function_requires >(); + typedef typename property_traits::value_type D_value; + typedef typename property_traits::value_type W_value; + + typename GTraits::edge_iterator i, end; + + for (Size k = 0; k < N; ++k) { + bool at_least_one_edge_relaxed = false; + for (tie(i, end) = edges(g); i != end; ++i) { + v.examine_edge(*i, g); + if (relax(*i, g, weight, pred, distance, combine, compare)) { + at_least_one_edge_relaxed = true; + v.edge_relaxed(*i, g); + } else + v.edge_not_relaxed(*i, g); + } + if (!at_least_one_edge_relaxed) + break; + } + + for (tie(i, end) = edges(g); i != end; ++i) + if (compare(combine(get(distance, source(*i, g)), get(weight, *i)), + get(distance, target(*i,g)))) + { + v.edge_not_minimized(*i, g); + return false; + } else + v.edge_minimized(*i, g); + + return true; + } + + namespace detail { + + template + bool + bellman_dispatch2 + (VertexAndEdgeListGraph& g, + typename graph_traits::vertex_descriptor s, + Size N, WeightMap weight, PredecessorMap pred, DistanceMap distance, + const bgl_named_params& params) + { + typedef typename property_traits::value_type D; + bellman_visitor<> null_vis; + typedef typename property_traits::value_type weight_type; + typename graph_traits::vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + put(distance, *v, (std::numeric_limits::max)()); + put(pred, *v, *v); + } + put(distance, s, weight_type(0)); + return bellman_ford_shortest_paths + (g, N, weight, pred, distance, + choose_param(get_param(params, distance_combine_t()), + closed_plus()), + choose_param(get_param(params, distance_compare_t()), + std::less()), + choose_param(get_param(params, graph_visitor), + null_vis) + ); + } + + template + bool + bellman_dispatch2 + (VertexAndEdgeListGraph& g, + detail::error_property_not_found, + Size N, WeightMap weight, PredecessorMap pred, DistanceMap distance, + const bgl_named_params& params) + { + typedef typename property_traits::value_type D; + bellman_visitor<> null_vis; + return bellman_ford_shortest_paths + (g, N, weight, pred, distance, + choose_param(get_param(params, distance_combine_t()), + closed_plus()), + choose_param(get_param(params, distance_compare_t()), + std::less()), + choose_param(get_param(params, graph_visitor), + null_vis) + ); + } + + template + bool bellman_dispatch(EdgeListGraph& g, Size N, + WeightMap weight, DistanceMap distance, + const bgl_named_params& params) + { + dummy_property_map dummy_pred; + return + detail::bellman_dispatch2 + (g, + get_param(params, root_vertex_t()), + N, weight, + choose_param(get_param(params, vertex_predecessor), dummy_pred), + distance, + params); + } + } // namespace detail + + template + bool bellman_ford_shortest_paths + (EdgeListGraph& g, Size N, + const bgl_named_params& params) + { + return detail::bellman_dispatch + (g, N, + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + choose_pmap(get_param(params, vertex_distance), g, vertex_distance), + params); + } + + template + bool bellman_ford_shortest_paths(EdgeListGraph& g, Size N) + { + bgl_named_params params(0); + return bellman_ford_shortest_paths(g, N, params); + } + + template + bool bellman_ford_shortest_paths + (VertexAndEdgeListGraph& g, + const bgl_named_params& params) + { + function_requires >(); + return detail::bellman_dispatch + (g, num_vertices(g), + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + choose_pmap(get_param(params, vertex_distance), g, vertex_distance), + params); + } +} // namespace boost + +#endif // BOOST_GRAPH_BELLMAN_FORD_SHORTEST_PATHS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/betweenness_centrality.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/betweenness_centrality.hpp new file mode 100644 index 0000000000..0262ad9741 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/betweenness_centrality.hpp @@ -0,0 +1,597 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_BRANDES_BETWEENNESS_CENTRALITY_HPP +#define BOOST_GRAPH_BRANDES_BETWEENNESS_CENTRALITY_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +namespace detail { namespace graph { + + /** + * Customized visitor passed to Dijkstra's algorithm by Brandes' + * betweenness centrality algorithm. This visitor is responsible for + * keeping track of the order in which vertices are discovered, the + * predecessors on the shortest path(s) to a vertex, and the number + * of shortest paths. + */ + template + struct brandes_dijkstra_visitor : public bfs_visitor<> + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + brandes_dijkstra_visitor(std::stack& ordered_vertices, + WeightMap weight, + IncomingMap incoming, + DistanceMap distance, + PathCountMap path_count) + : ordered_vertices(ordered_vertices), weight(weight), + incoming(incoming), distance(distance), + path_count(path_count) + { } + + /** + * Whenever an edge e = (v, w) is relaxed, the incoming edge list + * for w is set to {(v, w)} and the shortest path count of w is set to + * the number of paths that reach {v}. + */ + void edge_relaxed(edge_descriptor e, const Graph& g) + { + vertex_descriptor v = source(e, g), w = target(e, g); + incoming[w].clear(); + incoming[w].push_back(e); + put(path_count, w, get(path_count, v)); + } + + /** + * If an edge e = (v, w) was not relaxed, it may still be the case + * that we've found more equally-short paths, so include {(v, w)} in the + * incoming edges of w and add all of the shortest paths to v to the + * shortest path count of w. + */ + void edge_not_relaxed(edge_descriptor e, const Graph& g) + { + typedef typename property_traits::value_type weight_type; + typedef typename property_traits::value_type distance_type; + vertex_descriptor v = source(e, g), w = target(e, g); + distance_type d_v = get(distance, v), d_w = get(distance, w); + weight_type w_e = get(weight, e); + + closed_plus combine; + if (d_w == combine(d_v, w_e)) { + put(path_count, w, get(path_count, w) + get(path_count, v)); + incoming[w].push_back(e); + } + } + + /// Keep track of vertices as they are reached + void examine_vertex(vertex_descriptor w, const Graph&) + { + ordered_vertices.push(w); + } + + private: + std::stack& ordered_vertices; + WeightMap weight; + IncomingMap incoming; + DistanceMap distance; + PathCountMap path_count; + }; + + /** + * Function object that calls Dijkstra's shortest paths algorithm + * using the Dijkstra visitor for the Brandes betweenness centrality + * algorithm. + */ + template + struct brandes_dijkstra_shortest_paths + { + brandes_dijkstra_shortest_paths(WeightMap weight_map) + : weight_map(weight_map) { } + + template + void + operator()(Graph& g, + typename graph_traits::vertex_descriptor s, + std::stack::vertex_descriptor>& ov, + IncomingMap incoming, + DistanceMap distance, + PathCountMap path_count, + VertexIndexMap vertex_index) + { + typedef brandes_dijkstra_visitor visitor_type; + visitor_type visitor(ov, weight_map, incoming, distance, path_count); + + dijkstra_shortest_paths(g, s, + boost::weight_map(weight_map) + .vertex_index_map(vertex_index) + .distance_map(distance) + .visitor(visitor)); + } + + private: + WeightMap weight_map; + }; + + /** + * Function object that invokes breadth-first search for the + * unweighted form of the Brandes betweenness centrality algorithm. + */ + struct brandes_unweighted_shortest_paths + { + /** + * Customized visitor passed to breadth-first search, which + * records predecessor and the number of shortest paths to each + * vertex. + */ + template + struct visitor_type : public bfs_visitor<> + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + + visitor_type(IncomingMap incoming, DistanceMap distance, + PathCountMap path_count, + std::stack& ordered_vertices) + : incoming(incoming), distance(distance), + path_count(path_count), ordered_vertices(ordered_vertices) { } + + /// Keep track of vertices as they are reached + void examine_vertex(vertex_descriptor v, Graph&) + { + ordered_vertices.push(v); + } + + /** + * Whenever an edge e = (v, w) is labelled a tree edge, the + * incoming edge list for w is set to {(v, w)} and the shortest + * path count of w is set to the number of paths that reach {v}. + */ + void tree_edge(edge_descriptor e, Graph& g) + { + vertex_descriptor v = source(e, g); + vertex_descriptor w = target(e, g); + put(distance, w, get(distance, v) + 1); + + put(path_count, w, get(path_count, v)); + incoming[w].push_back(e); + } + + /** + * If an edge e = (v, w) is not a tree edge, it may still be the + * case that we've found more equally-short paths, so include (v, w) + * in the incoming edge list of w and add all of the shortest + * paths to v to the shortest path count of w. + */ + void non_tree_edge(edge_descriptor e, Graph& g) + { + vertex_descriptor v = source(e, g); + vertex_descriptor w = target(e, g); + if (get(distance, w) == get(distance, v) + 1) { + put(path_count, w, get(path_count, w) + get(path_count, v)); + incoming[w].push_back(e); + } + } + + private: + IncomingMap incoming; + DistanceMap distance; + PathCountMap path_count; + std::stack& ordered_vertices; + }; + + template + void + operator()(Graph& g, + typename graph_traits::vertex_descriptor s, + std::stack::vertex_descriptor>& ov, + IncomingMap incoming, + DistanceMap distance, + PathCountMap path_count, + VertexIndexMap vertex_index) + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + + visitor_type + visitor(incoming, distance, path_count, ov); + + std::vector + colors(num_vertices(g), color_traits::white()); + boost::queue Q; + breadth_first_visit(g, s, Q, visitor, + make_iterator_property_map(colors.begin(), + vertex_index)); + } + }; + + // When the edge centrality map is a dummy property map, no + // initialization is needed. + template + inline void + init_centrality_map(std::pair, dummy_property_map) { } + + // When we have a real edge centrality map, initialize all of the + // centralities to zero. + template + void + init_centrality_map(std::pair keys, Centrality centrality_map) + { + typedef typename property_traits::value_type + centrality_type; + while (keys.first != keys.second) { + put(centrality_map, *keys.first, centrality_type(0)); + ++keys.first; + } + } + + // When the edge centrality map is a dummy property map, no update + // is performed. + template + inline void + update_centrality(dummy_property_map, const Key&, const T&) { } + + // When we have a real edge centrality map, add the value to the map + template + inline void + update_centrality(CentralityMap centrality_map, Key k, const T& x) + { put(centrality_map, k, get(centrality_map, k) + x); } + + template + inline void + divide_centrality_by_two(std::pair, dummy_property_map) {} + + template + inline void + divide_centrality_by_two(std::pair keys, + CentralityMap centrality_map) + { + typename property_traits::value_type two(2); + while (keys.first != keys.second) { + put(centrality_map, *keys.first, get(centrality_map, *keys.first) / two); + ++keys.first; + } + } + + template + void + brandes_betweenness_centrality_impl(const Graph& g, + CentralityMap centrality, // C_B + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, // P + DistanceMap distance, // d + DependencyMap dependency, // delta + PathCountMap path_count, // sigma + VertexIndexMap vertex_index, + ShortestPaths shortest_paths) + { + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::edge_iterator edge_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + // Initialize centrality + init_centrality_map(vertices(g), centrality); + init_centrality_map(edges(g), edge_centrality_map); + + std::stack ordered_vertices; + vertex_iterator s, s_end; + for (tie(s, s_end) = vertices(g); s != s_end; ++s) { + // Initialize for this iteration + vertex_iterator w, w_end; + for (tie(w, w_end) = vertices(g); w != w_end; ++w) { + incoming[*w].clear(); + put(path_count, *w, 0); + put(dependency, *w, 0); + } + put(path_count, *s, 1); + + // Execute the shortest paths algorithm. This will be either + // Dijkstra's algorithm or a customized breadth-first search, + // depending on whether the graph is weighted or unweighted. + shortest_paths(g, *s, ordered_vertices, incoming, distance, + path_count, vertex_index); + + while (!ordered_vertices.empty()) { + vertex_descriptor w = ordered_vertices.top(); + ordered_vertices.pop(); + + typedef typename property_traits::value_type + incoming_type; + typedef typename incoming_type::iterator incoming_iterator; + typedef typename property_traits::value_type + dependency_type; + + for (incoming_iterator vw = incoming[w].begin(); + vw != incoming[w].end(); ++vw) { + vertex_descriptor v = source(*vw, g); + dependency_type factor = dependency_type(get(path_count, v)) + / dependency_type(get(path_count, w)); + factor *= (dependency_type(1) + get(dependency, w)); + put(dependency, v, get(dependency, v) + factor); + update_centrality(edge_centrality_map, *vw, factor); + } + + if (w != *s) { + update_centrality(centrality, w, get(dependency, w)); + } + } + } + + typedef typename graph_traits::directed_category directed_category; + const bool is_undirected = + is_convertible::value; + if (is_undirected) { + divide_centrality_by_two(vertices(g), centrality); + divide_centrality_by_two(edges(g), edge_centrality_map); + } + } + +} } // end namespace detail::graph + +template +void +brandes_betweenness_centrality(const Graph& g, + CentralityMap centrality, // C_B + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, // P + DistanceMap distance, // d + DependencyMap dependency, // delta + PathCountMap path_count, // sigma + VertexIndexMap vertex_index) +{ + detail::graph::brandes_unweighted_shortest_paths shortest_paths; + + detail::graph::brandes_betweenness_centrality_impl(g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths); +} + +template +void +brandes_betweenness_centrality(const Graph& g, + CentralityMap centrality, // C_B + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, // P + DistanceMap distance, // d + DependencyMap dependency, // delta + PathCountMap path_count, // sigma + VertexIndexMap vertex_index, + WeightMap weight_map) +{ + detail::graph::brandes_dijkstra_shortest_paths + shortest_paths(weight_map); + + detail::graph::brandes_betweenness_centrality_impl(g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths); +} + +namespace detail { namespace graph { + template + void + brandes_betweenness_centrality_dispatch2(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + WeightMap weight_map, + VertexIndexMap vertex_index) + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename mpl::if_c<(is_same::value), + EdgeCentralityMap, + CentralityMap>::type a_centrality_map; + typedef typename property_traits::value_type + centrality_type; + + typename graph_traits::vertices_size_type V = num_vertices(g); + + std::vector > incoming(V); + std::vector distance(V); + std::vector dependency(V); + std::vector path_count(V); + + brandes_betweenness_centrality( + g, centrality, edge_centrality_map, + make_iterator_property_map(incoming.begin(), vertex_index), + make_iterator_property_map(distance.begin(), vertex_index), + make_iterator_property_map(dependency.begin(), vertex_index), + make_iterator_property_map(path_count.begin(), vertex_index), + vertex_index, + weight_map); + } + + + template + void + brandes_betweenness_centrality_dispatch2(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index) + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename mpl::if_c<(is_same::value), + EdgeCentralityMap, + CentralityMap>::type a_centrality_map; + typedef typename property_traits::value_type + centrality_type; + + typename graph_traits::vertices_size_type V = num_vertices(g); + + std::vector > incoming(V); + std::vector distance(V); + std::vector dependency(V); + std::vector path_count(V); + + brandes_betweenness_centrality( + g, centrality, edge_centrality_map, + make_iterator_property_map(incoming.begin(), vertex_index), + make_iterator_property_map(distance.begin(), vertex_index), + make_iterator_property_map(dependency.begin(), vertex_index), + make_iterator_property_map(path_count.begin(), vertex_index), + vertex_index); + } + + template + struct brandes_betweenness_centrality_dispatch1 + { + template + static void + run(const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, + WeightMap weight_map) + { + brandes_betweenness_centrality_dispatch2(g, centrality, edge_centrality_map, + weight_map, vertex_index); + } + }; + + template<> + struct brandes_betweenness_centrality_dispatch1 + { + template + static void + run(const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, + error_property_not_found) + { + brandes_betweenness_centrality_dispatch2(g, centrality, edge_centrality_map, + vertex_index); + } + }; + +} } // end namespace detail::graph + +template +void +brandes_betweenness_centrality(const Graph& g, + const bgl_named_params& params) +{ + typedef bgl_named_params named_params; + + typedef typename property_value::type ew; + detail::graph::brandes_betweenness_centrality_dispatch1::run( + g, + choose_param(get_param(params, vertex_centrality), + dummy_property_map()), + choose_param(get_param(params, edge_centrality), + dummy_property_map()), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + get_param(params, edge_weight)); +} + +template +void +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality) +{ + detail::graph::brandes_betweenness_centrality_dispatch2( + g, centrality, dummy_property_map(), get(vertex_index, g)); +} + +template +void +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map) +{ + detail::graph::brandes_betweenness_centrality_dispatch2( + g, centrality, edge_centrality_map, get(vertex_index, g)); +} + +/** + * Converts "absolute" betweenness centrality (as computed by the + * brandes_betweenness_centrality algorithm) in the centrality map + * into "relative" centrality. The result is placed back into the + * given centrality map. + */ +template +void +relative_betweenness_centrality(const Graph& g, CentralityMap centrality) +{ + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename property_traits::value_type centrality_type; + + typename graph_traits::vertices_size_type n = num_vertices(g); + centrality_type factor = centrality_type(2)/centrality_type(n*n - 3*n + 2); + vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + put(centrality, *v, factor * get(centrality, *v)); + } +} + +// Compute the central point dominance of a graph. +template +typename property_traits::value_type +central_point_dominance(const Graph& g, CentralityMap centrality) +{ + using std::max; + + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename property_traits::value_type centrality_type; + + typename graph_traits::vertices_size_type n = num_vertices(g); + + // Find max centrality + centrality_type max_centrality(0); + vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + max_centrality = (max)(max_centrality, get(centrality, *v)); + } + + // Compute central point dominance + centrality_type sum(0); + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + sum += (max_centrality - get(centrality, *v)); + } + return sum/(n-1); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_BRANDES_BETWEENNESS_CENTRALITY_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/biconnected_components.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/biconnected_components.hpp new file mode 100644 index 0000000000..2d8b271d88 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/biconnected_components.hpp @@ -0,0 +1,415 @@ +// Copyright (c) Jeremy Siek 2001 +// Copyright (c) Douglas Gregor 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) + +// NOTE: this final is generated by libs/graph/doc/biconnected_components.w + +#ifndef BOOST_GRAPH_BICONNECTED_COMPONENTS_HPP +#define BOOST_GRAPH_BICONNECTED_COMPONENTS_HPP + +#include +#include +#include // for std::min and std::max +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + namespace detail + { + template + struct biconnected_components_visitor : public dfs_visitor<> + { + biconnected_components_visitor + (ComponentMap comp, std::size_t& c, DiscoverTimeMap dtm, + std::size_t& dfs_time, LowPointMap lowpt, PredecessorMap pred, + OutputIterator out, Stack& S, DFSVisitor vis) + : comp(comp), c(c), dtm(dtm), dfs_time(dfs_time), lowpt(lowpt), + pred(pred), out(out), S(S), vis(vis) { } + + template + void initialize_vertex(const Vertex& u, Graph& g) + { + vis.initialize_vertex(u, g); + } + + template + void start_vertex(const Vertex& u, Graph& g) + { + put(pred, u, u); + vis.start_vertex(u, g); + } + + template + void discover_vertex(const Vertex& u, Graph& g) + { + put(dtm, u, ++dfs_time); + put(lowpt, u, get(dtm, u)); + vis.discover_vertex(u, g); + } + + template + void examine_edge(const Edge& e, Graph& g) + { + vis.examine_edge(e, g); + } + + template + void tree_edge(const Edge& e, Graph& g) + { + S.push(e); + put(pred, target(e, g), source(e, g)); + vis.tree_edge(e, g); + } + + template + void back_edge(const Edge& e, Graph& g) + { + BOOST_USING_STD_MIN(); + + if ( target(e, g) != get(pred, source(e, g)) ) { + S.push(e); + put(lowpt, source(e, g), + min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, source(e, g)), + get(dtm, target(e, g)))); + vis.back_edge(e, g); + } + } + + template + void forward_or_cross_edge(const Edge& e, Graph& g) + { + vis.forward_or_cross_edge(e, g); + } + + template + void finish_vertex(const Vertex& u, Graph& g) + { + BOOST_USING_STD_MIN(); + Vertex parent = get(pred, u); + const std::size_t dtm_of_dubious_parent = get(dtm, parent); + bool is_art_point = false; + if ( dtm_of_dubious_parent > get(dtm, u) ) { + parent = get(pred, parent); + is_art_point = true; + put(pred, get(pred, u), u); + put(pred, u, parent); + } + + if ( parent == u ) { // at top + if ( get(dtm, u) + 1 == dtm_of_dubious_parent ) + is_art_point = false; + } else { + put(lowpt, parent, + min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, parent), + get(lowpt, u))); + + if (get(lowpt, u) >= get(dtm, parent)) { + if ( get(dtm, parent) > get(dtm, get(pred, parent)) ) { + put(pred, u, get(pred, parent)); + put(pred, parent, u); + } + + while ( get(dtm, source(S.top(), g)) >= get(dtm, u) ) { + put(comp, S.top(), c); + S.pop(); + } + put(comp, S.top(), c); + S.pop(); + ++c; + if ( S.empty() ) { + put(pred, u, parent); + put(pred, parent, u); + } + } + } + if ( is_art_point ) + *out++ = u; + vis.finish_vertex(u, g); + } + + ComponentMap comp; + std::size_t& c; + DiscoverTimeMap dtm; + std::size_t& dfs_time; + LowPointMap lowpt; + PredecessorMap pred; + OutputIterator out; + Stack& S; + DFSVisitor vis; + }; + + template + std::pair + biconnected_components_impl(const Graph & g, ComponentMap comp, + OutputIterator out, VertexIndexMap index_map, DiscoverTimeMap dtm, + LowPointMap lowpt, PredecessorMap pred, DFSVisitor dfs_vis) + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + function_requires >(); + function_requires >(); + function_requires >(); + function_requires >(); + function_requires >(); + function_requires >(); + + std::size_t num_components = 0; + std::size_t dfs_time = 0; + std::stack S; + + biconnected_components_visitor, + DFSVisitor> + vis(comp, num_components, dtm, dfs_time, lowpt, pred, out, + S, dfs_vis); + + depth_first_search(g, visitor(vis).vertex_index_map(index_map)); + + return std::pair(num_components, vis.out); + } + + template + struct bicomp_dispatch3 + { + template + static std::pair apply (const Graph & g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, LowPointMap lowpt, + const bgl_named_params& params, PredecessorMap pred) + { + return biconnected_components_impl + (g, comp, out, index_map, dtm, lowpt, pred, + choose_param(get_param(params, graph_visitor), + make_dfs_visitor(null_visitor()))); + } + }; + + template <> + struct bicomp_dispatch3 + { + template + static std::pair apply (const Graph & g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, LowPointMap lowpt, + const bgl_named_params& params, + error_property_not_found) + { + typedef typename graph_traits::vertex_descriptor vertex_t; + std::vector pred(num_vertices(g)); + vertex_t vert = graph_traits::null_vertex(); + + return biconnected_components_impl + (g, comp, out, index_map, dtm, lowpt, + make_iterator_property_map(pred.begin(), index_map, vert), + choose_param(get_param(params, graph_visitor), + make_dfs_visitor(null_visitor()))); + } + }; + + template + struct bicomp_dispatch2 + { + template + static std::pair apply (const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, const bgl_named_params& params, + LowPointMap lowpt) + { + typedef typename property_value< bgl_named_params, + vertex_predecessor_t>::type dispatch_type; + + return bicomp_dispatch3::apply + (g, comp, out, index_map, dtm, lowpt, params, + get_param(params, vertex_predecessor)); + } + }; + + + template <> + struct bicomp_dispatch2 + { + template + static std::pair apply (const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, const bgl_named_params& params, + error_property_not_found) + { + typedef typename graph_traits::vertices_size_type + vertices_size_type; + std::vector lowpt(num_vertices(g)); + vertices_size_type vst(0); + + typedef typename property_value< bgl_named_params, + vertex_predecessor_t>::type dispatch_type; + + return bicomp_dispatch3::apply + (g, comp, out, index_map, dtm, + make_iterator_property_map(lowpt.begin(), index_map, vst), + params, get_param(params, vertex_predecessor)); + } + }; + + template + struct bicomp_dispatch1 + { + template + static std::pair apply(const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + const bgl_named_params& params, DiscoverTimeMap dtm) + { + typedef typename property_value< bgl_named_params, + vertex_lowpoint_t>::type dispatch_type; + + return bicomp_dispatch2::apply + (g, comp, out, index_map, dtm, params, + get_param(params, vertex_lowpoint)); + } + }; + + template <> + struct bicomp_dispatch1 + { + template + static std::pair apply(const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + const bgl_named_params& params, error_property_not_found) + { + typedef typename graph_traits::vertices_size_type + vertices_size_type; + std::vector discover_time(num_vertices(g)); + vertices_size_type vst(0); + + typedef typename property_value< bgl_named_params, + vertex_lowpoint_t>::type dispatch_type; + + return bicomp_dispatch2::apply + (g, comp, out, index_map, + make_iterator_property_map(discover_time.begin(), index_map, vst), + params, get_param(params, vertex_lowpoint)); + } + }; + + } + + template + std::pair + biconnected_components(const Graph& g, ComponentMap comp, + OutputIterator out, DiscoverTimeMap dtm, LowPointMap lowpt) + { + typedef detail::error_property_not_found dispatch_type; + + return detail::bicomp_dispatch3::apply + (g, comp, out, + get(vertex_index, g), + dtm, lowpt, + bgl_named_params(0), + detail::error_property_not_found()); + } + + template + std::pair + biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out, + const bgl_named_params& params) + { + typedef typename property_value< bgl_named_params, + vertex_discover_time_t>::type dispatch_type; + + return detail::bicomp_dispatch1::apply(g, comp, out, + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + params, get_param(params, vertex_discover_time)); + } + + template < typename Graph, typename ComponentMap, typename OutputIterator> + std::pair + biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out) + { + return biconnected_components(g, comp, out, + bgl_named_params(0)); + } + + namespace graph_detail { + struct dummy_output_iterator + { + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void pointer; + typedef void difference_type; + + struct reference { + template + reference& operator=(const T&) { return *this; } + }; + + reference operator*() const { return reference(); } + dummy_output_iterator& operator++() { return *this; } + dummy_output_iterator operator++(int) { return *this; } + }; + } // end namespace graph_detail + + template + std::size_t + biconnected_components(const Graph& g, ComponentMap comp, + const bgl_named_params& params) + { + return biconnected_components(g, comp, + graph_detail::dummy_output_iterator(), params).first; + } + + template + std::size_t + biconnected_components(const Graph& g, ComponentMap comp) + { + return biconnected_components(g, comp, + graph_detail::dummy_output_iterator()).first; + } + + template + OutputIterator + articulation_points(const Graph& g, OutputIterator out, + const bgl_named_params& params) + { + return biconnected_components(g, dummy_property_map(), out, + params).second; + } + + template + OutputIterator + articulation_points(const Graph& g, OutputIterator out) + { + return biconnected_components(g, dummy_property_map(), out, + bgl_named_params(0)).second; + } + +} // namespace boost + +#endif /* BOOST_GRAPH_BICONNECTED_COMPONENTS_HPP */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/boyer_myrvold_planar_test.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/boyer_myrvold_planar_test.hpp new file mode 100644 index 0000000000..dc0158687f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/boyer_myrvold_planar_test.hpp @@ -0,0 +1,322 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __BOYER_MYRVOLD_PLANAR_TEST_HPP__ +#define __BOYER_MYRVOLD_PLANAR_TEST_HPP__ + +#include +#include +#include +#include + + +namespace boost +{ + + struct no_kuratowski_subgraph_isolation {}; + struct no_planar_embedding {}; + + namespace boyer_myrvold_params + { + + BOOST_PARAMETER_KEYWORD(tag, graph) + BOOST_PARAMETER_KEYWORD(tag, embedding) + BOOST_PARAMETER_KEYWORD(tag, kuratowski_subgraph) + BOOST_PARAMETER_KEYWORD(tag, vertex_index_map) + BOOST_PARAMETER_KEYWORD(tag, edge_index_map) + + typedef parameter::parameters< parameter::required, + tag::embedding, + tag::kuratowski_subgraph, + tag::vertex_index_map, + tag::edge_index_map + > boyer_myrvold_params_t; + + namespace core + { + + template + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::true_, + mpl::true_ + ) + { + //Dispatch for no planar embedding, no kuratowski subgraph isolation + + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map + < typename remove_reference::type, + vertex_index_t>::const_type + >::type vertex_index_map_t; + + boyer_myrvold_impl + + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + return planarity_tester.is_planar() ? true : false; + } + + + + template + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::true_, + mpl::false_ + ) + { + //Dispatch for no planar embedding, kuratowski subgraph isolation + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map::type + >::type vertex_index_map_t; + + boyer_myrvold_impl + + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + if (planarity_tester.is_planar()) + return true; + else + { + planarity_tester.extract_kuratowski_subgraph + (args[kuratowski_subgraph], + args[edge_index_map|get(edge_index, args[graph])] + ); + return false; + } + } + + + + + template + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::false_, + mpl::true_ + ) + { + //Dispatch for planar embedding, no kuratowski subgraph isolation + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map::type + >::type vertex_index_map_t; + + boyer_myrvold_impl + + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + if (planarity_tester.is_planar()) + { + planarity_tester.make_edge_permutation(args[embedding]); + return true; + } + else + return false; + } + + + + template + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::false_, + mpl::false_ + ) + { + //Dispatch for planar embedding, kuratowski subgraph isolation + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map::type + >::type vertex_index_map_t; + + boyer_myrvold_impl + + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + if (planarity_tester.is_planar()) + { + planarity_tester.make_edge_permutation(args[embedding]); + return true; + } + else + { + planarity_tester.extract_kuratowski_subgraph + (args[kuratowski_subgraph], + args[edge_index_map | get(edge_index, args[graph])] + ); + return false; + } + } + + + + + template + bool boyer_myrvold_planarity_test(ArgumentPack const& args) + { + + typedef typename parameter::binding + < ArgumentPack, + tag::kuratowski_subgraph, + const no_kuratowski_subgraph_isolation& + >::type + kuratowski_arg_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::embedding, + const no_planar_embedding& + >::type + embedding_arg_t; + + return dispatched_boyer_myrvold + (args, + boost::is_same + (), + boost::is_same + () + ); + } + + + + } //namespace core + + } //namespace boyer_myrvold_params + + + template + bool boyer_myrvold_planarity_test(A0 const& arg0) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0)); + } + + template + // bool boyer_myrvold_planarity_test(A0 const& arg0, A1 const& arg1) + bool boyer_myrvold_planarity_test(A0 const& arg0, A1 const& arg1) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1)); + } + + template + bool boyer_myrvold_planarity_test(A0 const& arg0, + A1 const& arg1, + A2 const& arg2 + ) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1,arg2)); + } + + template + bool boyer_myrvold_planarity_test(A0 const& arg0, + A1 const& arg1, + A2 const& arg2, + A3 const& arg3 + ) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1,arg2,arg3)); + } + + template + bool boyer_myrvold_planarity_test(A0 const& arg0, + A1 const& arg1, + A2 const& arg2, + A3 const& arg3, + A4 const& arg4 + ) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t() + (arg0,arg1,arg2,arg3,arg4) + ); + } + + +} + +#endif //__BOYER_MYRVOLD_PLANAR_TEST_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/breadth_first_search.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/breadth_first_search.hpp new file mode 100644 index 0000000000..d8ffd7fed5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/breadth_first_search.hpp @@ -0,0 +1,293 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_BREADTH_FIRST_SEARCH_HPP +#define BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP + +/* + Breadth First Search Algorithm (Cormen, Leiserson, and Rivest p. 470) +*/ +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + struct BFSVisitorConcept { + void constraints() { + function_requires< CopyConstructibleConcept >(); + vis.initialize_vertex(u, g); + vis.discover_vertex(u, g); + vis.examine_vertex(u, g); + vis.examine_edge(e, g); + vis.tree_edge(e, g); + vis.non_tree_edge(e, g); + vis.gray_target(e, g); + vis.black_target(e, g); + vis.finish_vertex(u, g); + } + Visitor vis; + Graph g; + typename graph_traits::vertex_descriptor u; + typename graph_traits::edge_descriptor e; + }; + + + template + void breadth_first_visit + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor s, + Buffer& Q, BFSVisitor vis, ColorMap color) + { + function_requires< IncidenceGraphConcept >(); + typedef graph_traits GTraits; + typedef typename GTraits::vertex_descriptor Vertex; + typedef typename GTraits::edge_descriptor Edge; + function_requires< BFSVisitorConcept >(); + function_requires< ReadWritePropertyMapConcept >(); + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typename GTraits::out_edge_iterator ei, ei_end; + + put(color, s, Color::gray()); vis.discover_vertex(s, g); + Q.push(s); + while (! Q.empty()) { + Vertex u = Q.top(); Q.pop(); vis.examine_vertex(u, g); + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + Vertex v = target(*ei, g); vis.examine_edge(*ei, g); + ColorValue v_color = get(color, v); + if (v_color == Color::white()) { vis.tree_edge(*ei, g); + put(color, v, Color::gray()); vis.discover_vertex(v, g); + Q.push(v); + } else { vis.non_tree_edge(*ei, g); + if (v_color == Color::gray()) vis.gray_target(*ei, g); + else vis.black_target(*ei, g); + } + } // end for + put(color, u, Color::black()); vis.finish_vertex(u, g); + } // end while + } // breadth_first_visit + + + template + void breadth_first_search + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + Buffer& Q, BFSVisitor vis, ColorMap color) + { + // Initialization + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typename boost::graph_traits::vertex_iterator i, i_end; + for (tie(i, i_end) = vertices(g); i != i_end; ++i) { + vis.initialize_vertex(*i, g); + put(color, *i, Color::white()); + } + breadth_first_visit(g, s, Q, vis, color); + } + + + template + class bfs_visitor { + public: + bfs_visitor() { } + bfs_visitor(Visitors vis) : m_vis(vis) { } + + template + void initialize_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_initialize_vertex()); + } + template + void discover_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_discover_vertex()); + } + template + void examine_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_examine_vertex()); + } + template + void examine_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, ::boost::on_examine_edge()); + } + template + void tree_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, ::boost::on_tree_edge()); + } + template + void non_tree_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, ::boost::on_non_tree_edge()); + } + template + void gray_target(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, ::boost::on_gray_target()); + } + template + void black_target(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, ::boost::on_black_target()); + } + template + void finish_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_finish_vertex()); + } + + BOOST_GRAPH_EVENT_STUB(on_initialize_vertex,bfs) + BOOST_GRAPH_EVENT_STUB(on_discover_vertex,bfs) + BOOST_GRAPH_EVENT_STUB(on_examine_vertex,bfs) + BOOST_GRAPH_EVENT_STUB(on_examine_edge,bfs) + BOOST_GRAPH_EVENT_STUB(on_tree_edge,bfs) + BOOST_GRAPH_EVENT_STUB(on_non_tree_edge,bfs) + BOOST_GRAPH_EVENT_STUB(on_gray_target,bfs) + BOOST_GRAPH_EVENT_STUB(on_black_target,bfs) + BOOST_GRAPH_EVENT_STUB(on_finish_vertex,bfs) + + protected: + Visitors m_vis; + }; + template + bfs_visitor + make_bfs_visitor(Visitors vis) { + return bfs_visitor(vis); + } + typedef bfs_visitor<> default_bfs_visitor; + + + namespace detail { + + template + void bfs_helper + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + const bgl_named_params& params) + { + typedef graph_traits Traits; + // Buffer default + typedef typename Traits::vertex_descriptor Vertex; + typedef boost::queue queue_t; + queue_t Q; + detail::wrap_ref Qref(Q); + breadth_first_search + (g, s, + choose_param(get_param(params, buffer_param_t()), Qref).ref, + vis, color); + } + + //------------------------------------------------------------------------- + // Choose between default color and color parameters. Using + // function dispatching so that we don't require vertex index if + // the color default is not being used. + + template + struct bfs_dispatch { + template + static void apply + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params, + ColorMap color) + { + bfs_helper + (g, s, color, + choose_param(get_param(params, graph_visitor), + make_bfs_visitor(null_visitor())), + params); + } + }; + + template <> + struct bfs_dispatch { + template + static void apply + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params, + detail::error_property_not_found) + { + std::vector color_vec(num_vertices(g)); + default_color_type c = white_color; + null_visitor null_vis; + + bfs_helper + (g, s, + make_iterator_property_map + (color_vec.begin(), + choose_const_pmap(get_param(params, vertex_index), + g, vertex_index), c), + choose_param(get_param(params, graph_visitor), + make_bfs_visitor(null_vis)), + params); + } + }; + + } // namespace detail + + + // Named Parameter Variant + template + void breadth_first_search + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params) + { + // The graph is passed by *const* reference so that graph adaptors + // (temporaries) can be passed into this function. However, the + // graph is not really const since we may write to property maps + // of the graph. + VertexListGraph& ng = const_cast(g); + typedef typename property_value< bgl_named_params, + vertex_color_t>::type C; + detail::bfs_dispatch::apply(ng, s, params, + get_param(params, vertex_color)); + } + + + // This version does not initialize colors, user has to. + + template + void breadth_first_visit + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params) + { + // The graph is passed by *const* reference so that graph adaptors + // (temporaries) can be passed into this function. However, the + // graph is not really const since we may write to property maps + // of the graph. + IncidenceGraph& ng = const_cast(g); + + typedef graph_traits Traits; + // Buffer default + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef boost::queue queue_t; + queue_t Q; + detail::wrap_ref Qref(Q); + + breadth_first_visit + (ng, s, + choose_param(get_param(params, buffer_param_t()), Qref).ref, + choose_param(get_param(params, graph_visitor), + make_bfs_visitor(null_visitor())), + choose_pmap(get_param(params, vertex_color), ng, vertex_color) + ); + } + +} // namespace boost + +#endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/chrobak_payne_drawing.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/chrobak_payne_drawing.hpp new file mode 100644 index 0000000000..6fb7b56d91 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/chrobak_payne_drawing.hpp @@ -0,0 +1,270 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __CHROBAK_PAYNE_DRAWING_HPP__ +#define __CHROBAK_PAYNE_DRAWING_HPP__ + +#include +#include +#include +#include //for next and prior +#include +#include + + +namespace boost +{ + + namespace graph { namespace detail + { + + template + void accumulate_offsets(typename graph_traits::vertex_descriptor v, + std::size_t offset, + const Graph& g, + VertexTo1DCoordMap x, + VertexTo1DCoordMap delta_x, + VertexToVertexMap left, + VertexToVertexMap right) + { + if (v != graph_traits::null_vertex()) + { + x[v] += delta_x[v] + offset; + accumulate_offsets(left[v], x[v], g, x, delta_x, left, right); + accumulate_offsets(right[v], x[v], g, x, delta_x, left, right); + } + } + + } /*namespace detail*/ } /*namespace graph*/ + + + + + + template + void chrobak_payne_straight_line_drawing(const Graph& g, + PlanarEmbedding embedding, + ForwardIterator ordering_begin, + ForwardIterator ordering_end, + GridPositionMap drawing, + VertexIndexMap vm + ) + { + + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename PlanarEmbedding::value_type::const_iterator + edge_permutation_iterator_t; + typedef typename graph_traits::vertices_size_type v_size_t; + typedef std::vector vertex_vector_t; + typedef std::vector vsize_vector_t; + typedef std::vector bool_vector_t; + typedef boost::iterator_property_map + + vertex_to_vertex_map_t; + typedef boost::iterator_property_map + + vertex_to_vsize_map_t; + typedef boost::iterator_property_map + + vertex_to_bool_map_t; + + vertex_vector_t left_vector(num_vertices(g), + graph_traits::null_vertex() + ); + vertex_vector_t right_vector(num_vertices(g), + graph_traits::null_vertex() + ); + vsize_vector_t seen_as_right_vector(num_vertices(g), 0); + vsize_vector_t seen_vector(num_vertices(g), 0); + vsize_vector_t delta_x_vector(num_vertices(g),0); + vsize_vector_t y_vector(num_vertices(g)); + vsize_vector_t x_vector(num_vertices(g),0); + bool_vector_t installed_vector(num_vertices(g),false); + + vertex_to_vertex_map_t left(left_vector.begin(), vm); + vertex_to_vertex_map_t right(right_vector.begin(), vm); + vertex_to_vsize_map_t seen_as_right(seen_as_right_vector.begin(), vm); + vertex_to_vsize_map_t seen(seen_vector.begin(), vm); + vertex_to_vsize_map_t delta_x(delta_x_vector.begin(), vm); + vertex_to_vsize_map_t y(y_vector.begin(), vm); + vertex_to_vsize_map_t x(x_vector.begin(), vm); + vertex_to_bool_map_t installed(installed_vector.begin(), vm); + + v_size_t timestamp = 1; + vertex_vector_t installed_neighbors; + + ForwardIterator itr = ordering_begin; + vertex_t v1 = *itr; ++itr; + vertex_t v2 = *itr; ++itr; + vertex_t v3 = *itr; ++itr; + + delta_x[v2] = 1; + delta_x[v3] = 1; + + y[v1] = 0; + y[v2] = 0; + y[v3] = 1; + + right[v1] = v3; + right[v3] = v2; + + installed[v1] = installed[v2] = installed[v3] = true; + + for(ForwardIterator itr_end = ordering_end; itr != itr_end; ++itr) + { + vertex_t v = *itr; + + // First, find the leftmost and rightmost neighbor of v on the outer + // cycle of the embedding. + // Note: since we're moving clockwise through the edges adjacent to v, + // we're actually moving from right to left among v's neighbors on the + // outer face (since v will be installed above them all) looking for + // the leftmost and rightmost installed neigbhors + + vertex_t leftmost = graph_traits::null_vertex(); + vertex_t rightmost = graph_traits::null_vertex(); + + installed_neighbors.clear(); + + vertex_t prev_vertex = graph_traits::null_vertex(); + edge_permutation_iterator_t pi, pi_end; + pi_end = embedding[v].end(); + for(pi = embedding[v].begin(); pi != pi_end; ++pi) + { + vertex_t curr_vertex = source(*pi,g) == v ? + target(*pi,g) : source(*pi,g); + + // Skip any self-loops or parallel edges + if (curr_vertex == v || curr_vertex == prev_vertex) + continue; + + if (installed[curr_vertex]) + { + seen[curr_vertex] = timestamp; + + if (right[curr_vertex] != graph_traits::null_vertex()) + { + seen_as_right[right[curr_vertex]] = timestamp; + } + installed_neighbors.push_back(curr_vertex); + } + + prev_vertex = curr_vertex; + } + + typename vertex_vector_t::iterator vi, vi_end; + vi_end = installed_neighbors.end(); + for(vi = installed_neighbors.begin(); vi != vi_end; ++vi) + { + if (right[*vi] == graph_traits::null_vertex() || + seen[right[*vi]] != timestamp + ) + rightmost = *vi; + if (seen_as_right[*vi] != timestamp) + leftmost = *vi; + } + + ++timestamp; + + //stretch gaps + ++delta_x[right[leftmost]]; + ++delta_x[rightmost]; + + //adjust offsets + std::size_t delta_p_q = 0; + vertex_t stopping_vertex = right[rightmost]; + for(vertex_t temp = right[leftmost]; temp != stopping_vertex; + temp = right[temp] + ) + { + delta_p_q += delta_x[temp]; + } + + delta_x[v] = (y[rightmost] - y[leftmost] + delta_p_q)/2; + y[v] = (y[rightmost] + y[leftmost] + delta_p_q)/2; + delta_x[rightmost] = delta_p_q - delta_x[v]; + + bool leftmost_and_rightmost_adjacent = right[leftmost] == rightmost; + if (!leftmost_and_rightmost_adjacent) + delta_x[right[leftmost]] -= delta_x[v]; + + //install v + if (!leftmost_and_rightmost_adjacent) + { + left[v] = right[leftmost]; + vertex_t next_to_rightmost; + for(vertex_t temp = leftmost; temp != rightmost; + temp = right[temp] + ) + { + next_to_rightmost = temp; + } + + right[next_to_rightmost] = graph_traits::null_vertex(); + } + else + { + left[v] = graph_traits::null_vertex(); + } + + right[leftmost] = v; + right[v] = rightmost; + installed[v] = true; + + } + + graph::detail::accumulate_offsets + (*ordering_begin,0,g,x,delta_x,left,right); + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + drawing[v].x = x[v]; + drawing[v].y = y[v]; + } + + } + + + + + template + inline void chrobak_payne_straight_line_drawing(const Graph& g, + PlanarEmbedding embedding, + ForwardIterator ord_begin, + ForwardIterator ord_end, + GridPositionMap drawing + ) + { + chrobak_payne_straight_line_drawing(g, + embedding, + ord_begin, + ord_end, + drawing, + get(vertex_index,g) + ); + } + + + + +} // namespace boost + +#endif //__CHROBAK_PAYNE_DRAWING_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/circle_layout.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/circle_layout.hpp new file mode 100644 index 0000000000..26387d14f5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/circle_layout.hpp @@ -0,0 +1,55 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_CIRCLE_LAYOUT_HPP +#define BOOST_GRAPH_CIRCLE_LAYOUT_HPP +#include +#include +#include + +namespace boost { + /** + * \brief Layout the graph with the vertices at the points of a regular + * n-polygon. + * + * The distance from the center of the polygon to each point is + * determined by the @p radius parameter. The @p position parameter + * must be an Lvalue Property Map whose value type is a class type + * containing @c x and @c y members that will be set to the @c x and + * @c y coordinates. + */ + template + void + circle_graph_layout(const VertexListGraph& g, PositionMap position, + Radius radius) + { + const double pi = 3.14159; + +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sin; + using std::cos; +#endif // BOOST_NO_STDC_NAMESPACE + + typedef typename graph_traits::vertices_size_type + vertices_size_type; + + vertices_size_type n = num_vertices(g); + + typedef typename graph_traits::vertex_iterator + vertex_iterator; + + vertices_size_type i = 0; + for(std::pair v = vertices(g); + v.first != v.second; ++v.first, ++i) { + position[*v.first].x = radius * cos(i * 2 * pi / n); + position[*v.first].y = radius * sin(i * 2 * pi / n); + } + } +} // end namespace boost + +#endif // BOOST_GRAPH_CIRCLE_LAYOUT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/compressed_sparse_row_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/compressed_sparse_row_graph.hpp new file mode 100644 index 0000000000..d093b6a57c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/compressed_sparse_row_graph.hpp @@ -0,0 +1,801 @@ +// Copyright 2005-2006 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine + +// Compressed sparse row graph type + +#ifndef BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP +#define BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_GRAPH_NO_BUNDLED_PROPERTIES +# error The Compressed Sparse Row graph only supports bundled properties. +# error You will need a compiler that conforms better to the C++ standard. +#endif + +namespace boost { + +// A tag type indicating that the graph in question is a compressed +// sparse row graph. This is an internal detail of the BGL. +struct csr_graph_tag; + +/**************************************************************************** + * Local helper macros to reduce typing and clutter later on. * + ****************************************************************************/ +#define BOOST_CSR_GRAPH_TEMPLATE_PARMS \ + typename Directed, typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename Vertex, typename EdgeIndex +#define BOOST_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph + +// Forward declaration of CSR edge descriptor type, needed to pass to +// indexed_edge_properties. +template +class csr_edge_descriptor; + +/** Compressed sparse row graph. + * + * Vertex and EdgeIndex should be unsigned integral types and should + * specialize numeric_limits. + */ +template +class compressed_sparse_row_graph + : public detail::indexed_vertex_properties, + public detail::indexed_edge_properties > + +{ + typedef detail::indexed_vertex_properties + inherited_vertex_properties; + + typedef detail::indexed_edge_properties > + inherited_edge_properties; + + public: + // For Property Graph + typedef GraphProperty graph_property_type; + + protected: + template + void + maybe_reserve_edge_list_storage(InputIterator, InputIterator, + std::input_iterator_tag) + { + // Do nothing: we have no idea how much storage to reserve. + } + + template + void + maybe_reserve_edge_list_storage(InputIterator first, InputIterator last, + std::forward_iterator_tag) + { + using std::distance; + typename std::iterator_traits::difference_type n = + distance(first, last); + m_column.reserve(n); + inherited_edge_properties::reserve(n); + } + + public: + /* At this time, the compressed sparse row graph can only be used to + * create a directed graph. In the future, bidirectional and + * undirected CSR graphs will also be supported. + */ + BOOST_STATIC_ASSERT((is_same::value)); + + // Concept requirements: + // For Graph + typedef Vertex vertex_descriptor; + typedef csr_edge_descriptor edge_descriptor; + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + + class traversal_category: public incidence_graph_tag, + public adjacency_graph_tag, + public vertex_list_graph_tag, + public edge_list_graph_tag {}; + + static vertex_descriptor null_vertex() { return vertex_descriptor(-1); } + + // For VertexListGraph + typedef counting_iterator vertex_iterator; + typedef Vertex vertices_size_type; + + // For EdgeListGraph + typedef EdgeIndex edges_size_type; + + // For IncidenceGraph + class out_edge_iterator; + typedef EdgeIndex degree_size_type; + + // For AdjacencyGraph + typedef typename std::vector::const_iterator adjacency_iterator; + + // For EdgeListGraph + class edge_iterator; + + // For BidirectionalGraph (not implemented) + typedef void in_edge_iterator; + + // For internal use + typedef csr_graph_tag graph_tag; + + // Constructors + + // Default constructor: an empty graph. + compressed_sparse_row_graph() + : m_rowstart(1, EdgeIndex(0)), m_column(0), m_property(), + m_last_source(0) {} + + // From number of vertices and sorted list of edges + template + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges = 0, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_rowstart(numverts + 1), + m_column(0), m_property(prop), m_last_source(numverts) + { + // Reserving storage in advance can save us lots of time and + // memory, but it can only be done if we have forward iterators or + // the user has supplied the number of edges. + if (numedges == 0) { + typedef typename std::iterator_traits::iterator_category + category; + maybe_reserve_edge_list_storage(edge_begin, edge_end, category()); + } else { + m_column.reserve(numedges); + } + + EdgeIndex current_edge = 0; + Vertex current_vertex_plus_one = 1; + m_rowstart[0] = 0; + for (InputIterator ei = edge_begin; ei != edge_end; ++ei) { + Vertex src = ei->first; + Vertex tgt = ei->second; + for (; current_vertex_plus_one != src + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + m_column.push_back(tgt); + ++current_edge; + } + + // The remaining vertices have no edges + for (; current_vertex_plus_one != numverts + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + + // Default-construct properties for edges + inherited_edge_properties::resize(m_column.size()); + } + + // From number of vertices and sorted list of edges + template + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + edges_size_type numedges = 0, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_rowstart(numverts + 1), + m_column(0), m_property(prop), m_last_source(numverts) + { + // Reserving storage in advance can save us lots of time and + // memory, but it can only be done if we have forward iterators or + // the user has supplied the number of edges. + if (numedges == 0) { + typedef typename std::iterator_traits::iterator_category + category; + maybe_reserve_edge_list_storage(edge_begin, edge_end, category()); + } else { + m_column.reserve(numedges); + } + + EdgeIndex current_edge = 0; + Vertex current_vertex_plus_one = 1; + m_rowstart[0] = 0; + for (InputIterator ei = edge_begin; ei != edge_end; ++ei, ++ep_iter) { + Vertex src = ei->first; + Vertex tgt = ei->second; + for (; current_vertex_plus_one != src + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + m_column.push_back(tgt); + inherited_edge_properties::push_back(*ep_iter); + ++current_edge; + } + + // The remaining vertices have no edges + for (; current_vertex_plus_one != numverts + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + } + + // Requires IncidenceGraph, a vertex index map, and a vertex(n, g) function + template + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, + edges_size_type numedges) + : m_property(), m_last_source(0) + { + assign(g, vi, numverts, numedges); + } + + // Requires VertexListGraph and EdgeListGraph + template + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi) + : m_property(), m_last_source(0) + { + assign(g, vi, num_vertices(g), num_edges(g)); + } + + // Requires vertex index map plus requirements of previous constructor + template + explicit compressed_sparse_row_graph(const Graph& g) + : m_property(), m_last_source(0) + { + assign(g, get(vertex_index, g), num_vertices(g), num_edges(g)); + } + + // From any graph (slow and uses a lot of memory) + // Requires IncidenceGraph, a vertex index map, and a vertex(n, g) function + // Internal helper function + template + void + assign(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, edges_size_type numedges) + { + inherited_vertex_properties::resize(numverts); + m_rowstart.resize(numverts + 1); + m_column.resize(numedges); + EdgeIndex current_edge = 0; + typedef typename boost::graph_traits::vertex_descriptor g_vertex; + typedef typename boost::graph_traits::edge_descriptor g_edge; + typedef typename boost::graph_traits::out_edge_iterator + g_out_edge_iter; + + for (Vertex i = 0; i != numverts; ++i) { + m_rowstart[i] = current_edge; + g_vertex v = vertex(i, g); + EdgeIndex num_edges_before_this_vertex = current_edge; + g_out_edge_iter ei, ei_end; + for (tie(ei, ei_end) = out_edges(v, g); ei != ei_end; ++ei) { + m_column[current_edge++] = get(vi, target(*ei, g)); + } + std::sort(m_column.begin() + num_edges_before_this_vertex, + m_column.begin() + current_edge); + } + m_rowstart[numverts] = current_edge; + m_last_source = numverts; + } + + // Requires the above, plus VertexListGraph and EdgeListGraph + template + void assign(const Graph& g, const VertexIndexMap& vi) + { + assign(g, vi, num_vertices(g), num_edges(g)); + } + + // Requires the above, plus a vertex_index map. + template + void assign(const Graph& g) + { + assign(g, get(vertex_index, g), num_vertices(g), num_edges(g)); + } + + using inherited_vertex_properties::operator[]; + using inherited_edge_properties::operator[]; + + // private: non-portable, requires friend templates + inherited_vertex_properties& vertex_properties() {return *this;} + const inherited_vertex_properties& vertex_properties() const {return *this;} + inherited_edge_properties& edge_properties() { return *this; } + const inherited_edge_properties& edge_properties() const { return *this; } + + std::vector m_rowstart; + std::vector m_column; + GraphProperty m_property; + Vertex m_last_source; // Last source of added edge, plus one +}; + +template +class csr_edge_descriptor +{ + public: + Vertex src; + EdgeIndex idx; + + csr_edge_descriptor(Vertex src, EdgeIndex idx): src(src), idx(idx) {} + csr_edge_descriptor(): src(0), idx(0) {} + + bool operator==(const csr_edge_descriptor& e) const {return idx == e.idx;} + bool operator!=(const csr_edge_descriptor& e) const {return idx != e.idx;} + bool operator<(const csr_edge_descriptor& e) const {return idx < e.idx;} + bool operator>(const csr_edge_descriptor& e) const {return idx > e.idx;} + bool operator<=(const csr_edge_descriptor& e) const {return idx <= e.idx;} + bool operator>=(const csr_edge_descriptor& e) const {return idx >= e.idx;} +}; + +// Construction functions +template +inline Vertex +add_vertex(BOOST_CSR_GRAPH_TYPE& g) { + Vertex old_num_verts_plus_one = g.m_rowstart.size(); + g.m_rowstart.push_back(EdgeIndex(0)); + g.vertex_properties().resize(num_vertices(g)); + return old_num_verts_plus_one - 1; +} + +template +inline Vertex +add_vertices(typename BOOST_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_CSR_GRAPH_TYPE& g) { + Vertex old_num_verts_plus_one = g.m_rowstart.size(); + g.m_rowstart.resize(old_num_verts_plus_one + count, EdgeIndex(0)); + g.vertex_properties().resize(num_vertices(g)); + return old_num_verts_plus_one - 1; +} + +// This function requires that (src, tgt) be lexicographically at least as +// large as the largest edge in the graph so far +template +inline typename BOOST_CSR_GRAPH_TYPE::edge_descriptor +add_edge(Vertex src, Vertex tgt, BOOST_CSR_GRAPH_TYPE& g) { + assert ((g.m_last_source == 0 || src >= g.m_last_source - 1) && + src < num_vertices(g)); + EdgeIndex num_edges_orig = g.m_column.size(); + for (; g.m_last_source <= src; ++g.m_last_source) + g.m_rowstart[g.m_last_source] = num_edges_orig; + g.m_rowstart[src + 1] = num_edges_orig + 1; + g.m_column.push_back(tgt); + typedef typename BOOST_CSR_GRAPH_TYPE::edge_push_back_type push_back_type; + g.edge_properties().push_back(push_back_type()); + return typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(src, num_edges_orig); +} + +// This function requires that (src, tgt) be lexicographically at least as +// large as the largest edge in the graph so far +template +inline typename BOOST_CSR_GRAPH_TYPE::edge_descriptor +add_edge(Vertex src, Vertex tgt, + typename BOOST_CSR_GRAPH_TYPE::edge_bundled const& p, + BOOST_CSR_GRAPH_TYPE& g) { + assert ((g.m_last_source == 0 || src >= g.m_last_source - 1) && + src < num_vertices(g)); + EdgeIndex num_edges_orig = g.m_column.size(); + for (; g.m_last_source <= src; ++g.m_last_source) + g.m_rowstart[g.m_last_source] = num_edges_orig; + g.m_rowstart[src + 1] = num_edges_orig + 1; + g.m_column.push_back(tgt); + g.edge_properties().push_back(p); + return typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(src, num_edges_orig); +} + + +// From VertexListGraph +template +inline Vertex +num_vertices(const BOOST_CSR_GRAPH_TYPE& g) { + return g.m_rowstart.size() - 1; +} + +template +std::pair, counting_iterator > +inline vertices(const BOOST_CSR_GRAPH_TYPE& g) { + return std::make_pair(counting_iterator(0), + counting_iterator(num_vertices(g))); +} + +// From IncidenceGraph +template +class BOOST_CSR_GRAPH_TYPE::out_edge_iterator + : public iterator_facade::fast> +{ + public: + typedef typename int_t::fast difference_type; + + out_edge_iterator() {} + // Implicit copy constructor OK + explicit out_edge_iterator(edge_descriptor edge) : m_edge(edge) { } + + private: + // iterator_facade requirements + const edge_descriptor& dereference() const { return m_edge; } + + bool equal(const out_edge_iterator& other) const + { return m_edge == other.m_edge; } + + void increment() { ++m_edge.idx; } + void decrement() { ++m_edge.idx; } + void advance(difference_type n) { m_edge.idx += n; } + + difference_type distance_to(const out_edge_iterator& other) const + { return other.m_edge.idx - m_edge.idx; } + + edge_descriptor m_edge; + + friend class iterator_core_access; +}; + +template +inline Vertex +source(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_CSR_GRAPH_TYPE&) +{ + return e.src; +} + +template +inline Vertex +target(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_CSR_GRAPH_TYPE& g) +{ + return g.m_column[e.idx]; +} + +template +inline std::pair +out_edges(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_CSR_GRAPH_TYPE::edge_descriptor ed; + typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator it; + EdgeIndex v_row_start = g.m_rowstart[v]; + EdgeIndex next_row_start = g.m_rowstart[v + 1]; + return std::make_pair(it(ed(v, v_row_start)), + it(ed(v, (std::max)(v_row_start, next_row_start)))); +} + +template +inline EdgeIndex +out_degree(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) +{ + EdgeIndex v_row_start = g.m_rowstart[v]; + EdgeIndex next_row_start = g.m_rowstart[v + 1]; + return (std::max)(v_row_start, next_row_start) - v_row_start; +} + +// From AdjacencyGraph +template +inline std::pair +adjacent_vertices(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) +{ + EdgeIndex v_row_start = g.m_rowstart[v]; + EdgeIndex next_row_start = g.m_rowstart[v + 1]; + return std::make_pair(g.m_column.begin() + v_row_start, + g.m_column.begin() + + (std::max)(v_row_start, next_row_start)); +} + +// Extra, common functions +template +inline typename graph_traits::vertex_descriptor +vertex(typename graph_traits::vertex_descriptor i, + const BOOST_CSR_GRAPH_TYPE&) +{ + return i; +} + +// Unlike for an adjacency_matrix, edge_range and edge take lg(out_degree(i)) +// time +template +inline std::pair +edge_range(Vertex i, Vertex j, const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename std::vector::const_iterator adj_iter; + typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; + typedef typename BOOST_CSR_GRAPH_TYPE::edge_descriptor edge_desc; + std::pair raw_adjacencies = adjacent_vertices(i, g); + std::pair adjacencies = + std::equal_range(raw_adjacencies.first, raw_adjacencies.second, j); + EdgeIndex idx_begin = adjacencies.first - g.m_column.begin(); + EdgeIndex idx_end = adjacencies.second - g.m_column.begin(); + return std::make_pair(out_edge_iter(edge_desc(i, idx_begin)), + out_edge_iter(edge_desc(i, idx_end))); +} + +template +inline std::pair +edge(Vertex i, Vertex j, const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; + std::pair range = edge_range(i, j, g); + if (range.first == range.second) + return std::make_pair(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(), + false); + else + return std::make_pair(*range.first, true); +} + +// Find an edge given its index in the graph +template +inline typename BOOST_CSR_GRAPH_TYPE::edge_descriptor +edge_from_index(EdgeIndex idx, const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename std::vector::const_iterator row_start_iter; + assert (idx < num_edges(g)); + row_start_iter src_plus_1 = + std::upper_bound(g.m_rowstart.begin(), + g.m_rowstart.begin() + g.m_last_source + 1, + idx); + // Get last source whose rowstart is at most idx + // upper_bound returns this position plus 1 + Vertex src = (src_plus_1 - g.m_rowstart.begin()) - 1; + return typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(src, idx); +} + +// From EdgeListGraph +template +class BOOST_CSR_GRAPH_TYPE::edge_iterator +{ + public: + typedef std::forward_iterator_tag iterator_category; + typedef edge_descriptor value_type; + + typedef const edge_descriptor* pointer; + + typedef edge_descriptor reference; + typedef typename int_t::fast difference_type; + + edge_iterator() : rowstart_array(0), current_edge(), end_of_this_vertex(0) {} + + edge_iterator(const compressed_sparse_row_graph& graph, + edge_descriptor current_edge, + EdgeIndex end_of_this_vertex) + : rowstart_array(&graph.m_rowstart[0]), current_edge(current_edge), + end_of_this_vertex(end_of_this_vertex) {} + + // From InputIterator + reference operator*() const { return current_edge; } + pointer operator->() const { return ¤t_edge; } + + bool operator==(const edge_iterator& o) const { + return current_edge == o.current_edge; + } + bool operator!=(const edge_iterator& o) const { + return current_edge != o.current_edge; + } + + edge_iterator& operator++() { + ++current_edge.idx; + while (current_edge.idx == end_of_this_vertex) { + ++current_edge.src; + end_of_this_vertex = rowstart_array[current_edge.src + 1]; + } + return *this; + } + + edge_iterator operator++(int) { + edge_iterator temp = *this; + ++*this; + return temp; + } + + private: + const EdgeIndex* rowstart_array; + edge_descriptor current_edge; + EdgeIndex end_of_this_vertex; +}; + +template +inline EdgeIndex +num_edges(const BOOST_CSR_GRAPH_TYPE& g) +{ + return g.m_column.size(); +} + +template +std::pair +edges(const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_CSR_GRAPH_TYPE::edge_iterator ei; + typedef typename BOOST_CSR_GRAPH_TYPE::edge_descriptor edgedesc; + if (g.m_rowstart.size() == 1 || g.m_column.empty()) { + return std::make_pair(ei(), ei()); + } else { + // Find the first vertex that has outgoing edges + Vertex src = 0; + while (g.m_rowstart[src + 1] == 0) ++src; + return std::make_pair(ei(g, edgedesc(src, 0), g.m_rowstart[src + 1]), + ei(g, edgedesc(num_vertices(g), g.m_column.size()), 0)); + } +} + +// For Property Graph + +// Graph properties +template +inline void +set_property(BOOST_CSR_GRAPH_TYPE& g, Tag, const Value& value) +{ + get_property_value(g.m_property, Tag()) = value; +} + +template +inline +typename graph_property::type& +get_property(BOOST_CSR_GRAPH_TYPE& g, Tag) +{ + return get_property_value(g.m_property, Tag()); +} + +template +inline +const +typename graph_property::type& +get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag) +{ + return get_property_value(g.m_property, Tag()); +} + +// Add edge_index property map +template +struct csr_edge_index_map +{ + typedef Index value_type; + typedef Index reference; + typedef Descriptor key_type; + typedef readable_property_map_tag category; +}; + +template +inline Index +get(const csr_edge_index_map&, + const typename csr_edge_index_map::key_type& key) +{ + return key.idx; +} + +// Doing the right thing here (by unifying with vertex_index_t and +// edge_index_t) breaks GCC. +template +struct property_map +{ +private: + typedef identity_property_map vertex_index_type; + typedef typename graph_traits::edge_descriptor + edge_descriptor; + typedef csr_edge_index_map edge_index_type; + + typedef typename mpl::if_, + edge_index_type, + detail::error_property_not_found>::type + edge_or_none; + +public: + typedef typename mpl::if_, + vertex_index_type, + edge_or_none>::type type; + + typedef type const_type; +}; + +template +inline identity_property_map +get(vertex_index_t, const BOOST_CSR_GRAPH_TYPE&) +{ + return identity_property_map(); +} + +template +inline Vertex +get(vertex_index_t, + const BOOST_CSR_GRAPH_TYPE&, Vertex v) +{ + return v; +} + +template +inline typename property_map::const_type +get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&) +{ + typedef typename property_map::const_type + result_type; + return result_type(); +} + +template +inline EdgeIndex +get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&, + typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e) +{ + return e.idx; +} + +// Support for bundled properties +template +struct property_map +{ +private: + typedef graph_traits traits; + typedef VertexProperty vertex_bundled; + typedef EdgeProperty edge_bundled; + typedef typename mpl::if_c<(detail::is_vertex_bundle::value), + typename traits::vertex_descriptor, + typename traits::edge_descriptor>::type + descriptor; + +public: + typedef bundle_property_map + type; + typedef bundle_property_map const_type; +}; + +template +inline +typename property_map::type +get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map::type + result_type; + return result_type(&g, p); +} + +template +inline +typename property_map::const_type +get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g) +{ + typedef typename property_map::const_type + result_type; + return result_type(&g, p); +} + +template +inline T +get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g, + const Key& key) +{ + return get(get(p, g), key); +} + +template +inline void +put(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g, + const Key& key, const T& value) +{ + put(get(p, g), key, value); +} + +#undef BOOST_CSR_GRAPH_TYPE +#undef BOOST_CSR_GRAPH_TEMPLATE_PARMS + +} // end namespace boost + +#endif // BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/connected_components.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/connected_components.hpp new file mode 100644 index 0000000000..df9084ce36 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/connected_components.hpp @@ -0,0 +1,101 @@ +// +//======================================================================= +// Copyright 1997-2001 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_CONNECTED_COMPONENTS_HPP +#define BOOST_GRAPH_CONNECTED_COMPONENTS_HPP + +#include +#include +#include +#include + +#include + +namespace boost { + + namespace detail { + + // This visitor is used both in the connected_components algorithm + // and in the kosaraju strong components algorithm during the + // second DFS traversal. + template + class components_recorder : public dfs_visitor<> + { + typedef typename property_traits::value_type comp_type; + public: + components_recorder(ComponentsMap c, + comp_type& c_count) + : m_component(c), m_count(c_count) {} + + template + void start_vertex(Vertex, Graph&) { + if (m_count == (std::numeric_limits::max)()) + m_count = 0; // start counting components at zero + else + ++m_count; + } + template + void discover_vertex(Vertex u, Graph&) { + put(m_component, u, m_count); + } + protected: + ComponentsMap m_component; + comp_type& m_count; + }; + + } // namespace detail + + // This function computes the connected components of an undirected + // graph using a single application of depth first search. + + template + inline typename property_traits::value_type + connected_components(const Graph& g, ComponentMap c, + const bgl_named_params& params) + { + if (num_vertices(g) == 0) return 0; + + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< WritablePropertyMapConcept >(); + typedef typename boost::graph_traits::directed_category directed; + BOOST_STATIC_ASSERT((boost::is_same::value)); + + typedef typename property_traits::value_type comp_type; + // c_count initialized to "nil" (with nil represented by (max)()) + comp_type c_count((std::numeric_limits::max)()); + detail::components_recorder vis(c, c_count); + depth_first_search(g, params.visitor(vis)); + return c_count + 1; + } + + template + inline typename property_traits::value_type + connected_components(const Graph& g, ComponentMap c) + { + if (num_vertices(g) == 0) return 0; + + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< WritablePropertyMapConcept >(); + typedef typename boost::graph_traits::directed_category directed; + BOOST_STATIC_ASSERT((boost::is_same::value)); + + typedef typename property_traits::value_type comp_type; + // c_count initialized to "nil" (with nil represented by (max)()) + comp_type c_count((std::numeric_limits::max)()); + detail::components_recorder vis(c, c_count); + depth_first_search(g, visitor(vis)); + return c_count + 1; + } + + +} // namespace boost + + +#endif // BOOST_GRAPH_CONNECTED_COMPONENTS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/copy.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/copy.hpp new file mode 100644 index 0000000000..fd98a426a4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/copy.hpp @@ -0,0 +1,450 @@ +// +//======================================================================= +// Copyright 1997-2001 University of Notre Dame. +// Authors: Jeremy G. Siek, Lie-Quan Lee, Andrew Lumsdaine +// +// 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 file implements the following functions: + + + template + void copy_graph(const VertexListGraph& g_in, MutableGraph& g_out) + + template + void copy_graph(const VertexListGraph& g_in, MutableGraph& g_out, + const bgl_named_params& params) + + + template + typename graph_traits::vertex_descriptor + copy_component(IncidenceGraph& g_in, + typename graph_traits::vertex_descriptor src, + MutableGraph& g_out) + + template + typename graph_traits::vertex_descriptor + copy_component(IncidenceGraph& g_in, + typename graph_traits::vertex_descriptor src, + MutableGraph& g_out, + const bgl_named_params& params) + */ + + +#ifndef BOOST_GRAPH_COPY_HPP +#define BOOST_GRAPH_COPY_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + namespace detail { + + // Default edge and vertex property copiers + + template + struct edge_copier { + edge_copier(const Graph1& g1, Graph2& g2) + : edge_all_map1(get(edge_all, g1)), + edge_all_map2(get(edge_all, g2)) { } + + template + void operator()(const Edge1& e1, Edge2& e2) const { + put(edge_all_map2, e2, get(edge_all_map1, e1)); + } + typename property_map::const_type edge_all_map1; + mutable typename property_map::type edge_all_map2; + }; + template + inline edge_copier + make_edge_copier(const Graph1& g1, Graph2& g2) + { + return edge_copier(g1, g2); + } + + template + struct vertex_copier { + vertex_copier(const Graph1& g1, Graph2& g2) + : vertex_all_map1(get(vertex_all, g1)), + vertex_all_map2(get(vertex_all, g2)) { } + + template + void operator()(const Vertex1& v1, Vertex2& v2) const { + put(vertex_all_map2, v2, get(vertex_all_map1, v1)); + } + typename property_map::const_type vertex_all_map1; + mutable typename property_map::type + vertex_all_map2; + }; + template + inline vertex_copier + make_vertex_copier(const Graph1& g1, Graph2& g2) + { + return vertex_copier(g1, g2); + } + + // Copy all the vertices and edges of graph g_in into graph g_out. + // The copy_vertex and copy_edge function objects control how vertex + // and edge properties are copied. + + template + struct copy_graph_impl { }; + + template <> struct copy_graph_impl<0> + { + template + static void apply(const Graph& g_in, MutableGraph& g_out, + CopyVertex copy_vertex, CopyEdge copy_edge, + Orig2CopyVertexIndexMap orig2copy, IndexMap) + { + typename graph_traits::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g_in); vi != vi_end; ++vi) { + typename graph_traits::vertex_descriptor + new_v = add_vertex(g_out); + put(orig2copy, *vi, new_v); + copy_vertex(*vi, new_v); + } + typename graph_traits::edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(g_in); ei != ei_end; ++ei) { + typename graph_traits::edge_descriptor new_e; + bool inserted; + tie(new_e, inserted) = add_edge(get(orig2copy, source(*ei, g_in)), + get(orig2copy, target(*ei, g_in)), + g_out); + copy_edge(*ei, new_e); + } + } + }; + + // for directed graphs + template <> struct copy_graph_impl<1> + { + template + static void apply(const Graph& g_in, MutableGraph& g_out, + CopyVertex copy_vertex, CopyEdge copy_edge, + Orig2CopyVertexIndexMap orig2copy, IndexMap) + { + typename graph_traits::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g_in); vi != vi_end; ++vi) { + typename graph_traits::vertex_descriptor + new_v = add_vertex(g_out); + put(orig2copy, *vi, new_v); + copy_vertex(*vi, new_v); + } + for (tie(vi, vi_end) = vertices(g_in); vi != vi_end; ++vi) { + typename graph_traits::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(*vi, g_in); ei != ei_end; ++ei) { + typename graph_traits::edge_descriptor new_e; + bool inserted; + tie(new_e, inserted) = add_edge(get(orig2copy, source(*ei, g_in)), + get(orig2copy, target(*ei, g_in)), + g_out); + copy_edge(*ei, new_e); + } + } + } + }; + + // for undirected graphs + template <> struct copy_graph_impl<2> + { + template + static void apply(const Graph& g_in, MutableGraph& g_out, + CopyVertex copy_vertex, CopyEdge copy_edge, + Orig2CopyVertexIndexMap orig2copy, + IndexMap index_map) + { + typedef color_traits Color; + std::vector + color(num_vertices(g_in), Color::white()); + typename graph_traits::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g_in); vi != vi_end; ++vi) { + typename graph_traits::vertex_descriptor + new_v = add_vertex(g_out); + put(orig2copy, *vi, new_v); + copy_vertex(*vi, new_v); + } + for (tie(vi, vi_end) = vertices(g_in); vi != vi_end; ++vi) { + typename graph_traits::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(*vi, g_in); ei != ei_end; ++ei) { + typename graph_traits::edge_descriptor new_e; + bool inserted; + if (color[get(index_map, target(*ei, g_in))] == Color::white()) { + tie(new_e, inserted) = add_edge(get(orig2copy, source(*ei,g_in)), + get(orig2copy, target(*ei,g_in)), + g_out); + copy_edge(*ei, new_e); + } + } + color[get(index_map, *vi)] = Color::black(); + } + } + }; + + template + struct choose_graph_copy { + typedef typename Graph::traversal_category Trv; + typedef typename Graph::directed_category Dr; + enum { algo = + (is_convertible::value + && is_convertible::value) + ? 0 : is_convertible::value ? 1 : 2 }; + typedef copy_graph_impl type; + }; + + //------------------------------------------------------------------------- + struct choose_copier_parameter { + template + struct bind_ { + typedef const P& result_type; + static result_type apply(const P& p, const G1&, G2&) + { return p; } + }; + }; + struct choose_default_edge_copier { + template + struct bind_ { + typedef edge_copier result_type; + static result_type apply(const P&, const G1& g1, G2& g2) { + return result_type(g1, g2); + } + }; + }; + template + struct choose_edge_copy { + typedef choose_copier_parameter type; + }; + template <> + struct choose_edge_copy { + typedef choose_default_edge_copier type; + }; + template + struct choose_edge_copier_helper { + typedef typename choose_edge_copy::type Selector; + typedef typename Selector:: template bind_ Bind; + typedef Bind type; + typedef typename Bind::result_type result_type; + }; + template + typename detail::choose_edge_copier_helper::result_type + choose_edge_copier(const Param& params, const G1& g_in, G2& g_out) + { + typedef typename + detail::choose_edge_copier_helper::type Choice; + return Choice::apply(params, g_in, g_out); + } + + + struct choose_default_vertex_copier { + template + struct bind_ { + typedef vertex_copier result_type; + static result_type apply(const P&, const G1& g1, G2& g2) { + return result_type(g1, g2); + } + }; + }; + template + struct choose_vertex_copy { + typedef choose_copier_parameter type; + }; + template <> + struct choose_vertex_copy { + typedef choose_default_vertex_copier type; + }; + template + struct choose_vertex_copier_helper { + typedef typename choose_vertex_copy::type Selector; + typedef typename Selector:: template bind_ Bind; + typedef Bind type; + typedef typename Bind::result_type result_type; + }; + template + typename detail::choose_vertex_copier_helper::result_type + choose_vertex_copier(const Param& params, const G1& g_in, G2& g_out) + { + typedef typename + detail::choose_vertex_copier_helper::type Choice; + return Choice::apply(params, g_in, g_out); + } + + } // namespace detail + + + template + void copy_graph(const VertexListGraph& g_in, MutableGraph& g_out) + { + if (num_vertices(g_in) == 0) + return; + typedef typename graph_traits::vertex_descriptor vertex_t; + std::vector orig2copy(num_vertices(g_in)); + typedef typename detail::choose_graph_copy::type + copy_impl; + copy_impl::apply + (g_in, g_out, + detail::make_vertex_copier(g_in, g_out), + detail::make_edge_copier(g_in, g_out), + make_iterator_property_map(orig2copy.begin(), + get(vertex_index, g_in), orig2copy[0]), + get(vertex_index, g_in) + ); + } + + template + void copy_graph(const VertexListGraph& g_in, MutableGraph& g_out, + const bgl_named_params& params) + { + typename std::vector::size_type n; + n = is_default_param(get_param(params, orig_to_copy_t())) + ? num_vertices(g_in) : 1; + if (n == 0) + return; + std::vector::vertex_descriptor> + orig2copy(n); + + typedef typename detail::choose_graph_copy::type + copy_impl; + copy_impl::apply + (g_in, g_out, + detail::choose_vertex_copier(get_param(params, vertex_copy_t()), + g_in, g_out), + detail::choose_edge_copier(get_param(params, edge_copy_t()), + g_in, g_out), + choose_param(get_param(params, orig_to_copy_t()), + make_iterator_property_map + (orig2copy.begin(), + choose_const_pmap(get_param(params, vertex_index), + g_in, vertex_index), orig2copy[0])), + choose_const_pmap(get_param(params, vertex_index), g_in, vertex_index) + ); + } + + namespace detail { + + template + struct graph_copy_visitor : public bfs_visitor<> + { + graph_copy_visitor(NewGraph& graph, Copy2OrigIndexMap c, + CopyVertex cv, CopyEdge ce) + : g_out(graph), orig2copy(c), copy_vertex(cv), copy_edge(ce) { } + + template + void examine_vertex(Vertex u, const Graph& g_in) const { + typename graph_traits::vertex_descriptor + new_u = add_vertex(g_out); + put(orig2copy, u, new_u); + copy_vertex(u, new_u); + } + + template + void examine_edge(Edge e, const Graph& g_in) const { + typename graph_traits::edge_descriptor new_e; + bool inserted; + tie(new_e, inserted) = add_edge(get(orig2copy, source(e, g_in)), + get(orig2copy, target(e, g_in)), + g_out); + copy_edge(e, new_e); + } + private: + NewGraph& g_out; + Copy2OrigIndexMap orig2copy; + CopyVertex copy_vertex; + CopyEdge copy_edge; + }; + + template + typename graph_traits::vertex_descriptor + copy_component_impl + (const Graph& g_in, + typename graph_traits::vertex_descriptor src, + MutableGraph& g_out, + CopyVertex copy_vertex, CopyEdge copy_edge, + Orig2CopyVertexIndexMap orig2copy, + const Params& params) + { + graph_copy_visitor vis(g_out, orig2copy, copy_vertex, copy_edge); + breadth_first_search(g_in, src, params.visitor(vis)); + return get(orig2copy, src); + } + + } // namespace detail + + + // Copy all the vertices and edges of graph g_in that are reachable + // from the source vertex into graph g_out. Return the vertex + // in g_out that matches the source vertex of g_in. + template + typename graph_traits::vertex_descriptor + copy_component(IncidenceGraph& g_in, + typename graph_traits::vertex_descriptor src, + MutableGraph& g_out, + const bgl_named_params& params) + { + typename std::vector::size_type n; + n = is_default_param(get_param(params, orig_to_copy_t())) + ? num_vertices(g_in) : 1; + std::vector::vertex_descriptor> + orig2copy(n); + + return detail::copy_component_impl + (g_in, src, g_out, + detail::choose_vertex_copier(get_param(params, vertex_copy_t()), + g_in, g_out), + detail::choose_edge_copier(get_param(params, edge_copy_t()), + g_in, g_out), + choose_param(get_param(params, orig_to_copy_t()), + make_iterator_property_map + (orig2copy.begin(), + choose_pmap(get_param(params, vertex_index), + g_in, vertex_index), orig2copy[0])), + params + ); + } + + template + typename graph_traits::vertex_descriptor + copy_component(IncidenceGraph& g_in, + typename graph_traits::vertex_descriptor src, + MutableGraph& g_out) + { + std::vector::vertex_descriptor> + orig2copy(num_vertices(g_in)); + + return detail::copy_component_impl + (g_in, src, g_out, + make_vertex_copier(g_in, g_out), + make_edge_copier(g_in, g_out), + make_iterator_property_map(orig2copy.begin(), + get(vertex_index, g_in), orig2copy[0]), + bgl_named_params('x') // dummy param object + ); + } + +} // namespace boost + +#endif // BOOST_GRAPH_COPY_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/create_condensation_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/create_condensation_graph.hpp new file mode 100644 index 0000000000..f3d1113a3d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/create_condensation_graph.hpp @@ -0,0 +1,83 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_CREATE_CONDENSATION_GRAPH_HPP +#define BOOST_CREATE_CONDENSATION_GRAPH_HPP + +#include +#include + +namespace boost { + + template + void create_condensation_graph(const Graph& g, + const ComponentLists& components, + ComponentNumberMap component_number, + CondensationGraph& cg, + EdgeMultiplicityMap edge_mult_map) + { + typedef typename graph_traits::vertex_descriptor vertex; + typedef typename graph_traits::vertices_size_type size_type; + typedef typename graph_traits::vertex_descriptor + cg_vertex; + std::vector to_cg_vertex(components.size()); + for (size_type s = 0; s < components.size(); ++s) + to_cg_vertex[s] = add_vertex(cg); + + for (size_type si = 0; si < components.size(); ++si) { + cg_vertex s = to_cg_vertex[si]; + std::vector adj; + for (size_type i = 0; i < components[si].size(); ++i) { + vertex u = components[s][i]; + typename graph_traits::adjacency_iterator v, v_end; + for (tie(v, v_end) = adjacent_vertices(u, g); v != v_end; ++v) { + cg_vertex t = to_cg_vertex[component_number[*v]]; + if (s != t) // Avoid loops in the condensation graph + adj.push_back(t); + } + } + std::sort(adj.begin(), adj.end()); + if (! adj.empty()) { + size_type i = 0; + cg_vertex t = adj[i]; + typename graph_traits::edge_descriptor e; + bool inserted; + tie(e, inserted) = add_edge(s, t, cg); + put(edge_mult_map, e, 1); + ++i; + while (i < adj.size()) { + if (adj[i] == t) + put(edge_mult_map, e, get(edge_mult_map, e) + 1); + else { + t = adj[i]; + tie(e, inserted) = add_edge(s, t, cg); + put(edge_mult_map, e, 1); + } + ++i; + } + } + } + } + + template + void create_condensation_graph(const Graph& g, + const ComponentLists& components, + ComponentNumberMap component_number, + CondensationGraph& cg) + { + create_condensation_graph(g, components, component_number, cg, + dummy_property_map()); + } + +} // namespace boost + +#endif // BOOST_CREATE_CONDENSATION_GRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/cuthill_mckee_ordering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/cuthill_mckee_ordering.hpp new file mode 100644 index 0000000000..61336ab177 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/cuthill_mckee_ordering.hpp @@ -0,0 +1,190 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2004, 2005 Trustees of Indiana University +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, +// Doug Gregor, D. Kevin McGrath +// +// 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_GRAPH_CUTHILL_MCKEE_HPP +#define BOOST_GRAPH_CUTHILL_MCKEE_HPP + +#include +#include +#include + + +/* + (Reverse) Cuthill-McKee Algorithm for matrix reordering +*/ + +namespace boost { + + namespace detail { + + + + template < typename OutputIterator, typename Buffer, typename DegreeMap > + class bfs_rcm_visitor:public default_bfs_visitor + { + public: + bfs_rcm_visitor(OutputIterator *iter, Buffer *b, DegreeMap deg): + permutation(iter), Qptr(b), degree(deg) { } + template + void examine_vertex(Vertex u, Graph&) { + *(*permutation)++ = u; + index_begin = Qptr->size(); + } + template + void finish_vertex(Vertex, Graph&) { + using std::sort; + + typedef typename property_traits::value_type ds_type; + + typedef indirect_cmp > Compare; + Compare comp(degree); + + sort(Qptr->begin()+index_begin, Qptr->end(), comp); + } + protected: + OutputIterator *permutation; + int index_begin; + Buffer *Qptr; + DegreeMap degree; + }; + + } // namespace detail + + + // Reverse Cuthill-McKee algorithm with a given starting Vertex. + // + // If user provides a reverse iterator, this will be a reverse-cuthill-mckee + // algorithm, otherwise it will be a standard CM algorithm + + template + OutputIterator + cuthill_mckee_ordering(const Graph& g, + std::deque< typename + graph_traits::vertex_descriptor > vertex_queue, + OutputIterator permutation, + ColorMap color, DegreeMap degree) + { + + //create queue, visitor...don't forget namespaces! + typedef typename property_traits::value_type ds_type; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename boost::sparse::sparse_ordering_queue queue; + typedef typename detail::bfs_rcm_visitor Visitor; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + + queue Q; + + //create a bfs_rcm_visitor as defined above + Visitor vis(&permutation, &Q, degree); + + typename graph_traits::vertex_iterator ui, ui_end; + + // Copy degree to pseudo_degree + // initialize the color map + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui){ + put(color, *ui, Color::white()); + } + + + while( !vertex_queue.empty() ) { + Vertex s = vertex_queue.front(); + vertex_queue.pop_front(); + + //call BFS with visitor + breadth_first_visit(g, s, Q, vis, color); + } + return permutation; + } + + + // This is the case where only a single starting vertex is supplied. + template + OutputIterator + cuthill_mckee_ordering(const Graph& g, + typename graph_traits::vertex_descriptor s, + OutputIterator permutation, + ColorMap color, DegreeMap degree) + { + + std::deque< typename graph_traits::vertex_descriptor > vertex_queue; + vertex_queue.push_front( s ); + + return cuthill_mckee_ordering(g, vertex_queue, permutation, color, degree); + + } + + + // This is the version of CM which selects its own starting vertex + template < class Graph, class OutputIterator, + class ColorMap, class DegreeMap> + OutputIterator + cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, + ColorMap color, DegreeMap degree) + { + if (vertices(G).first == vertices(G).second) + return permutation; + + typedef typename boost::graph_traits::vertex_descriptor Vertex; + typedef typename boost::graph_traits::vertex_iterator VerIter; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + std::deque vertex_queue; + + // Mark everything white + BGL_FORALL_VERTICES_T(v, G, Graph) put(color, v, Color::white()); + + // Find one vertex from each connected component + BGL_FORALL_VERTICES_T(v, G, Graph) { + if (get(color, v) == Color::white()) { + depth_first_visit(G, v, dfs_visitor<>(), color); + vertex_queue.push_back(v); + } + } + + // Find starting nodes for all vertices + // TBD: How to do this with a directed graph? + for (typename std::deque::iterator i = vertex_queue.begin(); + i != vertex_queue.end(); ++i) + *i = find_starting_node(G, *i, color, degree); + + return cuthill_mckee_ordering(G, vertex_queue, permutation, + color, degree); + } + + template + OutputIterator + cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, + VertexIndexMap index_map) + { + if (vertices(G).first == vertices(G).second) + return permutation; + + typedef out_degree_property_map DegreeMap; + std::vector colors(num_vertices(G)); + return cuthill_mckee_ordering(G, permutation, + make_iterator_property_map(&colors[0], + index_map, + colors[0]), + make_out_degree_map(G)); + } + + template + inline OutputIterator + cuthill_mckee_ordering(const Graph& G, OutputIterator permutation) + { return cuthill_mckee_ordering(G, permutation, get(vertex_index, G)); } +} // namespace boost + + +#endif // BOOST_GRAPH_CUTHILL_MCKEE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/dag_shortest_paths.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/dag_shortest_paths.hpp new file mode 100644 index 0000000000..cc071de1f3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/dag_shortest_paths.hpp @@ -0,0 +1,157 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DAG_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_DAG_SHORTEST_PATHS_HPP + +#include +#include + +// single-source shortest paths for a Directed Acyclic Graph (DAG) + +namespace boost { + + // Initalize distances and call depth first search + template + inline void + dag_shortest_paths + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + DistanceMap distance, WeightMap weight, ColorMap color, + PredecessorMap pred, + DijkstraVisitor vis, Compare compare, Combine combine, + DistInf inf, DistZero zero) + { + typedef typename graph_traits::vertex_descriptor Vertex; + std::vector rev_topo_order; + rev_topo_order.reserve(num_vertices(g)); + + // Call 'depth_first_visit', not 'topological_sort', because we don't + // want to traverse the entire graph, only vertices reachable from 's', + // and 'topological_sort' will traverse everything. The logic below + // is the same as for 'topological_sort', only we call 'depth_first_visit' + // and 'topological_sort' calls 'depth_first_search'. + topo_sort_visitor > > + topo_visitor(std::back_inserter(rev_topo_order)); + depth_first_visit(g, s, topo_visitor, color); + + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(distance, *ui, inf); + put(pred, *ui, *ui); + } + + put(distance, s, zero); + vis.discover_vertex(s, g); + typename std::vector::reverse_iterator i; + for (i = rev_topo_order.rbegin(); i != rev_topo_order.rend(); ++i) { + Vertex u = *i; + vis.examine_vertex(u, g); + typename graph_traits::out_edge_iterator e, e_end; + for (tie(e, e_end) = out_edges(u, g); e != e_end; ++e) { + vis.discover_vertex(target(*e, g), g); + bool decreased = relax(*e, g, weight, pred, distance, + combine, compare); + if (decreased) + vis.edge_relaxed(*e, g); + else + vis.edge_not_relaxed(*e, g); + } + vis.finish_vertex(u, g); + } + } + + namespace detail { + + // Defaults are the same as Dijkstra's algorithm + + // Handle Distance Compare, Combine, Inf and Zero defaults + template + inline void + dag_sp_dispatch2 + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + DistanceMap distance, WeightMap weight, ColorMap color, IndexMap id, + DijkstraVisitor vis, const Params& params) + { + typedef typename property_traits::value_type D; + dummy_property_map p_map; + dag_shortest_paths + (g, s, distance, weight, color, + choose_param(get_param(params, vertex_predecessor), p_map), + vis, + choose_param(get_param(params, distance_compare_t()), std::less()), + choose_param(get_param(params, distance_combine_t()), closed_plus()), + choose_param(get_param(params, distance_inf_t()), + (std::numeric_limits::max)()), + choose_param(get_param(params, distance_zero_t()), + D())); + } + + // Handle DistanceMap and ColorMap defaults + template + inline void + dag_sp_dispatch1 + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + DistanceMap distance, WeightMap weight, ColorMap color, IndexMap id, + DijkstraVisitor vis, const Params& params) + { + typedef typename property_traits::value_type T; + typename std::vector::size_type n; + n = is_default_param(distance) ? num_vertices(g) : 1; + std::vector distance_map(n); + n = is_default_param(color) ? num_vertices(g) : 1; + std::vector color_map(n); + + dag_sp_dispatch2 + (g, s, + choose_param(distance, + make_iterator_property_map(distance_map.begin(), id, + distance_map[0])), + weight, + choose_param(color, + make_iterator_property_map(color_map.begin(), id, + color_map[0])), + id, vis, params); + } + + } // namespace detail + + template + inline void + dag_shortest_paths + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params) + { + // assert that the graph is directed... + null_visitor null_vis; + detail::dag_sp_dispatch1 + (g, s, + get_param(params, vertex_distance), + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + get_param(params, vertex_color), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + choose_param(get_param(params, graph_visitor), + make_dijkstra_visitor(null_vis)), + params); + } + +} // namespace boost + +#endif // BOOST_GRAPH_DAG_SHORTEST_PATHS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/depth_first_search.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/depth_first_search.hpp new file mode 100644 index 0000000000..6a0abb9a6a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/depth_first_search.hpp @@ -0,0 +1,365 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2003 Bruce Barr +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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) +//======================================================================= + +// Nonrecursive implementation of depth_first_visit_impl submitted by +// Bruce Barr, schmoost yahoo.com, May/June 2003. +#ifndef BOOST_GRAPH_RECURSIVE_DFS_HPP +#define BOOST_GRAPH_RECURSIVE_DFS_HPP + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +namespace boost { + + template + class DFSVisitorConcept { + public: + void constraints() { + function_requires< CopyConstructibleConcept >(); + vis.initialize_vertex(u, g); + vis.start_vertex(u, g); + vis.discover_vertex(u, g); + vis.examine_edge(e, g); + vis.tree_edge(e, g); + vis.back_edge(e, g); + vis.forward_or_cross_edge(e, g); + vis.finish_vertex(u, g); + } + private: + Visitor vis; + Graph g; + typename graph_traits::vertex_descriptor u; + typename graph_traits::edge_descriptor e; + }; + + namespace detail { + + struct nontruth2 { + template + bool operator()(const T&, const T2&) const { return false; } + }; + + +// Define BOOST_RECURSIVE_DFS to use older, recursive version. +// It is retained for a while in order to perform performance +// comparison. +#ifndef BOOST_RECURSIVE_DFS + + // If the vertex u and the iterators ei and ei_end are thought of as the + // context of the algorithm, each push and pop from the stack could + // be thought of as a context shift. + // Each pass through "while (ei != ei_end)" may refer to the out-edges of + // an entirely different vertex, because the context of the algorithm + // shifts every time a white adjacent vertex is discovered. + // The corresponding context shift back from the adjacent vertex occurs + // after all of its out-edges have been examined. + // + // See http://lists.boost.org/MailArchives/boost/msg48752.php for FAQ. + + template + void depth_first_visit_impl + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor u, + DFSVisitor& vis, + ColorMap color, TerminatorFunc func = TerminatorFunc()) + { + function_requires >(); + function_requires >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadWritePropertyMapConcept >(); + typedef typename property_traits::value_type ColorValue; + function_requires< ColorValueConcept >(); + typedef color_traits Color; + typedef typename graph_traits::out_edge_iterator Iter; + typedef std::pair > VertexInfo; + + Iter ei, ei_end; + std::vector stack; + + // Possible optimization for vector + //stack.reserve(num_vertices(g)); + + typedef typename unwrap_reference::type TF; + + put(color, u, Color::gray()); + vis.discover_vertex(u, g); + tie(ei, ei_end) = out_edges(u, g); + // Variable is needed to workaround a borland bug. + TF& fn = static_cast(func); + if (fn(u, g)) { + // If this vertex terminates the search, we push empty range + stack.push_back(std::make_pair(u, std::make_pair(ei_end, ei_end))); + } else { + stack.push_back(std::make_pair(u, std::make_pair(ei, ei_end))); + } + while (!stack.empty()) { + VertexInfo& back = stack.back(); + u = back.first; + tie(ei, ei_end) = back.second; + stack.pop_back(); + while (ei != ei_end) { + Vertex v = target(*ei, g); + vis.examine_edge(*ei, g); + ColorValue v_color = get(color, v); + if (v_color == Color::white()) { + vis.tree_edge(*ei, g); + stack.push_back(std::make_pair(u, std::make_pair(++ei, ei_end))); + u = v; + put(color, u, Color::gray()); + vis.discover_vertex(u, g); + tie(ei, ei_end) = out_edges(u, g); + if (fn(u, g)) { + ei = ei_end; + } + } else if (v_color == Color::gray()) { + vis.back_edge(*ei, g); + ++ei; + } else { + vis.forward_or_cross_edge(*ei, g); + ++ei; + } + } + put(color, u, Color::black()); + vis.finish_vertex(u, g); + } + } + +#else // BOOST_RECURSIVE_DFS is defined + + template + void depth_first_visit_impl + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor u, + DFSVisitor& vis, // pass-by-reference here, important! + ColorMap color, TerminatorFunc func) + { + function_requires >(); + function_requires >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadWritePropertyMapConcept >(); + typedef typename property_traits::value_type ColorValue; + function_requires< ColorValueConcept >(); + typedef color_traits Color; + typename graph_traits::out_edge_iterator ei, ei_end; + + put(color, u, Color::gray()); vis.discover_vertex(u, g); + + typedef typename unwrap_reference::type TF; + // Variable is needed to workaround a borland bug. + TF& fn = static_cast(func); + if (!fn(u, g)) + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + Vertex v = target(*ei, g); vis.examine_edge(*ei, g); + ColorValue v_color = get(color, v); + if (v_color == Color::white()) { vis.tree_edge(*ei, g); + depth_first_visit_impl(g, v, vis, color, func); + } else if (v_color == Color::gray()) vis.back_edge(*ei, g); + else vis.forward_or_cross_edge(*ei, g); + } + put(color, u, Color::black()); vis.finish_vertex(u, g); + } + +#endif + + } // namespace detail + + template + void + depth_first_search(const VertexListGraph& g, DFSVisitor vis, ColorMap color, + typename graph_traits::vertex_descriptor start_vertex) + { + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires >(); + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(color, *ui, Color::white()); vis.initialize_vertex(*ui, g); + } + + if (start_vertex != implicit_cast(*vertices(g).first)){ vis.start_vertex(start_vertex, g); + detail::depth_first_visit_impl(g, start_vertex, vis, color, + detail::nontruth2()); + } + + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + ColorValue u_color = get(color, *ui); + if (u_color == Color::white()) { vis.start_vertex(*ui, g); + detail::depth_first_visit_impl(g, *ui, vis, color, detail::nontruth2()); + } + } + } + + template + void + depth_first_search(const VertexListGraph& g, DFSVisitor vis, ColorMap color) + { + if (vertices(g).first == vertices(g).second) + return; + + depth_first_search(g, vis, color, *vertices(g).first); + } + + namespace detail { + template + struct dfs_dispatch { + + template + static void + apply(const VertexListGraph& g, DFSVisitor vis, Vertex start_vertex, + const bgl_named_params&, + ColorMap color) + { + depth_first_search(g, vis, color, start_vertex); + } + }; + + template <> + struct dfs_dispatch { + template + static void + apply(const VertexListGraph& g, DFSVisitor vis, Vertex start_vertex, + const bgl_named_params& params, + detail::error_property_not_found) + { + std::vector color_vec(num_vertices(g)); + default_color_type c = white_color; // avoid warning about un-init + depth_first_search + (g, vis, make_iterator_property_map + (color_vec.begin(), + choose_const_pmap(get_param(params, vertex_index), + g, vertex_index), c), + start_vertex); + } + }; + } // namespace detail + + + template + class dfs_visitor { + public: + dfs_visitor() { } + dfs_visitor(Visitors vis) : m_vis(vis) { } + + template + void initialize_vertex(Vertex u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_initialize_vertex()); + } + template + void start_vertex(Vertex u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_start_vertex()); + } + template + void discover_vertex(Vertex u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_discover_vertex()); + } + template + void examine_edge(Edge u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_examine_edge()); + } + template + void tree_edge(Edge u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_tree_edge()); + } + template + void back_edge(Edge u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_back_edge()); + } + template + void forward_or_cross_edge(Edge u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_forward_or_cross_edge()); + } + template + void finish_vertex(Vertex u, const Graph& g) { + invoke_visitors(m_vis, u, g, ::boost::on_finish_vertex()); + } + + BOOST_GRAPH_EVENT_STUB(on_initialize_vertex,dfs) + BOOST_GRAPH_EVENT_STUB(on_start_vertex,dfs) + BOOST_GRAPH_EVENT_STUB(on_discover_vertex,dfs) + BOOST_GRAPH_EVENT_STUB(on_examine_edge,dfs) + BOOST_GRAPH_EVENT_STUB(on_tree_edge,dfs) + BOOST_GRAPH_EVENT_STUB(on_back_edge,dfs) + BOOST_GRAPH_EVENT_STUB(on_forward_or_cross_edge,dfs) + BOOST_GRAPH_EVENT_STUB(on_finish_vertex,dfs) + + protected: + Visitors m_vis; + }; + template + dfs_visitor + make_dfs_visitor(Visitors vis) { + return dfs_visitor(vis); + } + typedef dfs_visitor<> default_dfs_visitor; + + + // Named Parameter Variant + template + void + depth_first_search(const VertexListGraph& g, + const bgl_named_params& params) + { + typedef typename property_value< bgl_named_params, + vertex_color_t>::type C; + if (vertices(g).first == vertices(g).second) + return; + detail::dfs_dispatch::apply + (g, + choose_param(get_param(params, graph_visitor), + make_dfs_visitor(null_visitor())), + choose_param(get_param(params, root_vertex_t()), + *vertices(g).first), + params, + get_param(params, vertex_color) + ); + } + + template + void depth_first_visit + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor u, + DFSVisitor vis, ColorMap color) + { + vis.start_vertex(u, g); + detail::depth_first_visit_impl(g, u, vis, color, detail::nontruth2()); + } + + template + void depth_first_visit + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor u, + DFSVisitor vis, ColorMap color, TerminatorFunc func = TerminatorFunc()) + { + vis.start_vertex(u, g); + detail::depth_first_visit_impl(g, u, vis, color, func); + } + + +} // namespace boost + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/adj_list_edge_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/adj_list_edge_iterator.hpp new file mode 100644 index 0000000000..12cb6ee97a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/adj_list_edge_iterator.hpp @@ -0,0 +1,117 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DETAIL_ADJ_LIST_EDGE_ITERATOR_HPP +#define BOOST_GRAPH_DETAIL_ADJ_LIST_EDGE_ITERATOR_HPP + +#include +#include +#include + +#if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) +# define BOOST_GRAPH_NO_OPTIONAL +#endif + +#ifdef BOOST_GRAPH_NO_OPTIONAL +# define BOOST_GRAPH_MEMBER . +#else +# define BOOST_GRAPH_MEMBER -> +# include +#endif // ndef BOOST_GRAPH_NO_OPTIONAL + +namespace boost { + + namespace detail { + + template + class adj_list_edge_iterator { + typedef adj_list_edge_iterator self; + public: + typedef std::forward_iterator_tag iterator_category; + typedef typename OutEdgeIterator::value_type value_type; + typedef typename OutEdgeIterator::reference reference; + typedef typename OutEdgeIterator::pointer pointer; + typedef typename OutEdgeIterator::difference_type difference_type; + typedef difference_type distance_type; + + inline adj_list_edge_iterator() {} + + inline adj_list_edge_iterator(const self& x) + : vBegin(x.vBegin), vCurr(x.vCurr), vEnd(x.vEnd), + edges(x.edges), m_g(x.m_g) { } + + template + inline adj_list_edge_iterator(VertexIterator b, + VertexIterator c, + VertexIterator e, + const G& g) + : vBegin(b), vCurr(c), vEnd(e), m_g(&g) { + if ( vCurr != vEnd ) { + while ( vCurr != vEnd && out_degree(*vCurr, *m_g) == 0 ) + ++vCurr; + if ( vCurr != vEnd ) + edges = out_edges(*vCurr, *m_g); + } + } + + /*Note: + In the directed graph cases, it is fine. + For undirected graphs, one edge go through twice. + */ + inline self& operator++() { + ++edges BOOST_GRAPH_MEMBER first; + if (edges BOOST_GRAPH_MEMBER first == edges BOOST_GRAPH_MEMBER second) + { + ++vCurr; + while ( vCurr != vEnd && out_degree(*vCurr, *m_g) == 0 ) + ++vCurr; + if ( vCurr != vEnd ) + edges = out_edges(*vCurr, *m_g); + } + return *this; + } + inline self operator++(int) { + self tmp = *this; + ++(*this); + return tmp; + } + inline value_type operator*() const + { return *edges BOOST_GRAPH_MEMBER first; } + inline bool operator==(const self& x) const { + return vCurr == x.vCurr + && (vCurr == vEnd + || edges BOOST_GRAPH_MEMBER first == x.edges BOOST_GRAPH_MEMBER first); + } + inline bool operator!=(const self& x) const { + return vCurr != x.vCurr + || (vCurr != vEnd + && edges BOOST_GRAPH_MEMBER first != x.edges BOOST_GRAPH_MEMBER first); + } + protected: + VertexIterator vBegin; + VertexIterator vCurr; + VertexIterator vEnd; + +#ifdef BOOST_GRAPH_NO_OPTIONAL + std::pair edges; +#else + boost::optional > + edges; +#endif // ndef BOOST_GRAPH_NO_OPTIONAL + const Graph* m_g; + }; + + } // namespace detail + +} + +#undef BOOST_GRAPH_MEMBER + +#endif // BOOST_GRAPH_DETAIL_ADJ_LIST_EDGE_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/adjacency_list.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/adjacency_list.hpp new file mode 100644 index 0000000000..0839dc0fad --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/adjacency_list.hpp @@ -0,0 +1,2844 @@ +// -*- c++ -*- +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DETAIL_ADJACENCY_LIST_HPP +#define BOOST_GRAPH_DETAIL_ADJACENCY_LIST_HPP + +#include // for vertex_map in copy_impl +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Symbol truncation problems with MSVC, trying to shorten names. +#define stored_edge se_ +#define stored_edge_property sep_ +#define stored_edge_iter sei_ + +/* + Outline for this file: + + out_edge_iterator and in_edge_iterator implementation + edge_iterator for undirected graph + stored edge types (these object live in the out-edge/in-edge lists) + directed edges helper class + directed graph helper class + undirected graph helper class + bidirectional graph helper class + bidirectional graph helper class (without edge properties) + bidirectional graph helper class (with edge properties) + adjacency_list helper class + adj_list_impl class + vec_adj_list_impl class + adj_list_gen class + vertex property map + edge property map + + + Note: it would be nice to merge some of the undirected and + bidirectional code... it is awful similar. + */ + + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define Graph Graph_ +#endif + +namespace boost { + + namespace detail { + + template + struct directed_category_traits { + typedef directed_tag directed_category; + }; + + template <> + struct directed_category_traits { + typedef directed_tag directed_category; + }; + template <> + struct directed_category_traits { + typedef undirected_tag directed_category; + }; + template <> + struct directed_category_traits { + typedef bidirectional_tag directed_category; + }; + + template + struct target_is { + target_is(const Vertex& v) : m_target(v) { } + template + bool operator()(const StoredEdge& e) const { + return e.get_target() == m_target; + } + Vertex m_target; + }; + + // O(E/V) + template + void erase_from_incidence_list(EdgeList& el, vertex_descriptor v, + allow_parallel_edge_tag) + { + boost::graph_detail::erase_if(el, detail::target_is(v)); + } + // O(log(E/V)) + template + void erase_from_incidence_list(EdgeList& el, vertex_descriptor v, + disallow_parallel_edge_tag) + { + typedef typename EdgeList::value_type StoredEdge; + el.erase(StoredEdge(v)); + } + + //========================================================================= + // Out-Edge and In-Edge Iterator Implementation + + template + struct out_edge_iter + : iterator_adaptor< + out_edge_iter + , BaseIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , Difference + > + { + typedef iterator_adaptor< + out_edge_iter + , BaseIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , Difference + > super_t; + + inline out_edge_iter() { } + inline out_edge_iter(const BaseIter& i, const VertexDescriptor& src) + : super_t(i), m_src(src) { } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor(m_src, (*this->base()).get_target(), + &(*this->base()).get_property()); + } + VertexDescriptor m_src; + }; + + template + struct in_edge_iter + : iterator_adaptor< + in_edge_iter + , BaseIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , Difference + > + { + typedef iterator_adaptor< + in_edge_iter + , BaseIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , Difference + > super_t; + + inline in_edge_iter() { } + inline in_edge_iter(const BaseIter& i, const VertexDescriptor& src) + : super_t(i), m_src(src) { } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor((*this->base()).get_target(), m_src, + &this->base()->get_property()); + } + VertexDescriptor m_src; + }; + + //========================================================================= + // Undirected Edge Iterator Implementation + + template + struct undirected_edge_iter + : iterator_adaptor< + undirected_edge_iter + , EdgeIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , Difference + > + { + typedef iterator_adaptor< + undirected_edge_iter + , EdgeIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , Difference + > super_t; + + undirected_edge_iter() {} + + explicit undirected_edge_iter(EdgeIter i) + : super_t(i) {} + + inline EdgeDescriptor + dereference() const { + return EdgeDescriptor( + (*this->base()).m_source + , (*this->base()).m_target + , &this->base()->get_property()); + } + }; + + //========================================================================= + // Edge Storage Types (stored in the out-edge/in-edge lists) + + template + class stored_edge + : public boost::equality_comparable1< stored_edge, + boost::less_than_comparable1< stored_edge > > + { + public: + typedef no_property property_type; + inline stored_edge() { } + inline stored_edge(Vertex target, const no_property& = no_property()) + : m_target(target) { } + // Need to write this explicitly so stored_edge_property can + // invoke Base::operator= (at least, for SGI MIPSPro compiler) + inline stored_edge& operator=(const stored_edge& x) { + m_target = x.m_target; + return *this; + } + inline Vertex& get_target() const { return m_target; } + inline const no_property& get_property() const { return s_prop; } + inline bool operator==(const stored_edge& x) const + { return m_target == x.get_target(); } + inline bool operator<(const stored_edge& x) const + { return m_target < x.get_target(); } + //protected: need to add hash<> as a friend + static no_property s_prop; + // Sometimes target not used as key in the set, and in that case + // it is ok to change the target. + mutable Vertex m_target; + }; + template + no_property stored_edge::s_prop; + + template + class stored_edge_property : public stored_edge { + typedef stored_edge_property self; + typedef stored_edge Base; + public: + typedef Property property_type; + inline stored_edge_property() { } + inline stored_edge_property(Vertex target, + const Property& p = Property()) + : stored_edge(target), m_property(new Property(p)) { } + stored_edge_property(const self& x) + : Base(x), m_property(const_cast(x).m_property) { } + self& operator=(const self& x) { + Base::operator=(x); + m_property = const_cast(x).m_property; + return *this; + } + inline Property& get_property() { return *m_property; } + inline const Property& get_property() const { return *m_property; } + protected: + // Holding the property by-value causes edge-descriptor + // invalidation for add_edge() with EdgeList=vecS. Instead we + // hold a pointer to the property. std::auto_ptr is not + // a perfect fit for the job, but it is darn close. + std::auto_ptr m_property; + }; + + + template + class stored_edge_iter + : public stored_edge + { + public: + typedef Property property_type; + inline stored_edge_iter() { } + inline stored_edge_iter(Vertex v) + : stored_edge(v) { } + inline stored_edge_iter(Vertex v, Iter i, void* = 0) + : stored_edge(v), m_iter(i) { } + inline Property& get_property() { return m_iter->get_property(); } + inline const Property& get_property() const { + return m_iter->get_property(); + } + inline Iter get_iter() const { return m_iter; } + protected: + Iter m_iter; + }; + + // For when the EdgeList is a std::vector. + // Want to make the iterator stable, so use an offset + // instead of an iterator into a std::vector + template + class stored_ra_edge_iter + : public stored_edge + { + typedef typename EdgeVec::iterator Iter; + public: + typedef Property property_type; + inline stored_ra_edge_iter() { } + inline stored_ra_edge_iter(Vertex v, Iter i = Iter(), + EdgeVec* edge_vec = 0) + : stored_edge(v), m_i(i - edge_vec->begin()), m_vec(edge_vec){ } + inline Property& get_property() { return (*m_vec)[m_i].get_property(); } + inline const Property& get_property() const { + return (*m_vec)[m_i].get_property(); + } + inline Iter get_iter() const { return m_vec->begin() + m_i; } + protected: + std::size_t m_i; + EdgeVec* m_vec; + }; + + } // namespace detail + + template + const typename property_value::type& + get(Tag property_tag, + const detail::stored_edge_property& e) + { + return get_property_value(e.get_property(), property_tag); + } + + template + const typename property_value::type& + get(Tag property_tag, + const detail::stored_edge_iter& e) + { + return get_property_value(e.get_property(), property_tag); + } + + template + const typename property_value::type& + get(Tag property_tag, + const detail::stored_ra_edge_iter& e) + { + return get_property_value(e.get_property(), property_tag); + } + + //========================================================================= + // Directed Edges Helper Class + + namespace detail { + + // O(E/V) + template + inline void + remove_directed_edge_dispatch(edge_descriptor, EdgeList& el, + StoredProperty& p) + { + for (typename EdgeList::iterator i = el.begin(); + i != el.end(); ++i) + if (&(*i).get_property() == &p) { + el.erase(i); + return; + } + } + + template + inline void + remove_directed_edge_if_dispatch(incidence_iterator first, + incidence_iterator last, + EdgeList& el, Predicate pred, + boost::allow_parallel_edge_tag) + { + // remove_if + while (first != last && !pred(*first)) + ++first; + incidence_iterator i = first; + if (first != last) + for (; i != last; ++i) + if (!pred(*i)) { + *first.base() = *i.base(); + ++first; + } + el.erase(first.base(), el.end()); + } + template + inline void + remove_directed_edge_if_dispatch(incidence_iterator first, + incidence_iterator last, + EdgeList& el, + Predicate pred, + boost::disallow_parallel_edge_tag) + { + for (incidence_iterator next = first; + first != last; first = next) { + ++next; + if (pred(*first)) + el.erase( first.base() ); + } + } + + template + inline void + undirected_remove_out_edge_if_dispatch(Graph& g, + incidence_iterator first, + incidence_iterator last, + EdgeList& el, Predicate pred, + boost::allow_parallel_edge_tag) + { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + // remove_if + while (first != last && !pred(*first)) + ++first; + incidence_iterator i = first; + bool self_loop_removed = false; + if (first != last) + for (; i != last; ++i) { + if (self_loop_removed) { + /* With self loops, the descriptor will show up + * twice. The first time it will be removed, and now it + * will be skipped. + */ + self_loop_removed = false; + } + else if (!pred(*i)) { + *first.base() = *i.base(); + ++first; + } else { + if (source(*i, g) == target(*i, g)) self_loop_removed = true; + else { + // Remove the edge from the target + detail::remove_directed_edge_dispatch + (*i, + g.out_edge_list(target(*i, g)), + *(PropT*)(*i).get_property()); + } + + // Erase the edge property + g.m_edges.erase( (*i.base()).get_iter() ); + } + } + el.erase(first.base(), el.end()); + } + template + inline void + undirected_remove_out_edge_if_dispatch(Graph& g, + incidence_iterator first, + incidence_iterator last, + EdgeList& el, + Predicate pred, + boost::disallow_parallel_edge_tag) + { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + for (incidence_iterator next = first; + first != last; first = next) { + ++next; + if (pred(*first)) { + if (source(*first, g) != target(*first, g)) { + // Remove the edge from the target + detail::remove_directed_edge_dispatch + (*first, + g.out_edge_list(target(*first, g)), + *(PropT*)(*first).get_property()); + } + + // Erase the edge property + g.m_edges.erase( (*first.base()).get_iter() ); + + // Erase the edge in the source + el.erase( first.base() ); + } + } + } + + // O(E/V) + template + inline void + remove_directed_edge_dispatch(edge_descriptor e, EdgeList& el, + no_property&) + { + for (typename EdgeList::iterator i = el.begin(); + i != el.end(); ++i) + if ((*i).get_target() == e.m_target) { + el.erase(i); + return; + } + } + + } // namespace detail + + template + struct directed_edges_helper { + + // Placement of these overloaded remove_edge() functions + // inside the class avoids a VC++ bug. + + // O(E/V) + inline void + remove_edge(typename Config::edge_descriptor e) + { + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(*this); + typename Config::OutEdgeList& el = g.out_edge_list(source(e, g)); + typedef typename Config::OutEdgeList::value_type::property_type PType; + detail::remove_directed_edge_dispatch(e, el, + *(PType*)e.get_property()); + } + + // O(1) + inline void + remove_edge(typename Config::out_edge_iterator iter) + { + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(*this); + typename Config::edge_descriptor e = *iter; + typename Config::OutEdgeList& el = g.out_edge_list(source(e, g)); + el.erase(iter.base()); + } + + }; + + // O(1) + template + inline std::pair + edges(const directed_edges_helper& g_) + { + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_iterator edge_iterator; + const graph_type& cg = static_cast(g_); + graph_type& g = const_cast(cg); + return std::make_pair( edge_iterator(g.vertex_set().begin(), + g.vertex_set().begin(), + g.vertex_set().end(), g), + edge_iterator(g.vertex_set().begin(), + g.vertex_set().end(), + g.vertex_set().end(), g) ); + } + + //========================================================================= + // Directed Graph Helper Class + + struct adj_list_dir_traversal_tag : + public virtual vertex_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual edge_list_graph_tag { }; + + template + struct directed_graph_helper + : public directed_edges_helper { + typedef typename Config::edge_descriptor edge_descriptor; + typedef adj_list_dir_traversal_tag traversal_category; + }; + + // O(E/V) + template + inline void + remove_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + directed_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_parallel_category Cat; + graph_type& g = static_cast(g_); + detail::erase_from_incidence_list(g.out_edge_list(u), v, Cat()); + } + + template + inline void + remove_out_edge_if(typename Config::vertex_descriptor u, Predicate pred, + directed_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + typename Config::out_edge_iterator first, last; + tie(first, last) = out_edges(u, g); + typedef typename Config::edge_parallel_category edge_parallel_category; + detail::remove_directed_edge_if_dispatch + (first, last, g.out_edge_list(u), pred, edge_parallel_category()); + } + + template + inline void + remove_edge_if(Predicate pred, directed_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + + typename Config::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + remove_out_edge_if(*vi, pred, g); + } + + template + inline void + remove_edge(EdgeOrIter e_or_iter, directed_graph_helper& g_) + { + g_.remove_edge(e_or_iter); + } + + // O(V + E) for allow_parallel_edges + // O(V * log(E/V)) for disallow_parallel_edges + template + inline void + clear_vertex(typename Config::vertex_descriptor u, + directed_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_parallel_category Cat; + graph_type& g = static_cast(g_); + typename Config::vertex_iterator vi, viend; + for (boost::tie(vi, viend) = vertices(g); vi != viend; ++vi) + detail::erase_from_incidence_list(g.out_edge_list(*vi), u, Cat()); + g.out_edge_list(u).clear(); + // clear() should be a req of Sequence and AssociativeContainer, + // or maybe just Container + } + + template + inline void + clear_out_edges(typename Config::vertex_descriptor u, + directed_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_parallel_category Cat; + graph_type& g = static_cast(g_); + g.out_edge_list(u).clear(); + // clear() should be a req of Sequence and AssociativeContainer, + // or maybe just Container + } + + // O(V), could do better... + template + inline typename Config::edges_size_type + num_edges(const directed_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + const graph_type& g = static_cast(g_); + typename Config::edges_size_type num_e = 0; + typename Config::vertex_iterator vi, vi_end; + for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + num_e += out_degree(*vi, g); + return num_e; + } + // O(1) for allow_parallel_edge_tag + // O(log(E/V)) for disallow_parallel_edge_tag + template + inline std::pair::edge_descriptor, bool> + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + directed_graph_helper& g_) + { + typedef typename Config::edge_descriptor edge_descriptor; + typedef typename Config::graph_type graph_type; + typedef typename Config::StoredEdge StoredEdge; + graph_type& g = static_cast(g_); + typename Config::OutEdgeList::iterator i; + bool inserted; + boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), + StoredEdge(v, p)); + return std::make_pair(edge_descriptor(u, v, &(*i).get_property()), + inserted); + } + // Did not use default argument here because that + // causes Visual C++ to get confused. + template + inline std::pair + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + directed_graph_helper& g_) + { + typename Config::edge_property_type p; + return add_edge(u, v, p, g_); + } + //========================================================================= + // Undirected Graph Helper Class + + template + struct undirected_graph_helper; + + struct undir_adj_list_traversal_tag : + public virtual vertex_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual edge_list_graph_tag, + public virtual bidirectional_graph_tag { }; + + namespace detail { + + // using class with specialization for dispatch is a VC++ workaround. + template + struct remove_undirected_edge_dispatch { + + // O(E/V) + template + static void + apply(edge_descriptor e, + undirected_graph_helper& g_, + StoredProperty& p) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + + typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); + typename Config::OutEdgeList::iterator out_i = out_el.begin(); + for (; out_i != out_el.end(); ++out_i) + if (&(*out_i).get_property() == &p) { + out_el.erase(out_i); + break; + } + typename Config::OutEdgeList& in_el = g.out_edge_list(target(e, g)); + typename Config::OutEdgeList::iterator in_i = in_el.begin(); + for (; in_i != in_el.end(); ++in_i) + if (&(*in_i).get_property() == &p) { + g.m_edges.erase((*in_i).get_iter()); + in_el.erase(in_i); + return; + } + } + }; + + template <> + struct remove_undirected_edge_dispatch { + // O(E/V) + template + static void + apply(edge_descriptor e, + undirected_graph_helper& g_, + no_property&) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + no_property* p = (no_property*)e.get_property(); + typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); + typename Config::OutEdgeList::iterator out_i = out_el.begin(); + for (; out_i != out_el.end(); ++out_i) + if (&(*out_i).get_property() == p) { + out_el.erase(out_i); + break; + } + typename Config::OutEdgeList& in_el = g.out_edge_list(target(e, g)); + typename Config::OutEdgeList::iterator in_i = in_el.begin(); + for (; in_i != in_el.end(); ++in_i) + if (&(*in_i).get_property() == p) { + g.m_edges.erase((*in_i).get_iter()); + in_el.erase(in_i); + return; + } + } + }; + + // O(E/V) + template + inline void + remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, + boost::allow_parallel_edge_tag cat) + { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename EdgeList::value_type StoredEdge; + typename EdgeList::iterator i = el.begin(), end = el.end(); + for (; i != end; ++i) + if ((*i).get_target() == v) + g.m_edges.erase((*i).get_iter()); + detail::erase_from_incidence_list(el, v, cat); + } + // O(log(E/V)) + template + inline void + remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, + boost::disallow_parallel_edge_tag) + { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename EdgeList::value_type StoredEdge; + typename EdgeList::iterator i = el.find(StoredEdge(v)), end = el.end(); + if (i != end) { + g.m_edges.erase((*i).get_iter()); + el.erase(i); + } + } + + } // namespace detail + + template + struct list_edge // short name due to VC++ truncation and linker problems + : public boost::detail::edge_base + { + typedef EdgeProperty property_type; + typedef boost::detail::edge_base Base; + list_edge(Vertex u, Vertex v, const EdgeProperty& p = EdgeProperty()) + : Base(u, v), m_property(p) { } + EdgeProperty& get_property() { return m_property; } + const EdgeProperty& get_property() const { return m_property; } + // the following methods should never be used, but are needed + // to make SGI MIPSpro C++ happy + list_edge() { } + bool operator==(const list_edge&) const { return false; } + bool operator<(const list_edge&) const { return false; } + EdgeProperty m_property; + }; + + template + struct undirected_graph_helper { + + typedef undir_adj_list_traversal_tag traversal_category; + + // Placement of these overloaded remove_edge() functions + // inside the class avoids a VC++ bug. + + // O(E/V) + inline void + remove_edge(typename Config::edge_descriptor e) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::OutEdgeList::value_type::property_type PType; + detail::remove_undirected_edge_dispatch::apply + (e, *this, *(PType*)e.get_property()); + } + // O(E/V) + inline void + remove_edge(typename Config::out_edge_iterator iter) + { + this->remove_edge(*iter); + } + }; + + // Had to make these non-members to avoid accidental instantiation + // on SGI MIPSpro C++ + template + inline typename C::InEdgeList& + in_edge_list(undirected_graph_helper&, + typename C::vertex_descriptor v) + { + typename C::stored_vertex* sv = (typename C::stored_vertex*)v; + return sv->m_out_edges; + } + template + inline const typename C::InEdgeList& + in_edge_list(const undirected_graph_helper&, + typename C::vertex_descriptor v) { + typename C::stored_vertex* sv = (typename C::stored_vertex*)v; + return sv->m_out_edges; + } + + // O(E/V) + template + inline void + remove_edge(EdgeOrIter e, undirected_graph_helper& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + g_.remove_edge(e); + } + + // O(E/V) or O(log(E/V)) + template + void + remove_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + undirected_graph_helper& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + typedef typename Config::edge_parallel_category Cat; + detail::remove_edge_and_property(g, g.out_edge_list(u), v, Cat()); + detail::erase_from_incidence_list(g.out_edge_list(v), u, Cat()); + } + + template + void + remove_out_edge_if(typename Config::vertex_descriptor u, Predicate pred, + undirected_graph_helper& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + typedef typename Config::OutEdgeList::value_type::property_type PropT; + graph_type& g = static_cast(g_); + typename Config::out_edge_iterator first, last; + tie(first, last) = out_edges(u, g); + typedef typename Config::edge_parallel_category Cat; + detail::undirected_remove_out_edge_if_dispatch + (g, first, last, g.out_edge_list(u), pred, Cat()); + } + template + void + remove_in_edge_if(typename Config::vertex_descriptor u, Predicate pred, + undirected_graph_helper& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + remove_out_edge_if(u, pred, g_); + } + + // O(E/V * E) or O(log(E/V) * E) + template + void + remove_edge_if(Predicate pred, undirected_graph_helper& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + typename Config::edge_iterator ei, ei_end, next; + tie(ei, ei_end) = edges(g); + for (next = ei; ei != ei_end; ei = next) { + ++next; + if (pred(*ei)) + remove_edge(*ei, g); + } + } + + // O(1) + template + inline std::pair + edges(const undirected_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_iterator edge_iterator; + const graph_type& cg = static_cast(g_); + graph_type& g = const_cast(cg); + return std::make_pair( edge_iterator(g.m_edges.begin()), + edge_iterator(g.m_edges.end()) ); + } + // O(1) + template + inline typename Config::edges_size_type + num_edges(const undirected_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + const graph_type& g = static_cast(g_); + return g.m_edges.size(); + } + // O(E/V * E/V) + template + inline void + clear_vertex(typename Config::vertex_descriptor u, + undirected_graph_helper& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_parallel_category Cat; + graph_type& g = static_cast(g_); + typename Config::OutEdgeList& el = g.out_edge_list(u); + typename Config::OutEdgeList::iterator + ei = el.begin(), ei_end = el.end(); + for (; ei != ei_end; ++ei) { + detail::erase_from_incidence_list + (g.out_edge_list((*ei).get_target()), u, Cat()); + g.m_edges.erase((*ei).get_iter()); + } + g.out_edge_list(u).clear(); + } + // O(1) for allow_parallel_edge_tag + // O(log(E/V)) for disallow_parallel_edge_tag + template + inline std::pair + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + undirected_graph_helper& g_) + { + typedef typename Config::StoredEdge StoredEdge; + typedef typename Config::edge_descriptor edge_descriptor; + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + + bool inserted; + typename Config::EdgeContainer::value_type e(u, v, p); + typename Config::EdgeContainer::iterator p_iter + = graph_detail::push(g.m_edges, e).first; + + typename Config::OutEdgeList::iterator i; + boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), + StoredEdge(v, p_iter, &g.m_edges)); + if (inserted) { + boost::graph_detail::push(g.out_edge_list(v), StoredEdge(u, p_iter, &g.m_edges)); + return std::make_pair(edge_descriptor(u, v, &p_iter->get_property()), + true); + } else { + g.m_edges.erase(p_iter); + return std::make_pair + (edge_descriptor(u, v, &i->get_iter()->get_property()), false); + } + } + template + inline std::pair + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + undirected_graph_helper& g_) + { + typename Config::edge_property_type p; + return add_edge(u, v, p, g_); + } + + // O(1) + template + inline typename Config::degree_size_type + degree(typename Config::vertex_descriptor u, + const undirected_graph_helper& g_) + { + typedef typename Config::graph_type Graph; + const Graph& g = static_cast(g_); + return out_degree(u, g); + } + + template + inline std::pair + in_edges(typename Config::vertex_descriptor u, + const undirected_graph_helper& g_) + { + typedef typename Config::graph_type Graph; + const Graph& cg = static_cast(g_); + Graph& g = const_cast(cg); + typedef typename Config::in_edge_iterator in_edge_iterator; + return + std::make_pair(in_edge_iterator(g.out_edge_list(u).begin(), u), + in_edge_iterator(g.out_edge_list(u).end(), u)); + } + + template + inline typename Config::degree_size_type + in_degree(typename Config::vertex_descriptor u, + const undirected_graph_helper& g_) + { return degree(u, g_); } + + //========================================================================= + // Bidirectional Graph Helper Class + + struct bidir_adj_list_traversal_tag : + public virtual vertex_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual edge_list_graph_tag, + public virtual bidirectional_graph_tag { }; + + template + struct bidirectional_graph_helper + : public directed_edges_helper { + typedef bidir_adj_list_traversal_tag traversal_category; + }; + + // Had to make these non-members to avoid accidental instantiation + // on SGI MIPSpro C++ + template + inline typename C::InEdgeList& + in_edge_list(bidirectional_graph_helper&, + typename C::vertex_descriptor v) + { + typename C::stored_vertex* sv = (typename C::stored_vertex*)v; + return sv->m_in_edges; + } + template + inline const typename C::InEdgeList& + in_edge_list(const bidirectional_graph_helper&, + typename C::vertex_descriptor v) { + typename C::stored_vertex* sv = (typename C::stored_vertex*)v; + return sv->m_in_edges; + } + + template + inline void + remove_edge_if(Predicate pred, bidirectional_graph_helper& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + typename Config::edge_iterator ei, ei_end, next; + tie(ei, ei_end) = edges(g); + for (next = ei; ei != ei_end; ei = next) { + ++next; + if (pred(*ei)) + remove_edge(*ei, g); + } + } + + template + inline std::pair + in_edges(typename Config::vertex_descriptor u, + const bidirectional_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + const graph_type& cg = static_cast(g_); + graph_type& g = const_cast(cg); + typedef typename Config::in_edge_iterator in_edge_iterator; + return + std::make_pair(in_edge_iterator(in_edge_list(g, u).begin(), u), + in_edge_iterator(in_edge_list(g, u).end(), u)); + } + + // O(1) + template + inline std::pair + edges(const bidirectional_graph_helper& g_) + { + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_iterator edge_iterator; + const graph_type& cg = static_cast(g_); + graph_type& g = const_cast(cg); + return std::make_pair( edge_iterator(g.m_edges.begin()), + edge_iterator(g.m_edges.end()) ); + } + + //========================================================================= + // Bidirectional Graph Helper Class (with edge properties) + + + template + struct bidirectional_graph_helper_with_property + : public bidirectional_graph_helper + { + typedef typename Config::graph_type graph_type; + typedef typename Config::out_edge_iterator out_edge_iterator; + + std::pair + get_parallel_edge_sublist(typename Config::edge_descriptor e, + const graph_type& g, + void*) + { return out_edges(source(e, g), g); } + + std::pair + get_parallel_edge_sublist(typename Config::edge_descriptor e, + const graph_type& g, + setS*) + { return edge_range(source(e, g), target(e, g), g); } + + std::pair + get_parallel_edge_sublist(typename Config::edge_descriptor e, + const graph_type& g, + multisetS*) + { return edge_range(source(e, g), target(e, g), g); } + +#if !defined BOOST_NO_HASH + std::pair + get_parallel_edge_sublist(typename Config::edge_descriptor e, + const graph_type& g, + hash_setS*) + { return edge_range(source(e, g), target(e, g), g); } +#endif + + // Placement of these overloaded remove_edge() functions + // inside the class avoids a VC++ bug. + + // O(E/V) or O(log(E/V)) + void + remove_edge(typename Config::edge_descriptor e) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + graph_type& g = static_cast(*this); + + typedef typename Config::edgelist_selector OutEdgeListS; + + std::pair rng = + get_parallel_edge_sublist(e, g, (OutEdgeListS*)(0)); + rng.first = std::find(rng.first, rng.second, e); + assert(rng.first != rng.second); + remove_edge(rng.first); + } + + inline void + remove_edge(typename Config::out_edge_iterator iter) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(*this); + typename Config::edge_descriptor e = *iter; + typename Config::OutEdgeList& oel = g.out_edge_list(source(e, g)); + typename Config::InEdgeList& iel = in_edge_list(g, target(e, g)); + typedef typename Config::OutEdgeList::value_type::property_type PType; + PType& p = *(PType*)e.get_property(); + detail::remove_directed_edge_dispatch(*iter, iel, p); + g.m_edges.erase(iter.base()->get_iter()); + oel.erase(iter.base()); + } + }; + + // O(E/V) for allow_parallel_edge_tag + // O(log(E/V)) for disallow_parallel_edge_tag + template + inline void + remove_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + typedef typename Config::edge_parallel_category Cat; + detail::remove_edge_and_property(g, g.out_edge_list(u), v, Cat()); + detail::erase_from_incidence_list(in_edge_list(g, v), u, Cat()); + } + + // O(E/V) or O(log(E/V)) + template + inline void + remove_edge(EdgeOrIter e, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + g_.remove_edge(e); + } + + template + inline void + remove_out_edge_if(typename Config::vertex_descriptor u, Predicate pred, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + typedef typename Config::OutEdgeList::value_type::property_type PropT; + graph_type& g = static_cast(g_); + + typedef typename Config::EdgeIter EdgeIter; + typedef std::vector Garbage; + Garbage garbage; + + // First remove the edges from the targets' in-edge lists and + // from the graph's edge set list. + typename Config::out_edge_iterator out_i, out_end; + for (tie(out_i, out_end) = out_edges(u, g); out_i != out_end; ++out_i) + if (pred(*out_i)) { + detail::remove_directed_edge_dispatch + (*out_i, in_edge_list(g, target(*out_i, g)), + *(PropT*)(*out_i).get_property()); + // Put in garbage to delete later. Will need the properties + // for the remove_if of the out-edges. + garbage.push_back((*out_i.base()).get_iter()); + } + + // Now remove the edges from this out-edge list. + typename Config::out_edge_iterator first, last; + tie(first, last) = out_edges(u, g); + typedef typename Config::edge_parallel_category Cat; + detail::remove_directed_edge_if_dispatch + (first, last, g.out_edge_list(u), pred, Cat()); + + // Now delete the edge properties from the g.m_edges list + for (typename Garbage::iterator i = garbage.begin(); + i != garbage.end(); ++i) + g.m_edges.erase(*i); + } + template + inline void + remove_in_edge_if(typename Config::vertex_descriptor v, Predicate pred, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + typedef typename Config::OutEdgeList::value_type::property_type PropT; + graph_type& g = static_cast(g_); + + typedef typename Config::EdgeIter EdgeIter; + typedef std::vector Garbage; + Garbage garbage; + + // First remove the edges from the sources' out-edge lists and + // from the graph's edge set list. + typename Config::in_edge_iterator in_i, in_end; + for (tie(in_i, in_end) = in_edges(v, g); in_i != in_end; ++in_i) + if (pred(*in_i)) { + typename Config::vertex_descriptor u = source(*in_i, g); + detail::remove_directed_edge_dispatch + (*in_i, g.out_edge_list(u), *(PropT*)(*in_i).get_property()); + // Put in garbage to delete later. Will need the properties + // for the remove_if of the out-edges. + garbage.push_back((*in_i.base()).get_iter()); + } + // Now remove the edges from this in-edge list. + typename Config::in_edge_iterator first, last; + tie(first, last) = in_edges(v, g); + typedef typename Config::edge_parallel_category Cat; + detail::remove_directed_edge_if_dispatch + (first, last, in_edge_list(g, v), pred, Cat()); + + // Now delete the edge properties from the g.m_edges list + for (typename Garbage::iterator i = garbage.begin(); + i != garbage.end(); ++i) + g.m_edges.erase(*i); + } + + // O(1) + template + inline typename Config::edges_size_type + num_edges(const bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::graph_type graph_type; + const graph_type& g = static_cast(g_); + return g.m_edges.size(); + } + // O(E/V * E/V) for allow_parallel_edge_tag + // O(E/V * log(E/V)) for disallow_parallel_edge_tag + template + inline void + clear_vertex(typename Config::vertex_descriptor u, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_parallel_category Cat; + graph_type& g = static_cast(g_); + typename Config::OutEdgeList& el = g.out_edge_list(u); + typename Config::OutEdgeList::iterator + ei = el.begin(), ei_end = el.end(); + for (; ei != ei_end; ++ei) { + detail::erase_from_incidence_list + (in_edge_list(g, (*ei).get_target()), u, Cat()); + g.m_edges.erase((*ei).get_iter()); + } + typename Config::InEdgeList& in_el = in_edge_list(g, u); + typename Config::InEdgeList::iterator + in_ei = in_el.begin(), in_ei_end = in_el.end(); + for (; in_ei != in_ei_end; ++in_ei) { + detail::erase_from_incidence_list + (g.out_edge_list((*in_ei).get_target()), u, Cat()); + g.m_edges.erase((*in_ei).get_iter()); + } + g.out_edge_list(u).clear(); + in_edge_list(g, u).clear(); + } + + template + inline void + clear_out_edges(typename Config::vertex_descriptor u, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_parallel_category Cat; + graph_type& g = static_cast(g_); + typename Config::OutEdgeList& el = g.out_edge_list(u); + typename Config::OutEdgeList::iterator + ei = el.begin(), ei_end = el.end(); + for (; ei != ei_end; ++ei) { + detail::erase_from_incidence_list + (in_edge_list(g, (*ei).get_target()), u, Cat()); + g.m_edges.erase((*ei).get_iter()); + } + g.out_edge_list(u).clear(); + } + + template + inline void + clear_in_edges(typename Config::vertex_descriptor u, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Config::graph_type graph_type; + typedef typename Config::edge_parallel_category Cat; + graph_type& g = static_cast(g_); + typename Config::InEdgeList& in_el = in_edge_list(g, u); + typename Config::InEdgeList::iterator + in_ei = in_el.begin(), in_ei_end = in_el.end(); + for (; in_ei != in_ei_end; ++in_ei) { + detail::erase_from_incidence_list + (g.out_edge_list((*in_ei).get_target()), u, Cat()); + g.m_edges.erase((*in_ei).get_iter()); + } + in_edge_list(g, u).clear(); + } + + // O(1) for allow_parallel_edge_tag + // O(log(E/V)) for disallow_parallel_edge_tag + template + inline std::pair + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::graph_type graph_type; + graph_type& g = static_cast(g_); + typedef typename Config::edge_descriptor edge_descriptor; + typedef typename Config::StoredEdge StoredEdge; + bool inserted; + typename Config::EdgeContainer::value_type e(u, v, p); + typename Config::EdgeContainer::iterator p_iter + = graph_detail::push(g.m_edges, e).first; + typename Config::OutEdgeList::iterator i; + boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), + StoredEdge(v, p_iter, &g.m_edges)); + if (inserted) { + boost::graph_detail::push(in_edge_list(g, v), StoredEdge(u, p_iter, &g.m_edges)); + return std::make_pair(edge_descriptor(u, v, &p_iter->m_property), + true); + } else { + g.m_edges.erase(p_iter); + return std::make_pair(edge_descriptor(u, v, + &i->get_iter()->get_property()), + false); + } + } + + template + inline std::pair + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + bidirectional_graph_helper_with_property& g_) + { + typename Config::edge_property_type p; + return add_edge(u, v, p, g_); + } + // O(1) + template + inline typename Config::degree_size_type + degree(typename Config::vertex_descriptor u, + const bidirectional_graph_helper_with_property& g_) + { + typedef typename Config::graph_type graph_type; + const graph_type& g = static_cast(g_); + return in_degree(u, g) + out_degree(u, g); + } + + //========================================================================= + // Adjacency List Helper Class + + template + struct adj_list_helper : public Base + { + typedef typename Config::graph_type AdjList; + typedef typename Config::vertex_descriptor vertex_descriptor; + typedef typename Config::edge_descriptor edge_descriptor; + typedef typename Config::out_edge_iterator out_edge_iterator; + typedef typename Config::in_edge_iterator in_edge_iterator; + typedef typename Config::adjacency_iterator adjacency_iterator; + typedef typename Config::inv_adjacency_iterator inv_adjacency_iterator; + typedef typename Config::vertex_iterator vertex_iterator; + typedef typename Config::edge_iterator edge_iterator; + typedef typename Config::directed_category directed_category; + typedef typename Config::edge_parallel_category edge_parallel_category; + typedef typename Config::vertices_size_type vertices_size_type; + typedef typename Config::edges_size_type edges_size_type; + typedef typename Config::degree_size_type degree_size_type; + typedef typename Config::StoredEdge StoredEdge; + typedef typename Config::edge_property_type edge_property_type; + + typedef typename Config::global_edgelist_selector + global_edgelist_selector; + + // protected: + + // The edge_dispatch() functions should be static, but + // Borland gets confused about constness. + + // O(E/V) + inline std::pair + edge_dispatch(const AdjList& g, + vertex_descriptor u, vertex_descriptor v, + boost::allow_parallel_edge_tag) const + { + bool found; + const typename Config::OutEdgeList& el = g.out_edge_list(u); + typename Config::OutEdgeList::const_iterator + i = std::find_if(el.begin(), el.end(), + detail::target_is(v)); + found = (i != g.out_edge_list(u).end()); + if (found) + return std::make_pair(edge_descriptor(u, v, &(*i).get_property()), + true); + else + return std::make_pair(edge_descriptor(u, v, 0), false); + } + // O(log(E/V)) + inline std::pair + edge_dispatch(const AdjList& g, + vertex_descriptor u, vertex_descriptor v, + boost::disallow_parallel_edge_tag) const + { + bool found; + /* According to the standard, this should be iterator, not const_iterator, + but the VC++ std::set::find() const returns const_iterator. + And since iterator should be convertible to const_iterator, the + following should work everywhere. -Jeremy */ + typename Config::OutEdgeList::const_iterator + i = g.out_edge_list(u).find(StoredEdge(v)), + end = g.out_edge_list(u).end(); + found = (i != end); + if (found) + return std::make_pair(edge_descriptor(u, v, &(*i).get_property()), + true); + else + return std::make_pair(edge_descriptor(u, v, 0), false); + } + }; + + template + inline std::pair + adjacent_vertices(typename Config::vertex_descriptor u, + const adj_list_helper& g_) + { + typedef typename Config::graph_type AdjList; + const AdjList& cg = static_cast(g_); + AdjList& g = const_cast(cg); + typedef typename Config::adjacency_iterator adjacency_iterator; + typename Config::out_edge_iterator first, last; + boost::tie(first, last) = out_edges(u, g); + return std::make_pair(adjacency_iterator(first, &g), + adjacency_iterator(last, &g)); + } + template + inline std::pair + inv_adjacent_vertices(typename Config::vertex_descriptor u, + const adj_list_helper& g_) + { + typedef typename Config::graph_type AdjList; + const AdjList& cg = static_cast(g_); + AdjList& g = const_cast(cg); + typedef typename Config::inv_adjacency_iterator inv_adjacency_iterator; + typename Config::in_edge_iterator first, last; + boost::tie(first, last) = in_edges(u, g); + return std::make_pair(inv_adjacency_iterator(first, &g), + inv_adjacency_iterator(last, &g)); + } + template + inline std::pair + out_edges(typename Config::vertex_descriptor u, + const adj_list_helper& g_) + { + typedef typename Config::graph_type AdjList; + typedef typename Config::out_edge_iterator out_edge_iterator; + const AdjList& cg = static_cast(g_); + AdjList& g = const_cast(cg); + return + std::make_pair(out_edge_iterator(g.out_edge_list(u).begin(), u), + out_edge_iterator(g.out_edge_list(u).end(), u)); + } + template + inline std::pair + vertices(const adj_list_helper& g_) + { + typedef typename Config::graph_type AdjList; + const AdjList& cg = static_cast(g_); + AdjList& g = const_cast(cg); + return std::make_pair( g.vertex_set().begin(), g.vertex_set().end() ); + } + template + inline typename Config::vertices_size_type + num_vertices(const adj_list_helper& g_) + { + typedef typename Config::graph_type AdjList; + const AdjList& g = static_cast(g_); + return g.vertex_set().size(); + } + template + inline typename Config::degree_size_type + out_degree(typename Config::vertex_descriptor u, + const adj_list_helper& g_) + { + typedef typename Config::graph_type AdjList; + const AdjList& g = static_cast(g_); + return g.out_edge_list(u).size(); + } + template + inline std::pair + edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const adj_list_helper& g_) + { + typedef typename Config::graph_type Graph; + typedef typename Config::edge_parallel_category Cat; + const Graph& g = static_cast(g_); + return g_.edge_dispatch(g, u, v, Cat()); + } + template + inline std::pair + edge_range(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const adj_list_helper& g_) + { + typedef typename Config::graph_type Graph; + typedef typename Config::StoredEdge StoredEdge; + const Graph& cg = static_cast(g_); + Graph& g = const_cast(cg); + typedef typename Config::out_edge_iterator out_edge_iterator; + typename Config::OutEdgeList& el = g.out_edge_list(u); + typename Config::OutEdgeList::iterator first, last; + typename Config::EdgeContainer fake_edge_container; + tie(first, last) = + std::equal_range(el.begin(), el.end(), + StoredEdge(v, fake_edge_container.end(), + &fake_edge_container)); + return std::make_pair(out_edge_iterator(first, u), + out_edge_iterator(last, u)); + } + + template + inline typename Config::degree_size_type + in_degree(typename Config::vertex_descriptor u, + const directed_edges_helper& g_) + { + typedef typename Config::graph_type Graph; + const Graph& cg = static_cast(g_); + Graph& g = const_cast(cg); + return in_edge_list(g, u).size(); + } + + namespace detail { + template + inline + typename boost::property_map::type + get_dispatch(adj_list_helper&, Property, + boost::edge_property_tag) { + typedef typename Config::graph_type Graph; + typedef typename boost::property_map::type PA; + return PA(); + } + template + inline + typename boost::property_map::const_type + get_dispatch(const adj_list_helper&, Property, + boost::edge_property_tag) { + typedef typename Config::graph_type Graph; + typedef typename boost::property_map::const_type PA; + return PA(); + } + + template + inline + typename boost::property_map::type + get_dispatch(adj_list_helper& g, Property, + boost::vertex_property_tag) { + typedef typename Config::graph_type Graph; + typedef typename boost::property_map::type PA; + return PA(&static_cast(g)); + } + template + inline + typename boost::property_map::const_type + get_dispatch(const adj_list_helper& g, Property, + boost::vertex_property_tag) { + typedef typename Config::graph_type Graph; + typedef typename boost::property_map::const_type PA; + const Graph& cg = static_cast(g); + return PA(&cg); + } + + } // namespace detail + + // Implementation of the PropertyGraph interface + template + inline + typename boost::property_map::type + get(Property p, adj_list_helper& g) { + typedef typename property_kind::type Kind; + return detail::get_dispatch(g, p, Kind()); + } + template + inline + typename boost::property_map::const_type + get(Property p, const adj_list_helper& g) { + typedef typename property_kind::type Kind; + return detail::get_dispatch(g, p, Kind()); + } + + template + inline + typename boost::property_traits< + typename boost::property_map::type + >::reference + get(Property p, adj_list_helper& g, const Key& key) { + return get(get(p, g), key); + } + + template + inline + typename boost::property_traits< + typename boost::property_map::const_type + >::reference + get(Property p, const adj_list_helper& g, const Key& key) { + return get(get(p, g), key); + } + + template + inline void + put(Property p, adj_list_helper& g, + const Key& key, const Value& value) + { + typedef typename Config::graph_type Graph; + typedef typename boost::property_map::type Map; + Map pmap = get(p, static_cast(g)); + put(pmap, key, value); + } + + + //========================================================================= + // Generalize Adjacency List Implementation + + struct adj_list_tag { }; + + template + class adj_list_impl + : public adj_list_helper + { + typedef typename Config::OutEdgeList OutEdgeList; + typedef typename Config::InEdgeList InEdgeList; + typedef typename Config::StoredVertexList StoredVertexList; + public: + typedef typename Config::stored_vertex stored_vertex; + typedef typename Config::EdgeContainer EdgeContainer; + typedef typename Config::vertex_descriptor vertex_descriptor; + typedef typename Config::edge_descriptor edge_descriptor; + typedef typename Config::vertex_iterator vertex_iterator; + typedef typename Config::edge_iterator edge_iterator; + typedef typename Config::edge_parallel_category edge_parallel_category; + typedef typename Config::vertices_size_type vertices_size_type; + typedef typename Config::edges_size_type edges_size_type; + typedef typename Config::degree_size_type degree_size_type; + typedef typename Config::edge_property_type edge_property_type; + typedef adj_list_tag graph_tag; + + static vertex_descriptor null_vertex() + { + return 0; + } + + inline adj_list_impl() { } + + inline adj_list_impl(const adj_list_impl& x) { + copy_impl(x); + } + inline adj_list_impl& operator=(const adj_list_impl& x) { + this->clear(); + copy_impl(x); + return *this; + } + inline void clear() { + for (typename StoredVertexList::iterator i = m_vertices.begin(); + i != m_vertices.end(); ++i) + delete (stored_vertex*)*i; + m_vertices.clear(); + m_edges.clear(); + } + inline adj_list_impl(vertices_size_type num_vertices) { + for (vertices_size_type i = 0; i < num_vertices; ++i) + add_vertex(static_cast(*this)); + } + template + inline adj_list_impl(vertices_size_type num_vertices, + EdgeIterator first, EdgeIterator last) + { + vertex_descriptor* v = new vertex_descriptor[num_vertices]; + for (vertices_size_type i = 0; i < num_vertices; ++i) + v[i] = add_vertex(static_cast(*this)); + + while (first != last) { + add_edge(v[(*first).first], v[(*first).second], *this); + ++first; + } + delete [] v; + } + template + inline adj_list_impl(vertices_size_type num_vertices, + EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter) + { + vertex_descriptor* v = new vertex_descriptor[num_vertices]; + for (vertices_size_type i = 0; i < num_vertices; ++i) + v[i] = add_vertex(static_cast(*this)); + + while (first != last) { + add_edge(v[(*first).first], v[(*first).second], *ep_iter, *this); + ++first; + ++ep_iter; + } + delete [] v; + } + ~adj_list_impl() { + for (typename StoredVertexList::iterator i = m_vertices.begin(); + i != m_vertices.end(); ++i) + delete (stored_vertex*)*i; + } + // protected: + inline OutEdgeList& out_edge_list(vertex_descriptor v) { + stored_vertex* sv = (stored_vertex*)v; + return sv->m_out_edges; + } + inline const OutEdgeList& out_edge_list(vertex_descriptor v) const { + stored_vertex* sv = (stored_vertex*)v; + return sv->m_out_edges; + } + inline StoredVertexList& vertex_set() { return m_vertices; } + inline const StoredVertexList& vertex_set() const { return m_vertices; } + + inline void copy_impl(const adj_list_impl& x_) + { + const Derived& x = static_cast(x_); + + // Would be better to have a constant time way to get from + // vertices in x to the corresponding vertices in *this. + std::map vertex_map; + + // Copy the stored vertex objects by adding each vertex + // and copying its property object. + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(x); vi != vi_end; ++vi) { + stored_vertex* v = (stored_vertex*)add_vertex(*this); + v->m_property = ((stored_vertex*)*vi)->m_property; + vertex_map[(stored_vertex*)*vi] = v; + } + // Copy the edges by adding each edge and copying its + // property object. + edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(x); ei != ei_end; ++ei) { + edge_descriptor e; + bool inserted; + vertex_descriptor s = source(*ei,x), t = target(*ei,x); + tie(e, inserted) = add_edge(vertex_map[(stored_vertex*)s], + vertex_map[(stored_vertex*)t], *this); + *((edge_property_type*)e.m_eproperty) + = *((edge_property_type*)(*ei).m_eproperty); + } + } + + + typename Config::EdgeContainer m_edges; + StoredVertexList m_vertices; + }; + + // O(1) + template + inline typename Config::vertex_descriptor + add_vertex(adj_list_impl& g_) + { + Derived& g = static_cast(g_); + typedef typename Config::stored_vertex stored_vertex; + stored_vertex* v = new stored_vertex; + typename Config::StoredVertexList::iterator pos; + bool inserted; + boost::tie(pos,inserted) = boost::graph_detail::push(g.m_vertices, v); + v->m_position = pos; + return v; + } + // O(1) + template + inline typename Config::vertex_descriptor + add_vertex(const typename Config::vertex_property_type& p, + adj_list_impl& g_) + { + Derived& g = static_cast(g_); + typedef typename Config::stored_vertex stored_vertex; + stored_vertex* v = new stored_vertex(p); + typename Config::StoredVertexList::iterator pos; + bool inserted; + boost::tie(pos,inserted) = boost::graph_detail::push(g.m_vertices, v); + v->m_position = pos; + return v; + } + // O(1) + template + inline void remove_vertex(typename Config::vertex_descriptor u, + adj_list_impl& g_) + { + typedef typename Config::stored_vertex stored_vertex; + Derived& g = static_cast(g_); + stored_vertex* su = (stored_vertex*)u; + g.m_vertices.erase(su->m_position); + delete su; + } + // O(V) + template + inline typename Config::vertex_descriptor + vertex(typename Config::vertices_size_type n, + const adj_list_impl& g_) + { + const Derived& g = static_cast(g_); + typename Config::vertex_iterator i = vertices(g).first; + while (n--) ++i; // std::advance(i, n); (not VC++ portable) + return *i; + } + + //========================================================================= + // Vector-Backbone Adjacency List Implementation + + namespace detail { + + template + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, + boost::directed_tag) + { + typedef typename Graph::edge_parallel_category edge_parallel_category; + g.m_vertices.erase(g.m_vertices.begin() + u); + vertex_descriptor V = num_vertices(g); + if (u != V) { + for (vertex_descriptor v = 0; v < V; ++v) + reindex_edge_list(g.out_edge_list(v), u, edge_parallel_category()); + } + } + + template + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, + boost::undirected_tag) + { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Graph::edge_parallel_category edge_parallel_category; + g.m_vertices.erase(g.m_vertices.begin() + u); + vertex_descriptor V = num_vertices(g); + for (vertex_descriptor v = 0; v < V; ++v) + reindex_edge_list(g.out_edge_list(v), u, + edge_parallel_category()); + typedef typename Graph::EdgeContainer Container; + typedef typename Container::iterator Iter; + Iter ei = g.m_edges.begin(), ei_end = g.m_edges.end(); + for (; ei != ei_end; ++ei) { + if (ei->m_source > u) + --ei->m_source; + if (ei->m_target > u) + --ei->m_target; + } + } + template + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, + boost::bidirectional_tag) + { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same::value)); + + typedef typename Graph::edge_parallel_category edge_parallel_category; + g.m_vertices.erase(g.m_vertices.begin() + u); + vertex_descriptor V = num_vertices(g); + vertex_descriptor v; + if (u != V) { + for (v = 0; v < V; ++v) + reindex_edge_list(g.out_edge_list(v), u, + edge_parallel_category()); + for (v = 0; v < V; ++v) + reindex_edge_list(in_edge_list(g, v), u, + edge_parallel_category()); + + typedef typename Graph::EdgeContainer Container; + typedef typename Container::iterator Iter; + Iter ei = g.m_edges.begin(), ei_end = g.m_edges.end(); + for (; ei != ei_end; ++ei) { + if (ei->m_source > u) + --ei->m_source; + if (ei->m_target > u) + --ei->m_target; + } + } + } + + template + inline void + reindex_edge_list(EdgeList& el, vertex_descriptor u, + boost::allow_parallel_edge_tag) + { + typename EdgeList::iterator ei = el.begin(), e_end = el.end(); + for (; ei != e_end; ++ei) + if ((*ei).get_target() > u) + --(*ei).get_target(); + } + template + inline void + reindex_edge_list(EdgeList& el, vertex_descriptor u, + boost::disallow_parallel_edge_tag) + { + typename EdgeList::iterator ei = el.begin(), e_end = el.end(); + while (ei != e_end) { + typename EdgeList::value_type ce = *ei; + ++ei; + if (ce.get_target() > u) { + el.erase(ce); + --ce.get_target(); + el.insert(ce); + } + } + } + } // namespace detail + + struct vec_adj_list_tag { }; + + template + class vec_adj_list_impl + : public adj_list_helper + { + typedef typename Config::OutEdgeList OutEdgeList; + typedef typename Config::InEdgeList InEdgeList; + typedef typename Config::StoredVertexList StoredVertexList; + public: + typedef typename Config::vertex_descriptor vertex_descriptor; + typedef typename Config::edge_descriptor edge_descriptor; + typedef typename Config::out_edge_iterator out_edge_iterator; + typedef typename Config::edge_iterator edge_iterator; + typedef typename Config::directed_category directed_category; + typedef typename Config::vertices_size_type vertices_size_type; + typedef typename Config::edges_size_type edges_size_type; + typedef typename Config::degree_size_type degree_size_type; + typedef typename Config::StoredEdge StoredEdge; + typedef typename Config::stored_vertex stored_vertex; + typedef typename Config::EdgeContainer EdgeContainer; + typedef typename Config::edge_property_type edge_property_type; + typedef vec_adj_list_tag graph_tag; + + static vertex_descriptor null_vertex() + { + return (std::numeric_limits::max)(); + } + + inline vec_adj_list_impl() { } + + inline vec_adj_list_impl(const vec_adj_list_impl& x) { + copy_impl(x); + } + inline vec_adj_list_impl& operator=(const vec_adj_list_impl& x) { + this->clear(); + copy_impl(x); + return *this; + } + inline void clear() { + m_vertices.clear(); + m_edges.clear(); + } + + inline vec_adj_list_impl(vertices_size_type _num_vertices) + : m_vertices(_num_vertices) { } + + template + inline vec_adj_list_impl(vertices_size_type num_vertices, + EdgeIterator first, EdgeIterator last) + : m_vertices(num_vertices) + { + while (first != last) { + add_edge((*first).first, (*first).second, + static_cast(*this)); + ++first; + } + } + template + inline vec_adj_list_impl(vertices_size_type num_vertices, + EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter) + : m_vertices(num_vertices) + { + while (first != last) { + add_edge((*first).first, (*first).second, *ep_iter, + static_cast(*this)); + ++first; + ++ep_iter; + } + } + + // protected: + inline boost::integer_range vertex_set() const { + return boost::integer_range(0, m_vertices.size()); + } + inline OutEdgeList& out_edge_list(vertex_descriptor v) { + return m_vertices[v].m_out_edges; + } + inline const OutEdgeList& out_edge_list(vertex_descriptor v) const { + return m_vertices[v].m_out_edges; + } + inline void copy_impl(const vec_adj_list_impl& x_) + { + const Graph& x = static_cast(x_); + // Copy the stored vertex objects by adding each vertex + // and copying its property object. + for (vertices_size_type i = 0; i < num_vertices(x); ++i) { + vertex_descriptor v = add_vertex(*this); + m_vertices[v].m_property = x.m_vertices[i].m_property; + } + // Copy the edges by adding each edge and copying its + // property object. + edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(x); ei != ei_end; ++ei) { + edge_descriptor e; + bool inserted; + tie(e, inserted) = add_edge(source(*ei,x), target(*ei,x) , *this); + *((edge_property_type*)e.m_eproperty) + = *((edge_property_type*)(*ei).m_eproperty); + } + } + typename Config::EdgeContainer m_edges; + StoredVertexList m_vertices; + }; + // Had to make these non-members to avoid accidental instantiation + // on SGI MIPSpro C++ + template + inline typename C::InEdgeList& + in_edge_list(vec_adj_list_impl& g, + typename C::vertex_descriptor v) { + return g.m_vertices[v].m_in_edges; + } + template + inline const typename C::InEdgeList& + in_edge_list(const vec_adj_list_impl& g, + typename C::vertex_descriptor v) { + return g.m_vertices[v].m_in_edges; + } + + // O(1) + template + inline typename Config::vertex_descriptor + add_vertex(vec_adj_list_impl& g_) { + Graph& g = static_cast(g_); + g.m_vertices.resize(g.m_vertices.size() + 1); + return g.m_vertices.size() - 1; + } + + template + inline typename Config::vertex_descriptor + add_vertex(const typename Config::vertex_property_type& p, + vec_adj_list_impl& g_) { + Graph& g = static_cast(g_); + typedef typename Config::stored_vertex stored_vertex; + g.m_vertices.push_back(stored_vertex(p)); + return g.m_vertices.size() - 1; + } + + // Here we override the directed_graph_helper add_edge() function + // so that the number of vertices is automatically changed if + // either u or v is greater than the number of vertices. + template + inline std::pair + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + vec_adj_list_impl& g_) + { + BOOST_USING_STD_MAX(); + typename Config::vertex_descriptor x = max BOOST_PREVENT_MACRO_SUBSTITUTION(u, v); + if (x >= num_vertices(g_)) + g_.m_vertices.resize(x + 1); + adj_list_helper& g = g_; + return add_edge(u, v, p, g); + } + template + inline std::pair + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + vec_adj_list_impl& g_) + { + typename Config::edge_property_type p; + return add_edge(u, v, p, g_); + } + + + // O(V + E) + template + inline void remove_vertex(typename Config::vertex_descriptor v, + vec_adj_list_impl& g_) + { + typedef typename Config::directed_category Cat; + Graph& g = static_cast(g_); + detail::remove_vertex_dispatch(g, v, Cat()); + } + // O(1) + template + inline typename Config::vertex_descriptor + vertex(typename Config::vertices_size_type n, + const vec_adj_list_impl&) + { + return n; + } + + + namespace detail { + + //========================================================================= + // Adjacency List Generator + + template + struct adj_list_gen + { + typedef typename detail::is_random_access::type + is_rand_access; + typedef typename has_property::type has_edge_property; + typedef typename DirectedS::is_directed_t DirectedT; + typedef typename DirectedS::is_bidir_t BidirectionalT; + + struct config + { + typedef OutEdgeListS edgelist_selector; + typedef EdgeListS global_edgelist_selector; + + typedef Graph graph_type; + typedef EdgeProperty edge_property_type; + typedef VertexProperty vertex_property_type; + typedef GraphProperty graph_property_type; + typedef std::size_t vertices_size_type; + + typedef adjacency_list_traits + Traits; + + typedef typename Traits::directed_category directed_category; + typedef typename Traits::edge_parallel_category edge_parallel_category; + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::edge_descriptor edge_descriptor; + + typedef void* vertex_ptr; + + // need to reorganize this to avoid instantiating stuff + // that doesn't get used -JGS + + // VertexList and vertex_iterator + typedef typename container_gen::type SeqVertexList; + typedef boost::integer_range RandVertexList; + typedef typename mpl::if_::type VertexList; + + typedef typename VertexList::iterator vertex_iterator; + + // EdgeContainer and StoredEdge + + typedef typename container_gen >::type EdgeContainer; + + typedef typename mpl::and_::type >::type on_edge_storage; + + typedef typename mpl::if_::type edges_size_type; + + typedef typename EdgeContainer::iterator EdgeIter; + + typedef typename detail::is_random_access::type is_edge_ra; + + typedef typename mpl::if_, + typename mpl::if_, + stored_edge_iter + >::type + >::type StoredEdge; + + // Adjacency Types + + typedef typename container_gen::type + OutEdgeList; + typedef typename OutEdgeList::size_type degree_size_type; + typedef typename OutEdgeList::iterator OutEdgeIter; + + typedef boost::detail::iterator_traits OutEdgeIterTraits; + typedef typename OutEdgeIterTraits::iterator_category OutEdgeIterCat; + typedef typename OutEdgeIterTraits::difference_type OutEdgeIterDiff; + + typedef out_edge_iter< + OutEdgeIter, vertex_descriptor, edge_descriptor, OutEdgeIterDiff + > out_edge_iterator; + + typedef typename adjacency_iterator_generator::type adjacency_iterator; + + typedef OutEdgeList InEdgeList; + typedef OutEdgeIter InEdgeIter; + typedef OutEdgeIterCat InEdgeIterCat; + typedef OutEdgeIterDiff InEdgeIterDiff; + + typedef in_edge_iter< + InEdgeIter, vertex_descriptor, edge_descriptor, InEdgeIterDiff + > in_edge_iterator; + + typedef typename inv_adjacency_iterator_generator::type inv_adjacency_iterator; + + // Edge Iterator + + typedef boost::detail::iterator_traits EdgeIterTraits; + typedef typename EdgeIterTraits::iterator_category EdgeIterCat; + typedef typename EdgeIterTraits::difference_type EdgeIterDiff; + + typedef undirected_edge_iter< + EdgeIter + , edge_descriptor + , EdgeIterDiff + > UndirectedEdgeIter; // also used for bidirectional + + typedef adj_list_edge_iterator DirectedEdgeIter; + + typedef typename mpl::if_::type edge_iterator; + + // stored_vertex and StoredVertexList + typedef typename container_gen::type + SeqStoredVertexList; + struct seq_stored_vertex { + seq_stored_vertex() { } + seq_stored_vertex(const VertexProperty& p) : m_property(p) { } + OutEdgeList m_out_edges; + VertexProperty m_property; + typename SeqStoredVertexList::iterator m_position; + }; + struct bidir_seq_stored_vertex { + bidir_seq_stored_vertex() { } + bidir_seq_stored_vertex(const VertexProperty& p) : m_property(p) { } + OutEdgeList m_out_edges; + InEdgeList m_in_edges; + VertexProperty m_property; + typename SeqStoredVertexList::iterator m_position; + }; + struct rand_stored_vertex { + rand_stored_vertex() { } + rand_stored_vertex(const VertexProperty& p) : m_property(p) { } + OutEdgeList m_out_edges; + VertexProperty m_property; + }; + struct bidir_rand_stored_vertex { + bidir_rand_stored_vertex() { } + bidir_rand_stored_vertex(const VertexProperty& p) : m_property(p) { } + OutEdgeList m_out_edges; + InEdgeList m_in_edges; + VertexProperty m_property; + }; + typedef typename mpl::if_::type, + typename mpl::if_::type + >::type StoredVertex; + struct stored_vertex : public StoredVertex { + stored_vertex() { } + stored_vertex(const VertexProperty& p) : StoredVertex(p) { } + }; + + typedef typename container_gen::type + RandStoredVertexList; + typedef typename mpl::if_< is_rand_access, + RandStoredVertexList, SeqStoredVertexList>::type StoredVertexList; + }; // end of config + + + typedef typename mpl::if_, + typename mpl::if_, + undirected_graph_helper + >::type + >::type DirectedHelper; + + typedef typename mpl::if_, + adj_list_impl + >::type type; + + }; + + } // namespace detail + + //========================================================================= + // Vertex Property Maps + + template + struct adj_list_vertex_property_map + : public boost::put_get_helper< + Reference, + adj_list_vertex_property_map + > + { + typedef typename Graph::stored_vertex StoredVertex; + typedef ValueType value_type; + typedef Reference reference; + typedef typename Graph::vertex_descriptor key_type; + typedef boost::lvalue_property_map_tag category; + inline adj_list_vertex_property_map() { } + inline adj_list_vertex_property_map(const Graph*) { } + inline Reference operator[](key_type v) const { + StoredVertex* sv = (StoredVertex*)v; + return get_property_value(sv->m_property, Tag()); + } + inline Reference operator()(key_type v) const { + return this->operator[](v); + } + }; + + template + struct adj_list_vertex_all_properties_map + : public boost::put_get_helper + > + { + typedef typename Graph::stored_vertex StoredVertex; + typedef Property value_type; + typedef PropRef reference; + typedef typename Graph::vertex_descriptor key_type; + typedef boost::lvalue_property_map_tag category; + inline adj_list_vertex_all_properties_map() { } + inline adj_list_vertex_all_properties_map(const Graph*) { } + inline PropRef operator[](key_type v) const { + StoredVertex* sv = (StoredVertex*)v; + return sv->m_property; + } + inline PropRef operator()(key_type v) const { + return this->operator[](v); + } + }; + + template + struct vec_adj_list_vertex_property_map + : public boost::put_get_helper< + Reference, + vec_adj_list_vertex_property_map + > + { + typedef ValueType value_type; + typedef Reference reference; + typedef typename boost::graph_traits::vertex_descriptor key_type; + typedef boost::lvalue_property_map_tag category; + vec_adj_list_vertex_property_map() { } + vec_adj_list_vertex_property_map(GraphPtr g) : m_g(g) { } + inline Reference operator[](key_type v) const { + return get_property_value(m_g->m_vertices[v].m_property, Tag()); + } + inline Reference operator()(key_type v) const { + return this->operator[](v); + } + GraphPtr m_g; + }; + + template + struct vec_adj_list_vertex_all_properties_map + : public boost::put_get_helper + > + { + typedef Property value_type; + typedef PropertyRef reference; + typedef typename boost::graph_traits::vertex_descriptor key_type; + typedef boost::lvalue_property_map_tag category; + vec_adj_list_vertex_all_properties_map() { } + vec_adj_list_vertex_all_properties_map(GraphPtr g) : m_g(g) { } + inline PropertyRef operator[](key_type v) const { + return m_g->m_vertices[v].m_property; + } + inline PropertyRef operator()(key_type v) const { + return this->operator[](v); + } + GraphPtr m_g; + }; + + struct adj_list_any_vertex_pa { + template + struct bind_ { + typedef typename property_value::type value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + + typedef adj_list_vertex_property_map + type; + typedef adj_list_vertex_property_map + const_type; + }; + }; + struct adj_list_all_vertex_pa { + template + struct bind_ { + typedef typename Graph::vertex_descriptor Vertex; + typedef adj_list_vertex_all_properties_map type; + typedef adj_list_vertex_all_properties_map const_type; + }; + }; + + template + struct vec_adj_list_vertex_id_map + : public boost::put_get_helper< + Vertex, vec_adj_list_vertex_id_map + > + { + typedef Vertex value_type; + typedef Vertex key_type; + typedef Vertex reference; + typedef boost::readable_property_map_tag category; + inline vec_adj_list_vertex_id_map() { } + template + inline vec_adj_list_vertex_id_map(const Graph&) { } + inline value_type operator[](key_type v) const { return v; } + inline value_type operator()(key_type v) const { return v; } + }; + + struct vec_adj_list_any_vertex_pa { + template + struct bind_ { + typedef typename property_value::type value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + + typedef vec_adj_list_vertex_property_map + type; + typedef vec_adj_list_vertex_property_map + const_type; + }; + }; + struct vec_adj_list_id_vertex_pa { + template + struct bind_ { + typedef typename Graph::vertex_descriptor Vertex; + typedef vec_adj_list_vertex_id_map type; + typedef vec_adj_list_vertex_id_map const_type; + }; + }; + struct vec_adj_list_all_vertex_pa { + template + struct bind_ { + typedef typename Graph::vertex_descriptor Vertex; + typedef vec_adj_list_vertex_all_properties_map + type; + typedef vec_adj_list_vertex_all_properties_map + const_type; + }; + }; + namespace detail { + template + struct adj_list_choose_vertex_pa_helper { + typedef adj_list_any_vertex_pa type; + }; + template <> + struct adj_list_choose_vertex_pa_helper { + typedef adj_list_all_vertex_pa type; + }; + template + struct adj_list_choose_vertex_pa { + typedef typename adj_list_choose_vertex_pa_helper::type Helper; + typedef typename Helper::template bind_ Bind; + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; + }; + + + template + struct vec_adj_list_choose_vertex_pa_helper { + typedef vec_adj_list_any_vertex_pa type; + }; + template <> + struct vec_adj_list_choose_vertex_pa_helper { + typedef vec_adj_list_id_vertex_pa type; + }; + template <> + struct vec_adj_list_choose_vertex_pa_helper { + typedef vec_adj_list_all_vertex_pa type; + }; + template + struct vec_adj_list_choose_vertex_pa { + typedef typename vec_adj_list_choose_vertex_pa_helper::type Helper; + typedef typename Helper::template bind_ Bind; + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; + }; + } // namespace detail + + //========================================================================= + // Edge Property Map + + template + struct adj_list_edge_property_map + : public put_get_helper< + Ref, + adj_list_edge_property_map + > + { + typedef Value value_type; + typedef Ref reference; + typedef detail::edge_desc_impl key_type; + typedef boost::lvalue_property_map_tag category; + inline Ref operator[](key_type e) const { + Property& p = *(Property*)e.get_property(); + return get_property_value(p, Tag()); + } + inline Ref operator()(key_type e) const { + return this->operator[](e); + } + }; + + template + struct adj_list_edge_all_properties_map + : public put_get_helper + > + { + typedef Property value_type; + typedef PropRef reference; + typedef detail::edge_desc_impl key_type; + typedef boost::lvalue_property_map_tag category; + inline PropRef operator[](key_type e) const { + return *(PropPtr)e.get_property(); + } + inline PropRef operator()(key_type e) const { + return this->operator[](e); + } + }; + + // Edge Property Maps + + namespace detail { + struct adj_list_any_edge_pmap { + template + struct bind_ { + typedef typename property_value::type value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + + typedef adj_list_edge_property_map + type; + typedef adj_list_edge_property_map + const_type; + }; + }; + struct adj_list_all_edge_pmap { + template + struct bind_ { + typedef adj_list_edge_all_properties_map + type; + typedef adj_list_edge_all_properties_map + const_type; + }; + }; + + template + struct adj_list_choose_edge_pmap_helper { + typedef adj_list_any_edge_pmap type; + }; + template <> + struct adj_list_choose_edge_pmap_helper { + typedef adj_list_all_edge_pmap type; + }; + template + struct adj_list_choose_edge_pmap { + typedef typename adj_list_choose_edge_pmap_helper::type Helper; + typedef typename Helper::template bind_ Bind; + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; + }; + struct adj_list_edge_property_selector { + template + struct bind_ { + typedef adj_list_choose_edge_pmap Choice; + typedef typename Choice::type type; + typedef typename Choice::const_type const_type; + }; + }; + } // namespace detail + + template <> + struct edge_property_selector { + typedef detail::adj_list_edge_property_selector type; + }; + template <> + struct edge_property_selector { + typedef detail::adj_list_edge_property_selector type; + }; + + // Vertex Property Maps + + struct adj_list_vertex_property_selector { + template + struct bind_ { + typedef detail::adj_list_choose_vertex_pa Choice; + typedef typename Choice::type type; + typedef typename Choice::const_type const_type; + }; + }; + template <> + struct vertex_property_selector { + typedef adj_list_vertex_property_selector type; + }; + + struct vec_adj_list_vertex_property_selector { + template + struct bind_ { + typedef detail::vec_adj_list_choose_vertex_pa Choice; + typedef typename Choice::type type; + typedef typename Choice::const_type const_type; + }; + }; + template <> + struct vertex_property_selector { + typedef vec_adj_list_vertex_property_selector type; + }; + +} // namespace boost + +#if !defined(BOOST_NO_HASH) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +namespace BOOST_STD_EXTENSION_NAMESPACE { + + #if BOOST_WORKAROUND( _STLPORT_VERSION, >= 0x500 ) + // STLport 5 already defines a hash specialization. + #else + template <> + struct hash< void* > // Need this when vertex_descriptor=void* + { + std::size_t + operator()(void* v) const { return (std::size_t)v; } + }; + #endif + + template + struct hash< boost::detail::stored_edge > + { + std::size_t + operator()(const boost::detail::stored_edge& e) const + { + return hash()(e.m_target); + } + }; + + template + struct hash< boost::detail::stored_edge_property > + { + std::size_t + operator()(const boost::detail::stored_edge_property& e) const + { + return hash()(e.m_target); + } + }; + + template + struct hash< boost::detail::stored_edge_iter > + { + std::size_t + operator()(const boost::detail::stored_edge_iter& e) const + { + return hash()(e.m_target); + } + }; + +} +#endif + + +#undef stored_edge +#undef stored_edge_property +#undef stored_edge_iter + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +#undef Graph +#endif + +#endif // BOOST_GRAPH_DETAIL_DETAIL_ADJACENCY_LIST_CCT + +/* + Implementation Notes: + + Many of the public interface functions in this file would have been + more conveniently implemented as inline friend functions. + However there are a few compiler bugs that make that approach + non-portable. + + 1. g++ inline friend in namespace bug + 2. g++ using clause doesn't work with inline friends + 3. VC++ doesn't have Koenig lookup + + For these reasons, the functions were all written as non-inline free + functions, and static cast was used to convert from the helper + class to the adjacency_list derived class. + + Looking back, it might have been better to write out all functions + in terms of the adjacency_list, and then use a tag to dispatch + to the various helpers instead of using inheritance. + + */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/array_binary_tree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/array_binary_tree.hpp new file mode 100644 index 0000000000..6f337e9121 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/array_binary_tree.hpp @@ -0,0 +1,182 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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 ADSTL_ARRAY_BINARY_TREE_HPP +#define ADSTL_ARRAY_BINARY_TREE_HPP + +#include +#include +#include + +namespace adstl { + /* + Note: array_binary_tree is a completey balanced binary tree + */ + +#if !defined BOOST_NO_STD_ITERATOR_TRAITS + template +#else + template +#endif +class array_binary_tree_node { +public: + typedef array_binary_tree_node ArrayBinaryTreeNode; + typedef RandomAccessIterator rep_iterator; +#if !defined BOOST_NO_STD_ITERATOR_TRAITS + typedef typename std::iterator_traits::difference_type + difference_type; + typedef typename std::iterator_traits::value_type + value_type; +#else + typedef int difference_type; + typedef ValueType value_type; +#endif + typedef difference_type size_type; + + struct children_type { + struct iterator + : boost::iterator + { // replace with iterator_adaptor implementation -JGS + + inline iterator() : i(0), n(0) { } + inline iterator(const iterator& x) : r(x.r), i(x.i), n(x.n), id(x.id) { } + inline iterator& operator=(const iterator& x) { + r = x.r; i = x.i; n = x.n; + /*egcs generate a warning*/ + id = x.id; + return *this; + } + inline iterator(rep_iterator rr, + size_type ii, + size_type nn, + const ID& _id) : r(rr), i(ii), n(nn), id(_id) { } + inline array_binary_tree_node operator*() { + return ArrayBinaryTreeNode(r, i, n, id); } + inline iterator& operator++() { ++i; return *this; } + inline iterator operator++(int) + { iterator t = *this; ++(*this); return t; } + inline bool operator==(const iterator& x) const { return i == x.i; } + inline bool operator!=(const iterator& x) const + { return !(*this == x); } + rep_iterator r; + size_type i; + size_type n; + ID id; + }; + inline children_type() : i(0), n(0) { } + inline children_type(const children_type& x) + : r(x.r), i(x.i), n(x.n), id(x.id) { } + inline children_type& operator=(const children_type& x) { + r = x.r; i = x.i; n = x.n; + /*egcs generate a warning*/ + id = x.id; + return *this; + } + inline children_type(rep_iterator rr, + size_type ii, + size_type nn, + const ID& _id) : r(rr), i(ii), n(nn), id(_id) { } + inline iterator begin() { return iterator(r, 2 * i + 1, n, id); } + inline iterator end() { return iterator(r, 2 * i + 1 + size(), n, id); } + inline size_type size() const { + size_type c = 2 * i + 1; + size_type s; + if (c + 1 < n) s = 2; + else if (c < n) s = 1; + else s = 0; + return s; + } + rep_iterator r; + size_type i; + size_type n; + ID id; + }; + inline array_binary_tree_node() : i(0), n(0) { } + inline array_binary_tree_node(const array_binary_tree_node& x) + : r(x.r), i(x.i), n(x.n), id(x.id) { } + inline ArrayBinaryTreeNode& operator=(const ArrayBinaryTreeNode& x) { + r = x.r; + i = x.i; + n = x.n; + /*egcs generate a warning*/ + id = x.id; + return *this; + } + inline array_binary_tree_node(rep_iterator start, + rep_iterator end, + rep_iterator pos, const ID& _id) + : r(start), i(pos - start), n(end - start), id(_id) { } + inline array_binary_tree_node(rep_iterator rr, + size_type ii, + size_type nn, const ID& _id) + : r(rr), i(ii), n(nn), id(_id) { } + inline value_type& value() { return *(r + i); } + inline const value_type& value() const { return *(r + i); } + inline ArrayBinaryTreeNode parent() const { + return ArrayBinaryTreeNode(r, (i - 1) / 2, n, id); + } + inline bool has_parent() const { return i != 0; } + inline children_type children() { return children_type(r, i, n, id); } + /* + inline void swap(array_binary_tree_node x) { + value_type tmp = x.value(); + x.value() = value(); + value() = tmp; + i = x.i; + } + */ + template + inline void swap(ArrayBinaryTreeNode x, ExternalData& edata ) { + using boost::get; + + value_type tmp = x.value(); + + /*swap external data*/ + edata[ get(id, tmp) ] = i; + edata[ get(id, value()) ] = x.i; + + x.value() = value(); + value() = tmp; + i = x.i; + } + inline const children_type children() const { + return children_type(r, i, n); + } + inline size_type index() const { return i; } + rep_iterator r; + size_type i; + size_type n; + ID id; +}; + +template > +struct compare_array_node { + typedef typename RandomAccessContainer::value_type value_type; + compare_array_node(const Compare& x) : comp(x) {} + compare_array_node(const compare_array_node& x) : comp(x.comp) {} + + template< class node_type > + inline bool operator()(const node_type& x, const node_type& y) { + return comp(x.value(), y.value()); + } + + template< class node_type > + inline bool operator()(const node_type& x, const node_type& y) const { + return comp(x.value(), y.value()); + } + Compare comp; +}; + + +} /* namespace adstl */ + +#endif /* ADSTL_ARRAY_BINARY_TREE_H */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/connected_components.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/connected_components.hpp new file mode 100644 index 0000000000..0af7746012 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/connected_components.hpp @@ -0,0 +1,208 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DETAIL_CONNECTED_COMPONENTS_HPP +#define BOOST_GRAPH_DETAIL_CONNECTED_COMPONENTS_HPP + +#if defined(__sgi) && !defined(__GNUC__) +#pragma set woff 1234 +#endif + +#include + +namespace boost { + + namespace detail { + + //========================================================================= + // Implementation details of connected_components + + // This is used both in the connected_components algorithm and in + // the kosaraju strong components algorithm during the second DFS + // traversal. + template + class components_recorder : public DFSVisitor + { + typedef typename property_traits::value_type comp_type; + public: + components_recorder(ComponentsPA c, + comp_type& c_count, + DFSVisitor v) + : DFSVisitor(v), m_component(c), m_count(c_count) {} + + template + void start_vertex(Vertex u, Graph& g) { + ++m_count; + DFSVisitor::start_vertex(u, g); + } + template + void discover_vertex(Vertex u, Graph& g) { + put(m_component, u, m_count); + DFSVisitor::discover_vertex(u, g); + } + protected: + ComponentsPA m_component; + comp_type& m_count; + }; + + template + class time_recorder : public DFSVisitor + { + public: + time_recorder(DiscoverTimeMap d, FinishTimeMap f, TimeT& t, DFSVisitor v) + : DFSVisitor(v), m_discover_time(d), m_finish_time(f), m_t(t) {} + + template + void discover_vertex(Vertex u, Graph& g) { + put(m_discover_time, u, ++m_t); + DFSVisitor::discover_vertex(u, g); + } + template + void finish_vertex(Vertex u, Graph& g) { + put(m_finish_time, u, ++m_t); + DFSVisitor::discover_vertex(u, g); + } + protected: + DiscoverTimeMap m_discover_time; + FinishTimeMap m_finish_time; + TimeT m_t; + }; + template + time_recorder + record_times(DiscoverTimeMap d, FinishTimeMap f, TimeT& t, DFSVisitor vis) + { + return time_recorder + (d, f, t, vis); + } + + //========================================================================= + // Implementation detail of dynamic_components + + + //------------------------------------------------------------------------- + // Helper functions for the component_index class + + // Record the representative vertices in the header array. + // Representative vertices now point to the component number. + + template + inline void + build_components_header(Parent p, + OutputIterator header, + Integer num_nodes) + { + Parent component = p; + Integer component_num = 0; + for (Integer v = 0; v != num_nodes; ++v) + if (p[v] == v) { + *header++ = v; + component[v] = component_num++; + } + } + + + // Pushes x onto the front of the list. The list is represented in + // an array. + template + inline void push_front(Next next, T& head, V x) + { + T tmp = head; + head = x; + next[x] = tmp; + } + + + // Create a linked list of the vertices in each component + // by reusing the representative array. + template + void + link_components(Parent1 component, Parent2 header, + Integer num_nodes, Integer num_components) + { + // Make the non-representative vertices point to their component + Parent1 representative = component; + for (Integer v = 0; v != num_nodes; ++v) + if (component[v] >= num_components || header[component[v]] != v) + component[v] = component[representative[v]]; + + // initialize the "head" of the lists to "NULL" + std::fill_n(header, num_components, num_nodes); + + // Add each vertex to the linked list for its component + Parent1 next = component; + for (Integer k = 0; k != num_nodes; ++k) + push_front(next, header[component[k]], k); + } + + + + template + void + construct_component_index(IndexContainer& index, HeaderContainer& header) + { + build_components_header(index.begin(), + std::back_inserter(header), + index.end() - index.begin()); + + link_components(index.begin(), header.begin(), + index.end() - index.begin(), + header.end() - header.begin()); + } + + + + template + class component_iterator + : boost::forward_iterator_helper< + component_iterator, + Integer, Distance,Integer*, Integer&> + { + public: + typedef component_iterator self; + + IndexIterator next; + Integer node; + + typedef std::forward_iterator_tag iterator_category; + typedef Integer value_type; + typedef Integer& reference; + typedef Integer* pointer; + typedef Distance difference_type; + + component_iterator() {} + component_iterator(IndexIterator x, Integer i) + : next(x), node(i) {} + Integer operator*() const { + return node; + } + self& operator++() { + node = next[node]; + return *this; + } + }; + + template + inline bool + operator==(const component_iterator& x, + const component_iterator& y) + { + return x.node == y.node; + } + + } // namespace detail + +} // namespace detail + +#if defined(__sgi) && !defined(__GNUC__) +#pragma reset woff 1234 +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/edge.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/edge.hpp new file mode 100644 index 0000000000..da085973a7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/edge.hpp @@ -0,0 +1,124 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DETAIL_EDGE_HPP +#define BOOST_GRAPH_DETAIL_EDGE_HPP + +#if __GNUC__ < 3 +#include +#else +#include +#endif + +namespace boost { + + namespace detail { + + template + struct edge_base + { + inline edge_base() {} + inline edge_base(Vertex s, Vertex d) + : m_source(s), m_target(d) { } + Vertex m_source; + Vertex m_target; + }; + + template + class edge_desc_impl : public edge_base { + typedef edge_desc_impl self; + typedef edge_base Base; + public: + typedef void property_type; + + inline edge_desc_impl() : m_eproperty(0) {} + + inline edge_desc_impl(Vertex s, Vertex d, const property_type* eplug) + : Base(s,d), m_eproperty(const_cast(eplug)) { } + + property_type* get_property() { return m_eproperty; } + const property_type* get_property() const { return m_eproperty; } + + // protected: + property_type* m_eproperty; + }; + + template + inline bool + operator==(const detail::edge_desc_impl& a, + const detail::edge_desc_impl& b) + { + return a.get_property() == b.get_property(); + } + template + inline bool + operator!=(const detail::edge_desc_impl& a, + const detail::edge_desc_impl& b) + { + return ! (a.get_property() == b.get_property()); + } + + // Order edges according to the address of their property object + template + inline bool + operator<(const detail::edge_desc_impl& a, + const detail::edge_desc_impl& b) + { + return a.get_property() < b.get_property(); + } + template + inline bool + operator<=(const detail::edge_desc_impl& a, + const detail::edge_desc_impl& b) + { + return a.get_property() <= b.get_property(); + } + template + inline bool + operator>(const detail::edge_desc_impl& a, + const detail::edge_desc_impl& b) + { + return a.get_property() > b.get_property(); + } + template + inline bool + operator>=(const detail::edge_desc_impl& a, + const detail::edge_desc_impl& b) + { + return a.get_property() >= b.get_property(); + } + + } //namespace detail + +} // namespace boost + +namespace std { + +#if __GNUC__ < 3 + template + std::ostream& + operator<<(std::ostream& os, const boost::detail::edge_desc_impl& e) + { + return os << "(" << e.m_source << "," << e.m_target << ")"; + } +#else + template + std::basic_ostream& + operator<<(std::basic_ostream& os, + const boost::detail::edge_desc_impl& e) + { + return os << "(" << e.m_source << "," << e.m_target << ")"; + } +#endif + +} + + +#endif // BOOST_GRAPH_DETAIL_DETAIL_EDGE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/incidence_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/incidence_iterator.hpp new file mode 100644 index 0000000000..836ad15266 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/incidence_iterator.hpp @@ -0,0 +1,79 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DETAIL_INCIDENCE_ITERATOR_HPP +#define BOOST_GRAPH_DETAIL_INCIDENCE_ITERATOR_HPP + +#include +#include + +// OBSOLETE + +namespace boost { + + namespace detail { + // EdgeDir tags + struct in_edge_tag { }; + struct out_edge_tag { }; + + template + struct bidir_incidence_iterator { + typedef bidir_incidence_iterator self; + typedef Edge edge_type; + typedef typename Edge::property_type EdgeProperty; + public: + typedef int difference_type; + typedef std::forward_iterator_tag iterator_category; + typedef edge_type reference; + typedef edge_type value_type; + typedef value_type* pointer; + inline bidir_incidence_iterator() {} + inline bidir_incidence_iterator(Iterator1D ii, Vertex src) + : i(ii), _src(src) { } + + inline self& operator++() { ++i; return *this; } + inline self operator++(int) { self tmp = *this; ++(*this); return tmp; } + + inline reference operator*() const { + return deref_helper(EdgeDir()); + } + inline self* operator->() { return this; } + + Iterator1D& iter() { return i; } + const Iterator1D& iter() const { return i; } + + Iterator1D i; + Vertex _src; + protected: + inline reference deref_helper(out_edge_tag) const { + return edge_type( _src, (*i).get_target(), &(*i).get_property() ); + } + inline reference deref_helper(in_edge_tag) const { + return edge_type((*i).get_target(), _src, &(*i).get_property() ); + } + }; + + template + inline bool operator==(const bidir_incidence_iterator& x, + const bidir_incidence_iterator& y) + { + return x.i == y.i; + } + template + inline bool operator!=(const bidir_incidence_iterator& x, + const bidir_incidence_iterator& y) + { + return x.i != y.i; + } + + + } +} +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/incremental_components.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/incremental_components.hpp new file mode 100644 index 0000000000..cf08bea091 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/incremental_components.hpp @@ -0,0 +1,141 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP +#define BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP + +#include +#include + +namespace boost { + + namespace detail { + + //========================================================================= + // Implementation detail of incremental_components + + + //------------------------------------------------------------------------- + // Helper functions for the component_index class + + // Record the representative vertices in the header array. + // Representative vertices now point to the component number. + + template + inline void + build_components_header(Parent p, + OutputIterator header, + Integer num_nodes) + { + Parent component = p; + Integer component_num = 0; + for (Integer v = 0; v != num_nodes; ++v) + if (p[v] == v) { + *header++ = v; + component[v] = component_num++; + } + } + + + // Pushes x onto the front of the list. The list is represented in + // an array. + template + inline void array_push_front(Next next, T& head, V x) + { + T tmp = head; + head = x; + next[x] = tmp; + } + + + // Create a linked list of the vertices in each component + // by reusing the representative array. + template + void + link_components(Parent1 component, Parent2 header, + Integer num_nodes, Integer num_components) + { + // Make the non-representative vertices point to their component + Parent1 representative = component; + for (Integer v = 0; v != num_nodes; ++v) + if (component[v] >= num_components + || header[component[v]] != v) + component[v] = component[representative[v]]; + + // initialize the "head" of the lists to "NULL" + std::fill_n(header, num_components, num_nodes); + + // Add each vertex to the linked list for its component + Parent1 next = component; + for (Integer k = 0; k != num_nodes; ++k) + array_push_front(next, header[component[k]], k); + } + + + + template + void + construct_component_index(IndexContainer& index, HeaderContainer& header) + { + typedef typename IndexContainer::value_type Integer; + build_components_header(index.begin(), + std::back_inserter(header), + Integer(index.end() - index.begin())); + + link_components(index.begin(), header.begin(), + Integer(index.end() - index.begin()), + Integer(header.end() - header.begin())); + } + + + + template + class component_iterator + : boost::forward_iterator_helper< + component_iterator, + Integer, Distance,Integer*, Integer&> + { + public: + typedef component_iterator self; + + IndexIterator next; + Integer node; + + typedef std::forward_iterator_tag iterator_category; + typedef Integer value_type; + typedef Integer& reference; + typedef Integer* pointer; + typedef Distance difference_type; + + component_iterator() {} + component_iterator(IndexIterator x, Integer i) + : next(x), node(i) {} + Integer operator*() const { + return node; + } + self& operator++() { + node = next[node]; + return *this; + } + }; + + template + inline bool + operator==(const component_iterator& x, + const component_iterator& y) + { + return x.node == y.node; + } + + } // namespace detail + +} // namespace detail + +#endif // BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/indexed_properties.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/indexed_properties.hpp new file mode 100644 index 0000000000..17bbdad1a4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/indexed_properties.hpp @@ -0,0 +1,180 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine + +// Indexed properties -- used for CSR and CSR-like graphs + +#ifndef BOOST_GRAPH_INDEXED_PROPERTIES_HPP +#define BOOST_GRAPH_INDEXED_PROPERTIES_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace detail { + +template +class indexed_vertex_properties +{ +public: + typedef no_property vertex_property_type; + typedef Property vertex_bundled; + + // Directly access a vertex or edge bundle + Property& operator[](Descriptor v) + { return m_vertex_properties[get(vertex_index, derived(), v)]; } + + const Property& operator[](Descriptor v) const + { return m_vertex_properties[get(vertex_index, derived(), v)]; } + +protected: + // Default-construct with no property values + indexed_vertex_properties() {} + + // Initialize with n default-constructed property values + indexed_vertex_properties(std::size_t n) : m_vertex_properties(n) { } + +public: + // Resize the properties vector + void resize(std::size_t n) + { + m_vertex_properties.resize(n); + } + + // Reserve space in the vector of properties + void reserve(std::size_t n) + { + m_vertex_properties.reserve(n); + } + + // Add a new property value to the back + void push_back(const Property& prop) + { + m_vertex_properties.push_back(prop); + } + + // Access to the derived object + Derived& derived() { return *static_cast(this); } + + const Derived& derived() const + { return *static_cast(this); } + +public: // should be private, but friend templates not portable + std::vector m_vertex_properties; +}; + +template +class indexed_vertex_properties +{ + struct secret {}; + + public: + typedef no_property vertex_property_type; + typedef void vertex_bundled; + + secret operator[](secret) { return secret(); } + + protected: + // All operations do nothing. + indexed_vertex_properties() { } + indexed_vertex_properties(std::size_t) { } + +public: + void resize(std::size_t) { } + void reserve(std::size_t) { } +}; + +template +class indexed_edge_properties +{ +public: + typedef no_property edge_property_type; + typedef Property edge_bundled; + typedef Property edge_push_back_type; + + // Directly access a edge or edge bundle + Property& operator[](Descriptor v) + { return m_edge_properties[get(edge_index, derived(), v)]; } + + const Property& operator[](Descriptor v) const + { return m_edge_properties[get(edge_index, derived(), v)]; } + +protected: + // Default-construct with no property values + indexed_edge_properties() {} + + // Initialize with n default-constructed property values + indexed_edge_properties(std::size_t n) : m_edge_properties(n) { } + + // Resize the properties vector + void resize(std::size_t n) + { + m_edge_properties.resize(n); + } + + // Reserve space in the vector of properties + void reserve(std::size_t n) + { + m_edge_properties.reserve(n); + } + + public: + // Add a new property value to the back + void push_back(const Property& prop) + { + m_edge_properties.push_back(prop); + } + + private: + // Access to the derived object + Derived& derived() { return *static_cast(this); } + + const Derived& derived() const + { return *static_cast(this); } + +public: // should be private, but friend templates not portable + std::vector m_edge_properties; +}; + +template +class indexed_edge_properties +{ + struct secret {}; + + public: + typedef no_property edge_property_type; + typedef void edge_bundled; + typedef void* edge_push_back_type; + + secret operator[](secret) { return secret(); } + + protected: + // All operations do nothing. + indexed_edge_properties() { } + indexed_edge_properties(std::size_t) { } + void resize(std::size_t) { } + void reserve(std::size_t) { } + + public: + void push_back(const edge_push_back_type&) { } +}; + +} +} + +#endif // BOOST_GRAPH_INDEXED_PROPERTIES_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/is_same.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/is_same.hpp new file mode 100644 index 0000000000..8027a47a77 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/is_same.hpp @@ -0,0 +1,40 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DETAIL_IS_SAME_HPP +#define BOOST_GRAPH_DETAIL_IS_SAME_HPP + +#include + +namespace boost { + struct false_tag; + struct true_tag; + + namespace graph_detail { + +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template + struct is_same { + typedef boost::false_tag is_same_tag; + }; + template + struct is_same { + typedef boost::true_tag is_same_tag; + }; +#else + template + struct is_same { + enum { Unum = U::num, Vnum = V::num }; + typedef typename mpl::if_c< (Unum == Vnum), + boost::true_tag, boost::false_tag>::type is_same_tag; + }; +#endif + } // namespace graph_detail +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/list_base.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/list_base.hpp new file mode 100644 index 0000000000..88d831650b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/list_base.hpp @@ -0,0 +1,220 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_LIST_BASE_HPP +#define BOOST_LIST_BASE_HPP + +#include + +// Perhaps this should go through formal review, and move to . + +/* + An alternate interface idea: + Extend the std::list functionality by creating remove/insert + functions that do not require the container object! + */ + +namespace boost { + namespace detail { + + //========================================================================= + // Linked-List Generic Implementation Functions + + template + inline Node + slist_insert_after(Node pos, Node x, + Next next) + { + next(x) = next(pos); + next(pos) = x; + return x; + } + + // return next(pos) or next(next(pos)) ? + template + inline Node + slist_remove_after(Node pos, + Next next) + { + Node n = next(pos); + next(pos) = next(n); + return n; + } + + template + inline Node + slist_remove_range(Node before_first, Node last, + Next next) + { + next(before_first) = last; + return last; + } + + template + inline Node + slist_previous(Node head, Node x, Node nil, + Next next) + { + while (head != nil && next(head) != x) + head = next(head); + return head; + } + + template + inline void + slist_splice_after(Node pos, Node before_first, Node before_last, + Next next) + { + if (pos != before_first && pos != before_last) { + Node first = next(before_first); + Node after = next(pos); + next(before_first) = next(before_last); + next(pos) = first; + next(before_last) = after; + } + } + + template + inline Node + slist_reverse(Node node, Node nil, + Next next) + { + Node result = node; + node = next(node); + next(result) = nil; + while(node) { + Node next = next(node); + next(node) = result; + result = node; + node = next; + } + return result; + } + + template + inline std::size_t + slist_size(Node head, Node nil, + Next next) + { + std::size_t s = 0; + for ( ; head != nil; head = next(head)) + ++s; + return s; + } + + template + class slist_iterator_policies + { + public: + explicit slist_iterator_policies(const Next& n, const Data& d) + : m_next(n), m_data(d) { } + + template + Reference dereference(type, const Node& x) const + { return m_data(x); } + + template + void increment(Node& x) const + { x = m_next(x); } + + template + bool equal(Node& x, Node& y) const + { return x == y; } + + protected: + Next m_next; + Data m_data; + }; + + //=========================================================================== + // Doubly-Linked List Generic Implementation Functions + + template + inline void + dlist_insert_before(Node pos, Node x, + Next next, Prev prev) + { + next(x) = pos; + prev(x) = prev(pos); + next(prev(pos)) = x; + prev(pos) = x; + } + + template + void + dlist_remove(Node pos, + Next next, Prev prev) + { + Node next_node = next(pos); + Node prev_node = prev(pos); + next(prev_node) = next_node; + prev(next_node) = prev_node; + } + + // This deletes every node in the list except the + // sentinel node. + template + inline void + dlist_clear(Node sentinel, Delete del) + { + Node i, tmp; + i = next(sentinel); + while (i != sentinel) { + tmp = i; + i = next(i); + del(tmp); + } + } + + template + inline bool + dlist_empty(Node dummy) + { + return next(dummy) == dummy; + } + + template + void + dlist_transfer(Node pos, Node first, Node last, + Next next, Prev prev) + { + if (pos != last) { + // Remove [first,last) from its old position + next(prev(last)) = pos; + next(prev(first)) = last; + next(prev(pos)) = first; + + // Splice [first,last) into its new position + Node tmp = prev(pos); + prev(pos) = prev(last); + prev(last) = prev(first); + prev(first) = tmp; + } + } + + template + class dlist_iterator_policies + : public slist_iterator_policies + { + typedef slist_iterator_policies Base; + public: + template + void decrement(Node& x) const + { x = m_prev(x); } + + dlist_iterator_policies(Next n, Prev p, Data d) + : Base(n,d), m_prev(p) { } + protected: + Prev m_prev; + }; + + } // namespace detail +} // namespace boost + +#endif // BOOST_LIST_BASE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/permutation.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/permutation.hpp new file mode 100644 index 0000000000..f1db906ab1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/permutation.hpp @@ -0,0 +1,205 @@ +// (C) Copyright Jeremy Siek 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) + +#ifndef BOOST_PERMUTATION_HPP +#define BOOST_PERMUTATION_HPP + +#include +#include +#include +#include +#include + +namespace boost { + +template +void permute_serial(Iter1 permuter, Iter1 last, Iter2 result) +{ +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + typedef std::ptrdiff_t D: +#else + typedef typename std::iterator_traits::difference_type D; +#endif + + D n = 0; + while (permuter != last) { + std::swap(result[n], result[*permuter]); + ++n; + ++permuter; + } +} + +template +void permute_copy(InIter first, InIter last, RandIterP p, RandIterR result) +{ +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + typedef std::ptrdiff_t i = 0; +#else + typename std::iterator_traits::difference_type i = 0; +#endif + for (; first != last; ++first, ++i) + result[p[i]] = *first; +} + +namespace detail { + +template +void permute_helper(RandIter first, RandIter last, RandIterPerm p, D, T) +{ + D i = 0, pi, n = last - first, cycle_start; + T tmp; + std::vector visited(n, false); + + while (i != n) { // continue until all elements have been processed + cycle_start = i; + tmp = first[i]; + do { // walk around a cycle + pi = p[i]; + visited[pi] = true; + std::swap(tmp, first[pi]); + i = pi; + } while (i != cycle_start); + + // find the next cycle + for (i = 0; i < n; ++i) + if (visited[i] == false) + break; + } +} + +} // namespace detail + +template +void permute(RandIter first, RandIter last, RandIterPerm p) +{ + detail::permute_helper(first, last, p, last - first, *first); +} + + +// Knuth 1.3.3, Vol. 1 p 176 +// modified for zero-based arrays +// time complexity? +// +// WARNING: T must be a signed integer! +template +void invert_permutation(PermIter X, PermIter Xend) +{ +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + typedef std::ptrdiff_t T: +#else + typedef typename std::iterator_traits::value_type T; +#endif + T n = Xend - X; + T m = n; + T j = -1; + + while (m > 0) { + T i = X[m-1] + 1; + if (i > 0) { + do { + X[m-1] = j - 1; + j = -m; + m = i; + i = X[m-1] + 1; + } while (i > 0); + i = j; + } + X[m-1] = -i - 1; + --m; + } +} + +// Takes a "normal" permutation array (and its inverse), and turns it +// into a BLAS-style permutation array (which can be thought of as a +// serialized permutation). +template +inline void serialize_permutation(Iter1 q, Iter1 q_end, Iter2 q_inv, Iter3 p) +{ +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + typedef std::ptrdiff_t P1; + typedef std::ptrdiff_t P2; + typedef std::ptrdiff_t D; +#else + typedef typename std::iterator_traits::value_type P1; + typedef typename std::iterator_traits::value_type P2; + typedef typename std::iterator_traits::difference_type D; +#endif + D n = q_end - q; + for (D i = 0; i < n; ++i) { + P1 qi = q[i]; + P2 qii = q_inv[i]; + *p++ = qii; + std::swap(q[i], q[qii]); + std::swap(q_inv[i], q_inv[qi]); + } +} + +// Not used anymore, leaving it here for future reference. +template +void merge_sort(Iter first, Iter last, Compare cmp) +{ + if (first + 1 < last) { + Iter mid = first + (last - first)/2; + merge_sort(first, mid, cmp); + merge_sort(mid, last, cmp); + std::inplace_merge(first, mid, last, cmp); + } +} + + +// time: N log N + 3N + ? +// space: 2N +template +inline void sortp(Iter first, Iter last, IterP p, Cmp cmp, Alloc alloc) +{ + typedef typename std::iterator_traits::value_type P; + typedef typename std::iterator_traits::difference_type D; + D n = last - first; + std::vector q(n); + for (D i = 0; i < n; ++i) + q[i] = i; + std::sort(make_shadow_iter(first, q.begin()), + make_shadow_iter(last, q.end()), + shadow_cmp(cmp)); + invert_permutation(q.begin(), q.end()); + std::copy(q.begin(), q.end(), p); +} + +template +inline void sortp(Iter first, Iter last, IterP p, Cmp cmp) +{ + typedef typename std::iterator_traits::value_type P; + sortp(first, last, p, cmp, std::allocator

()); +} + +template +inline void sortp(Iter first, Iter last, IterP p) +{ + typedef typename std::iterator_traits::value_type T; + typedef typename std::iterator_traits::value_type P; + sortp(first, last, p, std::less(), std::allocator

()); +} + +template +inline void sortv(Iter first, Iter last, IterP p, Cmp cmp, Alloc alloc) +{ + typedef typename std::iterator_traits::value_type P; + typedef typename std::iterator_traits::difference_type D; + D n = last - first; + std::vector q(n), q_inv(n); + for (D i = 0; i < n; ++i) + q_inv[i] = i; + std::sort(make_shadow_iter(first, q_inv.begin()), + make_shadow_iter(last, q_inv.end()), + shadow_cmp(cmp)); + std::copy(q_inv, q_inv.end(), q.begin()); + invert_permutation(q.begin(), q.end()); + serialize_permutation(q.begin(), q.end(), q_inv.end(), p); +} + + +} // namespace boost + +#endif // BOOST_PERMUTATION_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/read_graphviz_spirit.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/read_graphviz_spirit.hpp new file mode 100644 index 0000000000..16224c2392 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/read_graphviz_spirit.hpp @@ -0,0 +1,611 @@ +// Copyright 2004-5 Trustees of Indiana University + +// 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) + +// +// read_graphviz_spirit.hpp - +// Initialize a model of the BGL's MutableGraph concept and an associated +// collection of property maps using a graph expressed in the GraphViz +// DOT Language. +// +// Based on the grammar found at: +// http://www.graphviz.org/cvs/doc/info/lang.html +// +// See documentation for this code at: +// http://www.boost.org/libs/graph/doc/read-graphviz.html +// + +// Author: Ronald Garcia +// + +#ifndef BOOST_READ_GRAPHVIZ_SPIRIT_HPP +#define BOOST_READ_GRAPHVIZ_SPIRIT_HPP + +// Phoenix/Spirit set these limits to 3, but I need more. +#define PHOENIX_LIMIT 6 +#define BOOST_SPIRIT_CLOSURE_LIMIT 6 + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for std::exception +#include +#include +#include +#include +#include +#include +#include + +namespace phoenix { +// Workaround: std::map::operator[] uses a different return type than all +// other standard containers. Phoenix doesn't account for that. +template +struct binary_operator, T1> +{ + typedef typename std::map::mapped_type& result_type; + static result_type eval(std::map& container, T1 const& index) + { return container[index]; } +}; +} // namespace phoenix + +namespace boost { +namespace detail { +namespace graph { + + +///////////////////////////////////////////////////////////////////////////// +// Application-specific type definitions +///////////////////////////////////////////////////////////////////////////// + +typedef std::set edges_t; +typedef std::set nodes_t; +typedef std::set ids_t; +typedef std::map edge_map_t; +typedef std::map node_map_t; +typedef std::map props_t; +typedef std::map subgraph_props_t; +typedef boost::function2 actor_t; +typedef std::vector edge_stack_t; +typedef std::map subgraph_nodes_t; +typedef std::map subgraph_edges_t; + + + +///////////////////////////////////////////////////////////////////////////// +// Stack frames used by semantic actions +///////////////////////////////////////////////////////////////////////////// +struct id_closure : boost::spirit::closure { + member1 name; +}; + + +struct node_id_closure : boost::spirit::closure { + member1 name; +}; + +struct attr_list_closure : boost::spirit::closure { + member1 prop_actor; +}; + +struct property_closure : boost::spirit::closure { + member1 key; + member2 value; +}; + +struct data_stmt_closure : boost::spirit::closure { + member1 sources; + member2 dests; + member3 edge_stack; + member4 saw_node; + member5 active_node; +}; + +struct subgraph_closure : boost::spirit::closure { + member1 nodes; + member2 edges; + member3 name; +}; + +///////////////////////////////////////////////////////////////////////////// +// Grammar and Actions for the DOT Language +///////////////////////////////////////////////////////////////////////////// + +// Grammar for a dot file. +struct dot_grammar : public boost::spirit::grammar { + mutate_graph& graph_; + explicit dot_grammar(mutate_graph& graph) : graph_(graph) { } + + template + struct definition { + + definition(dot_grammar const& self) : self(self), subgraph_depth(0), + keyword_p("0-9a-zA-Z_") { + using namespace boost::spirit; + using namespace phoenix; + + // RG - Future Work + // - Handle multi-line strings using \ line continuation + // - Make keywords case insensitive + ID + = ( lexeme_d[((alpha_p | ch_p('_')) >> *(alnum_p | ch_p('_')))] + | real_p + | lexeme_d[confix_p('"', *c_escape_ch_p, '"')] + | comment_nest_p('<', '>') + )[ID.name = construct_(arg1,arg2)] + ; + + a_list + = list_p( ID[(a_list.key = arg1), + (a_list.value = "true") + ] + >> !( ch_p('=') + >> ID[a_list.value = arg1]) + [phoenix::bind(&definition::call_prop_actor) + (var(*this),a_list.key,a_list.value)],!ch_p(',')); + + attr_list = +(ch_p('[') >> !a_list >> ch_p(']')); + + // RG - disregard port id's for now. + port_location + = (ch_p(':') >> ID) + | (ch_p(':') >> ch_p('(') >> ID >> ch_p(',') >> ID >> ch_p(')')) + ; + + port_angle = ch_p('@') >> ID; + + port + = port_location >> (!port_angle) + | port_angle >> (!port_location); + + + node_id + = ( ID[node_id.name = arg1] >> (!port) ) + [phoenix::bind(&definition::memoize_node)(var(*this))]; + + graph_stmt + = (ID[graph_stmt.key = arg1] >> + ch_p('=') >> + ID[graph_stmt.value = arg1]) + [phoenix::bind(&definition::call_graph_prop) + (var(*this),graph_stmt.key,graph_stmt.value)] + ; // Graph property. + + attr_stmt + = (as_lower_d[keyword_p("graph")] + >> attr_list(actor_t(phoenix::bind(&definition::default_graph_prop) + (var(*this),arg1,arg2)))) + | (as_lower_d[keyword_p("node")] + >> attr_list(actor_t(phoenix::bind(&definition::default_node_prop) + (var(*this),arg1,arg2)))) + | (as_lower_d[keyword_p("edge")] + >> attr_list(actor_t(phoenix::bind(&definition::default_edge_prop) + (var(*this),arg1,arg2)))) + ; + + // edge_head is set depending on the graph type (directed/undirected) + edgeop = ch_p('-') >> ch_p(boost::ref(edge_head)); + + edgeRHS + = +( edgeop[(data_stmt.sources = data_stmt.dests), + (data_stmt.dests = construct_())] + >> ( subgraph[data_stmt.dests = arg1] + | node_id[phoenix::bind(&definition::insert_node) + (var(*this),data_stmt.dests,arg1)] + ) + [phoenix::bind(&definition::activate_edge) + (var(*this),data_stmt.sources,data_stmt.dests, + var(edges), var(default_edge_props))] + ); + + + // To avoid backtracking, edge, node, and subgraph statements are + // processed as one nonterminal. + data_stmt + = ( subgraph[(data_stmt.dests = arg1),// will get moved in rhs + (data_stmt.saw_node = false)] + | node_id[(phoenix::bind(&definition::insert_node) + (var(*this),data_stmt.dests,arg1)), + (data_stmt.saw_node = true), +#ifdef BOOST_GRAPH_DEBUG + (std::cout << val("AcTive Node: ") << arg1 << "\n"), +#endif // BOOST_GRAPH_DEBUG + (data_stmt.active_node = arg1)] + ) >> if_p(edgeRHS)[ + !attr_list( + actor_t(phoenix::bind(&definition::edge_prop) + (var(*this),arg1,arg2))) + ].else_p[ + if_p(data_stmt.saw_node)[ + !attr_list( + actor_t(phoenix::bind(&definition::node_prop) + (var(*this),arg1,arg2))) + ] // otherwise it's a subgraph, nothing more to do. + ]; + + + stmt + = graph_stmt + | attr_stmt + | data_stmt + ; + + stmt_list = *( stmt >> !ch_p(';') ); + + subgraph + = !( as_lower_d[keyword_p("subgraph")] + >> (!ID[(subgraph.name = arg1), + (subgraph.nodes = (var(subgraph_nodes))[arg1]), + (subgraph.edges = (var(subgraph_edges))[arg1])]) + ) + >> ch_p('{')[++var(subgraph_depth)] + >> stmt_list + >> ch_p('}')[--var(subgraph_depth)] + [(var(subgraph_nodes))[subgraph.name] = subgraph.nodes] + [(var(subgraph_edges))[subgraph.name] = subgraph.edges] + + | as_lower_d[keyword_p("subgraph")] + >> ID[(subgraph.nodes = (var(subgraph_nodes))[arg1]), + (subgraph.edges = (var(subgraph_edges))[arg1])] + ; + + the_grammar + = (!as_lower_d[keyword_p("strict")]) + >> ( as_lower_d[keyword_p("graph")][ + (var(edge_head) = '-'), + (phoenix::bind(&definition::check_undirected)(var(*this)))] + | as_lower_d[keyword_p("digraph")][ + (var(edge_head) = '>'), + (phoenix::bind(&definition::check_directed)(var(*this)))] + ) + >> (!ID) >> ch_p('{') >> stmt_list >> ch_p('}'); + + } // definition() + + typedef boost::spirit::rule rule_t; + + rule_t const& start() const { return the_grammar; } + + + // + // Semantic actions + // + + void check_undirected() { + if(self.graph_.is_directed()) + boost::throw_exception(boost::undirected_graph_error()); + } + + void check_directed() { + if(!self.graph_.is_directed()) + boost::throw_exception(boost::directed_graph_error()); + } + + void memoize_node() { + id_t const& node = node_id.name(); + props_t& node_props = default_node_props; + + if(nodes.find(node) == nodes.end()) { + nodes.insert(node); + self.graph_.do_add_vertex(node); + + node_map.insert(std::make_pair(node,ids_t())); + +#ifdef BOOST_GRAPH_DEBUG + std::cout << "Add new node " << node << std::endl; +#endif // BOOST_GRAPH_DEBUG + // Set the default properties for this edge + // RG: Here I would actually set the properties + for(props_t::iterator i = node_props.begin(); + i != node_props.end(); ++i) { + set_node_property(node,i->first,i->second); + } + if(subgraph_depth > 0) { + subgraph.nodes().insert(node); + // Set the subgraph's default properties as well + props_t& props = subgraph_node_props[subgraph.name()]; + for(props_t::iterator i = props.begin(); i != props.end(); ++i) { + set_node_property(node,i->first,i->second); + } + } + } else { +#ifdef BOOST_GRAPH_DEBUG + std::cout << "See node " << node << std::endl; +#endif // BOOST_GRAPH_DEBUG + } + } + + void activate_edge(nodes_t& sources, nodes_t& dests, edges_t& edges, + props_t& edge_props) { + edge_stack_t& edge_stack = data_stmt.edge_stack(); + for(nodes_t::iterator i = sources.begin(); i != sources.end(); ++i) { + for(nodes_t::iterator j = dests.begin(); j != dests.end(); ++j) { + // Create the edge and push onto the edge stack. +#ifdef BOOST_GRAPH_DEBUG + std::cout << "Edge " << *i << " to " << *j << std::endl; +#endif // BOOST_GRAPH_DEBUG + + edge_t edge = edge_t::new_edge(); + edge_stack.push_back(edge); + edges.insert(edge); + edge_map.insert(std::make_pair(edge,ids_t())); + + // Add the real edge. + self.graph_.do_add_edge(edge, *i, *j); + + // Set the default properties for this edge + for(props_t::iterator k = edge_props.begin(); + k != edge_props.end(); ++k) { + set_edge_property(edge,k->first,k->second); + } + if(subgraph_depth > 0) { + subgraph.edges().insert(edge); + // Set the subgraph's default properties as well + props_t& props = subgraph_edge_props[subgraph.name()]; + for(props_t::iterator k = props.begin(); k != props.end(); ++k) { + set_edge_property(edge,k->first,k->second); + } + } + } + } + } + + // node_prop - Assign the property for the current active node. + void node_prop(id_t const& key, id_t const& value) { + node_t& active_object = data_stmt.active_node(); + set_node_property(active_object, key, value); + } + + // edge_prop - Assign the property for the current active edges. + void edge_prop(id_t const& key, id_t const& value) { + edge_stack_t const& active_edges_ = data_stmt.edge_stack(); + for (edge_stack_t::const_iterator i = active_edges_.begin(); + i != active_edges_.end(); ++i) { + set_edge_property(*i,key,value); + } + } + + // default_graph_prop - Store as a graph property. + void default_graph_prop(id_t const& key, id_t const& value) { +#ifdef BOOST_GRAPH_DEBUG + std::cout << key << " = " << value << std::endl; +#endif // BOOST_GRAPH_DEBUG + self.graph_.set_graph_property(key, value); + } + + // default_node_prop - declare default properties for any future new nodes + void default_node_prop(id_t const& key, id_t const& value) { + nodes_t& nodes_ = + subgraph_depth == 0 ? nodes : subgraph.nodes(); + props_t& node_props_ = + subgraph_depth == 0 ? + default_node_props : + subgraph_node_props[subgraph.name()]; + + // add this to the selected list of default node properties. + node_props_[key] = value; + // for each node, set its property to default-constructed value + // if it hasn't been set already. + // set the dynamic property map value + for(nodes_t::iterator i = nodes_.begin(); i != nodes_.end(); ++i) + if(node_map[*i].find(key) == node_map[*i].end()) { + set_node_property(*i,key,id_t()); + } + } + + // default_edge_prop - declare default properties for any future new edges + void default_edge_prop(id_t const& key, id_t const& value) { + edges_t& edges_ = + subgraph_depth == 0 ? edges : subgraph.edges(); + props_t& edge_props_ = + subgraph_depth == 0 ? + default_edge_props : + subgraph_edge_props[subgraph.name()]; + + // add this to the list of default edge properties. + edge_props_[key] = value; + // for each edge, set its property to be empty string + // set the dynamic property map value + for(edges_t::iterator i = edges_.begin(); i != edges_.end(); ++i) + if(edge_map[*i].find(key) == edge_map[*i].end()) + set_edge_property(*i,key,id_t()); + } + + // helper function + void insert_node(nodes_t& nodes, id_t const& name) { + nodes.insert(name); + } + + void call_prop_actor(std::string const& lhs, std::string const& rhs) { + actor_t& actor = attr_list.prop_actor(); + // If first and last characters of the rhs are double-quotes, + // remove them. + if (!rhs.empty() && rhs[0] == '"' && rhs[rhs.size() - 1] == '"') + actor(lhs, rhs.substr(1, rhs.size()-2)); + else + actor(lhs,rhs); + } + + void call_graph_prop(std::string const& lhs, std::string const& rhs) { + // If first and last characters of the rhs are double-quotes, + // remove them. + if (!rhs.empty() && rhs[0] == '"' && rhs[rhs.size() - 1] == '"') + this->default_graph_prop(lhs, rhs.substr(1, rhs.size()-2)); + else + this->default_graph_prop(lhs,rhs); + } + + void set_node_property(node_t const& node, id_t const& key, + id_t const& value) { + + // Add the property key to the "set" table to avoid default overwrite + node_map[node].insert(key); + // Set the user's property map + self.graph_.set_node_property(key, node, value); +#ifdef BOOST_GRAPH_DEBUG + // Tell the world + std::cout << node << ": " << key << " = " << value << std::endl; +#endif // BOOST_GRAPH_DEBUG + } + + void set_edge_property(edge_t const& edge, id_t const& key, + id_t const& value) { + + // Add the property key to the "set" table to avoid default overwrite + edge_map[edge].insert(key); + // Set the user's property map + self.graph_.set_edge_property(key, edge, value); +#ifdef BOOST_GRAPH_DEBUG + // Tell the world +#if 0 // RG - edge representation changed, + std::cout << "(" << edge.first << "," << edge.second << "): " +#else + std::cout << "an edge: " +#endif // 0 + << key << " = " << value << std::endl; +#endif // BOOST_GRAPH_DEBUG + } + + // Variables explicitly initialized + dot_grammar const& self; + // if subgraph_depth > 0, then we're processing a subgraph. + int subgraph_depth; + + // Keywords; + const boost::spirit::distinct_parser<> keyword_p; + // + // rules that make up the grammar + // + boost::spirit::rule ID; + boost::spirit::rule a_list; + boost::spirit::rule attr_list; + rule_t port_location; + rule_t port_angle; + rule_t port; + boost::spirit::rule node_id; + boost::spirit::rule graph_stmt; + rule_t attr_stmt; + boost::spirit::rule data_stmt; + boost::spirit::rule subgraph; + rule_t edgeop; + rule_t edgeRHS; + rule_t stmt; + rule_t stmt_list; + rule_t the_grammar; + + + // The grammar uses edge_head to dynamically set the syntax for edges + // directed graphs: edge_head = '>', and so edgeop = "->" + // undirected graphs: edge_head = '-', and so edgeop = "--" + char edge_head; + + + // + // Support data structures + // + + nodes_t nodes; // list of node names seen + edges_t edges; // list of edges seen + node_map_t node_map; // remember the properties set for each node + edge_map_t edge_map; // remember the properties set for each edge + + subgraph_nodes_t subgraph_nodes; // per-subgraph lists of nodes + subgraph_edges_t subgraph_edges; // per-subgraph lists of edges + + props_t default_node_props; // global default node properties + props_t default_edge_props; // global default edge properties + subgraph_props_t subgraph_node_props; // per-subgraph default node properties + subgraph_props_t subgraph_edge_props; // per-subgraph default edge properties + }; // struct definition +}; // struct dot_grammar + + + +// +// dot_skipper - GraphViz whitespace and comment skipper +// +struct dot_skipper : public boost::spirit::grammar +{ + dot_skipper() {} + + template + struct definition + { + definition(dot_skipper const& /*self*/) { + using namespace boost::spirit; + using namespace phoenix; + // comment forms + skip = eol_p >> comment_p("#") + | space_p + | comment_p("//") +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) + | confix_p(str_p("/*") ,*anychar_p, str_p("*/")) +#else + | confix_p("/*" ,*anychar_p, "*/") +#endif + ; + +#ifdef BOOST_SPIRIT_DEBUG + BOOST_SPIRIT_DEBUG_RULE(skip); +#endif + } + + boost::spirit::rule skip; + boost::spirit::rule const& + start() const { return skip; } + }; // definition +}; // dot_skipper + +} // namespace graph +} // namespace detail + +template +bool read_graphviz(MultiPassIterator begin, MultiPassIterator end, + MutableGraph& graph, dynamic_properties& dp, + std::string const& node_id = "node_id") { + using namespace boost; + using namespace boost::spirit; + + typedef MultiPassIterator iterator_t; + typedef skip_parser_iteration_policy< boost::detail::graph::dot_skipper> + iter_policy_t; + typedef scanner_policies scanner_policies_t; + typedef scanner scanner_t; + + ::boost::detail::graph::mutate_graph_impl + m_graph(graph, dp, node_id); + + ::boost::detail::graph::dot_grammar p(m_graph); + ::boost::detail::graph::dot_skipper skip_p; + + iter_policy_t iter_policy(skip_p); + scanner_policies_t policies(iter_policy); + + scanner_t scan(begin, end, policies); + + return p.parse(scan); +} + +} // namespace boost + +#endif // BOOST_READ_GRAPHVIZ_SPIRIT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/self_avoiding_walk.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/self_avoiding_walk.hpp new file mode 100644 index 0000000000..def0c6eef2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/self_avoiding_walk.hpp @@ -0,0 +1,418 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_SELF_AVOIDING_WALK_HPP +#define BOOST_SELF_AVOIDING_WALK_HPP + +/* + This file defines necessary components for SAW. + + mesh language: (defined by myself to clearify what is what) + A triangle in mesh is called an triangle. + An edge in mesh is called an line. + A vertex in mesh is called a point. + + A triangular mesh corresponds to a graph in which a vertex is a + triangle and an edge(u, v) stands for triangle u and triangle v + share an line. + + After this point, a vertex always refers to vertex in graph, + therefore it is a traingle in mesh. + + */ + +#include +#include +#include +#include + +#define SAW_SENTINAL -1 + +namespace boost { + + template + struct triple { + T1 first; + T2 second; + T3 third; + triple(const T1& a, const T2& b, const T3& c) : first(a), second(b), third(c) {} + triple() : first(SAW_SENTINAL), second(SAW_SENTINAL), third(SAW_SENTINAL) {} + }; + + typedef triple Triple; + + /* Define a vertex property which has a triangle inside. Triangle is + represented by a triple. */ + struct triangle_tag { enum { num = 100 }; }; + typedef property triangle_property; + + /* Define an edge property with a line. A line is represented by a + pair. This is not required for SAW though. + */ + struct line_tag { enum { num = 101 }; }; + template struct line_property + : public property > { }; + + /*Precondition: Points in a Triangle are in order */ + template + inline void get_sharing(const Triangle& a, const Triangle& b, Line& l) + { + l.first = SAW_SENTINAL; + l.second = SAW_SENTINAL; + + if ( a.first == b.first ) { + l.first = a.first; + if ( a.second == b.second || a.second == b.third ) + l.second = a.second; + else if ( a.third == b.second || a.third == b.third ) + l.second = a.third; + + } else if ( a.first == b.second ) { + l.first = a.first; + if ( a.second == b.third ) + l.second = a.second; + else if ( a.third == b.third ) + l.second = a.third; + + } else if ( a.first == b.third ) { + l.first = a.first; + + + } else if ( a.second == b.first ) { + l.first = a.second; + if ( a.third == b.second || a.third == b.third ) + l.second = a.third; + + } else if ( a.second == b.second ) { + l.first = a.second; + if ( a.third == b.third ) + l.second = a.third; + + } else if ( a.second == b.third ) { + l.first = a.second; + + + } else if ( a.third == b.first + || a.third == b.second + || a.third == b.third ) + l.first = a.third; + + /*Make it in order*/ + if ( l.first > l.second ) { + typename Line::first_type i = l.first; + l.first = l.second; + l.second = i; + } + + } + + template + struct get_vertex_sharing { + typedef std::pair Pair; + get_vertex_sharing(const TriangleDecorator& _td) : td(_td) {} + inline Line operator()(const Vertex& u, const Vertex& v) const { + Line l; + get_sharing(td[u], td[v], l); + return l; + } + inline Line operator()(const Pair& u, const Vertex& v) const { + Line l; + get_sharing(td[u.first], td[v], l); + return l; + } + inline Line operator()(const Pair& u, const Pair& v) const { + Line l; + get_sharing(td[u.first], td[v.first], l); + return l; + } + TriangleDecorator td; + }; + + /* HList has to be a handle of data holder so that pass-by-value is + * in right logic. + * + * The element of HList is a pair of vertex and line. (remember a + * line is a pair of two ints.). That indicates the walk w from + * current vertex is across line. (If the first of line is -1, it is + * a point though. + */ + template < class TriangleDecorator, class HList, class IteratorD> + class SAW_visitor + : public bfs_visitor<>, public dfs_visitor<> + { + typedef typename boost::property_traits::value_type iter; + /*use boost shared_ptr*/ + typedef typename HList::element_type::value_type::second_type Line; + public: + + typedef tree_edge_tag category; + + inline SAW_visitor(TriangleDecorator _td, HList _hlist, IteratorD ia) + : td(_td), hlist(_hlist), iter_d(ia) {} + + template + inline void start_vertex(Vertex v, Graph&) { + Line l1; + l1.first = SAW_SENTINAL; + l1.second = SAW_SENTINAL; + hlist->push_front(std::make_pair(v, l1)); + iter_d[v] = hlist->begin(); + } + + /*Several symbols: + w(i): i-th triangle in walk w + w(i) |- w(i+1): w enter w(i+1) from w(i) over a line + w(i) ~> w(i+1): w enter w(i+1) from w(i) over a point + w(i) -> w(i+1): w enter w(i+1) from w(i) + w(i) ^ w(i+1): the line or point w go over from w(i) to w(i+1) + */ + template + bool tree_edge(Edge e, Graph& G) { + using std::make_pair; + typedef typename boost::graph_traits::vertex_descriptor Vertex; + Vertex tau = target(e, G); + Vertex i = source(e, G); + + get_vertex_sharing get_sharing_line(td); + + Line tau_i = get_sharing_line(tau, i); + + iter w_end = hlist->end(); + + iter w_i = iter_d[i]; + + iter w_i_m_1 = w_i; + iter w_i_p_1 = w_i; + + /*---------------------------------------------------------- + * true false + *========================================================== + *a w(i-1) |- w(i) w(i-1) ~> w(i) or w(i-1) is null + *---------------------------------------------------------- + *b w(i) |- w(i+1) w(i) ~> w(i+1) or no w(i+1) yet + *---------------------------------------------------------- + */ + + bool a = false, b = false; + + --w_i_m_1; + ++w_i_p_1; + b = ( w_i->second.first != SAW_SENTINAL ); + + if ( w_i_m_1 != w_end ) { + a = ( w_i_m_1->second.first != SAW_SENTINAL ); + } + + if ( a ) { + + if ( b ) { + /*Case 1: + + w(i-1) |- w(i) |- w(i+1) + */ + Line l1 = get_sharing_line(*w_i_m_1, tau); + + iter w_i_m_2 = w_i_m_1; + --w_i_m_2; + + bool c = true; + + if ( w_i_m_2 != w_end ) { + c = w_i_m_2->second != l1; + } + + if ( c ) { /* w(i-1) ^ tau != w(i-2) ^ w(i-1) */ + /*extension: w(i-1) -> tau |- w(i) */ + w_i_m_1->second = l1; + /*insert(pos, const T&) is to insert before pos*/ + iter_d[tau] = hlist->insert(w_i, make_pair(tau, tau_i)); + + } else { /* w(i-1) ^ tau == w(i-2) ^ w(i-1) */ + /*must be w(i-2) ~> w(i-1) */ + + bool d = true; + //need to handle the case when w_i_p_1 is null + Line l3 = get_sharing_line(*w_i_p_1, tau); + if ( w_i_p_1 != w_end ) + d = w_i_p_1->second != l3; + if ( d ) { /* w(i+1) ^ tau != w(i+1) ^ w(i+2) */ + /*extension: w(i) |- tau -> w(i+1) */ + w_i->second = tau_i; + iter_d[tau] = hlist->insert(w_i_p_1, make_pair(tau, l3)); + } else { /* w(i+1) ^ tau == w(i+1) ^ w(i+2) */ + /*must be w(1+1) ~> w(i+2) */ + Line l5 = get_sharing_line(*w_i_m_1, *w_i_p_1); + if ( l5 != w_i_p_1->second ) { /* w(i-1) ^ w(i+1) != w(i+1) ^ w(i+2) */ + /*extension: w(i-2) -> tau |- w(i) |- w(i-1) -> w(i+1) */ + w_i_m_2->second = get_sharing_line(*w_i_m_2, tau); + iter_d[tau] = hlist->insert(w_i, make_pair(tau, tau_i)); + w_i->second = w_i_m_1->second; + w_i_m_1->second = l5; + iter_d[w_i_m_1->first] = hlist->insert(w_i_p_1, *w_i_m_1); + hlist->erase(w_i_m_1); + } else { + /*mesh is tetrahedral*/ + // dont know what that means. + ; + } + } + + } + } else { + /*Case 2: + + w(i-1) |- w(i) ~> w(1+1) + */ + + if ( w_i->second.second == tau_i.first + || w_i->second.second == tau_i.second ) { /*w(i) ^ w(i+1) < w(i) ^ tau*/ + /*extension: w(i) |- tau -> w(i+1) */ + w_i->second = tau_i; + Line l1 = get_sharing_line(*w_i_p_1, tau); + iter_d[tau] = hlist->insert(w_i_p_1, make_pair(tau, l1)); + } else { /*w(i) ^ w(i+1) !< w(i) ^ tau*/ + Line l1 = get_sharing_line(*w_i_m_1, tau); + bool c = true; + iter w_i_m_2 = w_i_m_1; + --w_i_m_2; + if ( w_i_m_2 != w_end ) + c = l1 != w_i_m_2->second; + if (c) { /*w(i-1) ^ tau != w(i-2) ^ w(i-1)*/ + /*extension: w(i-1) -> tau |- w(i)*/ + w_i_m_1->second = l1; + iter_d[tau] = hlist->insert(w_i, make_pair(tau, tau_i)); + } else { /*w(i-1) ^ tau == w(i-2) ^ w(i-1)*/ + /*must be w(i-2)~>w(i-1)*/ + /*extension: w(i-2) -> tau |- w(i) |- w(i-1) -> w(i+1)*/ + w_i_m_2->second = get_sharing_line(*w_i_m_2, tau); + iter_d[tau] = hlist->insert(w_i, make_pair(tau, tau_i)); + w_i->second = w_i_m_1->second; + w_i_m_1->second = get_sharing_line(*w_i_m_1, *w_i_p_1); + iter_d[w_i_m_1->first] = hlist->insert(w_i_p_1, *w_i_m_1); + hlist->erase(w_i_m_1); + } + + } + + } + + } else { + + if ( b ) { + /*Case 3: + + w(i-1) ~> w(i) |- w(i+1) + */ + bool c = false; + if ( w_i_m_1 != w_end ) + c = ( w_i_m_1->second.second == tau_i.first) + || ( w_i_m_1->second.second == tau_i.second); + + if ( c ) { /*w(i-1) ^ w(i) < w(i) ^ tau*/ + /* extension: w(i-1) -> tau |- w(i) */ + if ( w_i_m_1 != w_end ) + w_i_m_1->second = get_sharing_line(*w_i_m_1, tau); + iter_d[tau] = hlist->insert(w_i, make_pair(tau, tau_i)); + } else { + bool d = true; + Line l1; + l1.first = SAW_SENTINAL; + l1.second = SAW_SENTINAL; + if ( w_i_p_1 != w_end ) { + l1 = get_sharing_line(*w_i_p_1, tau); + d = l1 != w_i_p_1->second; + } + if (d) { /*w(i+1) ^ tau != w(i+1) ^ w(i+2)*/ + /*extension: w(i) |- tau -> w(i+1) */ + w_i->second = tau_i; + iter_d[tau] = hlist->insert(w_i_p_1, make_pair(tau, l1)); + } else { + /*must be w(i+1) ~> w(i+2)*/ + /*extension: w(i-1) -> w(i+1) |- w(i) |- tau -> w(i+2) */ + iter w_i_p_2 = w_i_p_1; + ++w_i_p_2; + + w_i_p_1->second = w_i->second; + iter_d[i] = hlist->insert(w_i_p_2, make_pair(i, tau_i)); + hlist->erase(w_i); + Line l2 = get_sharing_line(*w_i_p_2, tau); + iter_d[tau] = hlist->insert(w_i_p_2, make_pair(tau, l2)); + } + } + + } else { + /*Case 4: + + w(i-1) ~> w(i) ~> w(i+1) + + */ + bool c = false; + if ( w_i_m_1 != w_end ) { + c = (w_i_m_1->second.second == tau_i.first) + || (w_i_m_1->second.second == tau_i.second); + } + if ( c ) { /*w(i-1) ^ w(i) < w(i) ^ tau */ + /*extension: w(i-1) -> tau |- w(i) */ + if ( w_i_m_1 != w_end ) + w_i_m_1->second = get_sharing_line(*w_i_m_1, tau); + iter_d[tau] = hlist->insert(w_i, make_pair(tau, tau_i)); + } else { + /*extension: w(i) |- tau -> w(i+1) */ + w_i->second = tau_i; + Line l1; + l1.first = SAW_SENTINAL; + l1.second = SAW_SENTINAL; + if ( w_i_p_1 != w_end ) + l1 = get_sharing_line(*w_i_p_1, tau); + iter_d[tau] = hlist->insert(w_i_p_1, make_pair(tau, l1)); + } + } + + } + + return true; + } + + protected: + TriangleDecorator td; /*a decorator for vertex*/ + HList hlist; + /*This must be a handle of list to record the SAW + The element type of the list is pair + */ + + IteratorD iter_d; + /*Problem statement: Need a fast access to w for triangle i. + *Possible solution: mantain an array to record. + iter_d[i] will return an iterator + which points to w(i), where i is a vertex + representing triangle i. + */ + }; + + template + inline + SAW_visitor + visit_SAW(Triangle t, HList hl, Iterator i) { + return SAW_visitor(t, hl, i); + } + + template + inline + SAW_visitor< random_access_iterator_property_map, + HList, random_access_iterator_property_map > + visit_SAW_ptr(Tri* t, HList hl, Iter* i) { + typedef random_access_iterator_property_map TriD; + typedef random_access_iterator_property_map IterD; + return SAW_visitor(t, hl, i); + } + + // should also have combo's of pointers, and also const :( + +} + +#endif /*BOOST_SAW_H*/ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/set_adaptor.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/set_adaptor.hpp new file mode 100644 index 0000000000..eb81dbba86 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/set_adaptor.hpp @@ -0,0 +1,117 @@ +// (C) Copyright Jeremy Siek 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) + +#ifndef BOOST_SET_ADAPTOR_HPP +#define BOOST_SET_ADAPTOR_HPP + +#include + +namespace boost { + + template + bool set_contains(const std::set& s, const T& x) { + return s.find(x) != s.end(); + } + + template + bool set_equal(const std::set& x, + const std::set& y) + { + return x == y; + } + + // Not the same as lexicographical_compare_3way applied to std::set. + // this is equivalent semantically to bitset::operator<() + template + int set_lex_order(const std::set& x, + const std::set& y) + { + typename std::set::iterator + xi = x.begin(), yi = y.begin(), xend = x.end(), yend = y.end(); + for (; xi != xend && yi != yend; ++xi, ++yi) { + if (*xi < *yi) + return 1; + else if (*yi < *xi) + return -1; + } + if (xi == xend) + return (yi == yend) ? 0 : -1; + else + return 1; + } + + template + void set_clear(std::set& x) { + x.clear(); + } + + template + bool set_empty(const std::set& x) { + return x.empty(); + } + + template + void set_insert(std::set& x, const T& a) { + x.insert(a); + } + + template + void set_remove(std::set& x, const T& a) { + x.erase(a); + } + + template + void set_intersect(const std::set& x, + const std::set& y, + std::set& z) + { + z.clear(); + std::set_intersection(x.begin(), x.end(), + y.begin(), y.end(), + std::inserter(z)); + } + + template + void set_union(const std::set& x, + const std::set& y, + std::set& z) + { + z.clear(); + std::set_union(x.begin(), x.end(), + y.begin(), y.end(), + std::inserter(z)); + } + + template + void set_difference(const std::set& x, + const std::set& y, + std::set& z) + { + z.clear(); + std::set_difference(x.begin(), x.end(), + y.begin(), y.end(), + std::inserter(z, z.begin())); + } + + template + bool set_subset(const std::set& x, + const std::set& y) + { + return std::includes(x.begin(), x.end(), y.begin(), y.end()); + } + + // Shit, can't implement this without knowing the size of the + // universe. + template + void set_compliment(const std::set& x, + std::set& z) + { + z.clear(); + + } + +} // namespace boost + +#endif // BOOST_SET_ADAPTOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/shadow_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/shadow_iterator.hpp new file mode 100644 index 0000000000..6cd15384fc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/shadow_iterator.hpp @@ -0,0 +1,139 @@ +// (C) Copyright Jeremy Siek 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) + +#ifndef BOOST_SHADOW_ITERATOR_HPP +#define BOOST_SHADOW_ITERATOR_HPP + +#include +#include + +namespace boost { + + namespace detail { + + template + class shadow_proxy + : boost::operators< shadow_proxy > + { + typedef shadow_proxy self; + public: + inline shadow_proxy(A aa, B bb) : a(aa), b(bb) { } + inline shadow_proxy(const self& x) : a(x.a), b(x.b) { } + template + inline shadow_proxy(Self x) : a(x.a), b(x.b) { } + inline self& operator=(const self& x) { a = x.a; b = x.b; return *this; } + inline self& operator++() { ++a; return *this; } + inline self& operator--() { --a; return *this; } + inline self& operator+=(const self& x) { a += x.a; return *this; } + inline self& operator-=(const self& x) { a -= x.a; return *this; } + inline self& operator*=(const self& x) { a *= x.a; return *this; } + inline self& operator/=(const self& x) { a /= x.a; return *this; } + inline self& operator%=(const self& x) { return *this; } // JGS + inline self& operator&=(const self& x) { return *this; } // JGS + inline self& operator|=(const self& x) { return *this; } // JGS + inline self& operator^=(const self& x) { return *this; } // JGS + inline friend D operator-(const self& x, const self& y) { + return x.a - y.a; + } + inline bool operator==(const self& x) const { return a == x.a; } + inline bool operator<(const self& x) const { return a < x.a; } + // protected: + A a; + B b; + }; + + struct shadow_iterator_policies + { + template + void initialize(const iter_pair&) { } + + template + typename Iter::reference dereference(const Iter& i) const { + typedef typename Iter::reference R; + return R(*i.base().first, *i.base().second); + } + template + bool equal(const Iter& p1, const Iter& p2) const { + return p1.base().first == p2.base().first; + } + template + void increment(Iter& i) { ++i.base().first; ++i.base().second; } + + template + void decrement(Iter& i) { --i.base().first; --i.base().second; } + + template + bool less(const Iter& x, const Iter& y) const { + return x.base().first < y.base().first; + } + template + typename Iter::difference_type + distance(const Iter& x, const Iter& y) const { + return y.base().first - x.base().first; + } + template + void advance(Iter& p, D n) { p.base().first += n; p.base().second += n; } + }; + + } // namespace detail + + template + struct shadow_iterator_generator { + + // To use the iterator_adaptor we can't derive from + // random_access_iterator because we don't have a real reference. + // However, we want the STL algorithms to treat the shadow + // iterator like a random access iterator. + struct shadow_iterator_tag : public std::input_iterator_tag { + operator std::random_access_iterator_tag() { + return std::random_access_iterator_tag(); + }; + }; + typedef typename std::iterator_traits::value_type Aval; + typedef typename std::iterator_traits::value_type Bval; + typedef typename std::iterator_traits::reference Aref; + typedef typename std::iterator_traits::reference Bref; + typedef typename std::iterator_traits::difference_type D; + typedef detail::shadow_proxy V; + typedef detail::shadow_proxy R; + typedef iterator_adaptor< std::pair, + detail::shadow_iterator_policies, + V, R, V*, shadow_iterator_tag, + D> type; + }; + + // short cut for creating a shadow iterator + template + inline typename shadow_iterator_generator::type + make_shadow_iter(IterA a, IterB b) { + typedef typename shadow_iterator_generator::type Iter; + return Iter(std::make_pair(a,b)); + } + + template + struct shadow_cmp { + inline shadow_cmp(const Cmp& c) : cmp(c) { } + template + inline bool operator()(const ShadowProxy1& x, const ShadowProxy2& y) const + { + return cmp(x.a, y.a); + } + Cmp cmp; + }; + +} // namespace boost + +namespace std { + template + void swap(boost::detail::shadow_proxy x, + boost::detail::shadow_proxy y) + { + std::swap(x.a, y.a); + std::swap(x.b, y.b); + } +} + +#endif // BOOST_SHADOW_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/sparse_ordering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/sparse_ordering.hpp new file mode 100644 index 0000000000..cf4bbb0bee --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/detail/sparse_ordering.hpp @@ -0,0 +1,198 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2004, 2005 Trustees of Indiana University +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, +// Doug Gregor, D. Kevin McGrath +// +// 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_GRAPH_DETAIL_SPARSE_ORDERING_HPP +#define BOOST_GRAPH_DETAIL_SPARSE_ORDERING_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + namespace sparse { + + // rcm_queue + // + // This is a custom queue type used in the + // *_ordering algorithms. + // In addition to the normal queue operations, the + // rcm_queue provides: + // + // int eccentricity() const; + // value_type spouse() const; + // + + // yes, it's a bad name...but it works, so use it + template < class Vertex, class DegreeMap, + class Container = std::deque > + class rcm_queue : public std::queue { + typedef std::queue base; + public: + typedef typename base::value_type value_type; + typedef typename base::size_type size_type; + + /* SGI queue has not had a contructor queue(const Container&) */ + inline rcm_queue(DegreeMap deg) + : _size(0), Qsize(1), eccen(-1), degree(deg) { } + + inline void pop() { + if ( !_size ) + Qsize = base::size(); + + base::pop(); + if ( _size == Qsize-1 ) { + _size = 0; + ++eccen; + } else + ++_size; + + } + + inline value_type& front() { + value_type& u = base::front(); + if ( _size == 0 ) + w = u; + else if (get(degree,u) < get(degree,w) ) + w = u; + return u; + } + + inline const value_type& front() const { + const value_type& u = base::front(); + if ( _size == 0 ) + w = u; + else if (get(degree,u) < get(degree,w) ) + w = u; + return u; + } + + inline value_type& top() { return front(); } + inline const value_type& top() const { return front(); } + + inline size_type size() const { return base::size(); } + + inline size_type eccentricity() const { return eccen; } + inline value_type spouse() const { return w; } + + protected: + size_type _size; + size_type Qsize; + int eccen; + mutable value_type w; + DegreeMap degree; + }; + + + template > + class sparse_ordering_queue : public boost::queue{ + public: + typedef typename Sequence::iterator iterator; + typedef typename Sequence::reverse_iterator reverse_iterator; + typedef queue base; + typedef typename Sequence::size_type size_type; + + inline iterator begin() { return this->c.begin(); } + inline reverse_iterator rbegin() { return this->c.rbegin(); } + inline iterator end() { return this->c.end(); } + inline reverse_iterator rend() { return this->c.rend(); } + inline Tp &operator[](int n) { return this->c[n]; } + inline size_type size() {return this->c.size(); } + protected: + //nothing + }; + + } // namespace sparse + + // Compute Pseudo peripheral + // + // To compute an approximated peripheral for a given vertex. + // Used in king_ordering algorithm. + // + template + Vertex + pseudo_peripheral_pair(Graph& G, const Vertex& u, int& ecc, + ColorMap color, DegreeMap degree) + { + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + sparse::rcm_queue Q(degree); + + typename boost::graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) + if (get(color, *ui) != Color::red()) put(color, *ui, Color::white()); + breadth_first_visit(G, u, buffer(Q).color_map(color)); + + ecc = Q.eccentricity(); + return Q.spouse(); + } + + // Find a good starting node + // + // This is to find a good starting node for the + // king_ordering algorithm. "good" is in the sense + // of the ordering generated by RCM. + // + template + Vertex find_starting_node(Graph& G, Vertex r, Color color, Degree degree) + { + Vertex x, y; + int eccen_r, eccen_x; + + x = pseudo_peripheral_pair(G, r, eccen_r, color, degree); + y = pseudo_peripheral_pair(G, x, eccen_x, color, degree); + + while (eccen_x > eccen_r) { + r = x; + eccen_r = eccen_x; + x = y; + y = pseudo_peripheral_pair(G, x, eccen_x, color, degree); + } + return x; + } + +template +class out_degree_property_map + : public put_get_helper::degree_size_type, + out_degree_property_map > +{ +public: + typedef typename graph_traits::vertex_descriptor key_type; + typedef typename graph_traits::degree_size_type value_type; + typedef value_type reference; + typedef readable_property_map_tag category; + out_degree_property_map(const Graph& g) : m_g(g) { } + value_type operator[](const key_type& v) const { + return out_degree(v, m_g); + } +private: + const Graph& m_g; +}; +template +inline out_degree_property_map +make_out_degree_map(const Graph& g) { + return out_degree_property_map(g); +} + +} // namespace boost + + +#endif // BOOST_GRAPH_KING_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/dijkstra_shortest_paths.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/dijkstra_shortest_paths.hpp new file mode 100644 index 0000000000..243b17f752 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/dijkstra_shortest_paths.hpp @@ -0,0 +1,347 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_DIJKSTRA_HPP +#define BOOST_GRAPH_DIJKSTRA_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_GRAPH_DIJKSTRA_TESTING +# include +#endif // BOOST_GRAPH_DIJKSTRA_TESTING + +namespace boost { + +#ifdef BOOST_GRAPH_DIJKSTRA_TESTING + static bool dijkstra_relaxed_heap = true; +#endif + + template + struct DijkstraVisitorConcept { + void constraints() { + function_requires< CopyConstructibleConcept >(); + vis.initialize_vertex(u, g); + vis.discover_vertex(u, g); + vis.examine_vertex(u, g); + vis.examine_edge(e, g); + vis.edge_relaxed(e, g); + vis.edge_not_relaxed(e, g); + vis.finish_vertex(u, g); + } + Visitor vis; + Graph g; + typename graph_traits::vertex_descriptor u; + typename graph_traits::edge_descriptor e; + }; + + template + class dijkstra_visitor : public bfs_visitor { + public: + dijkstra_visitor() { } + dijkstra_visitor(Visitors vis) + : bfs_visitor(vis) { } + + template + void edge_relaxed(Edge e, Graph& g) { + invoke_visitors(this->m_vis, e, g, on_edge_relaxed()); + } + template + void edge_not_relaxed(Edge e, Graph& g) { + invoke_visitors(this->m_vis, e, g, on_edge_not_relaxed()); + } + private: + template + void tree_edge(Edge u, Graph& g) { } + }; + template + dijkstra_visitor + make_dijkstra_visitor(Visitors vis) { + return dijkstra_visitor(vis); + } + typedef dijkstra_visitor<> default_dijkstra_visitor; + + namespace detail { + + template + struct dijkstra_bfs_visitor + { + typedef typename property_traits::value_type D; + + dijkstra_bfs_visitor(UniformCostVisitor vis, UpdatableQueue& Q, + WeightMap w, PredecessorMap p, DistanceMap d, + BinaryFunction combine, BinaryPredicate compare, + D zero) + : m_vis(vis), m_Q(Q), m_weight(w), m_predecessor(p), m_distance(d), + m_combine(combine), m_compare(compare), m_zero(zero) { } + + template + void tree_edge(Edge e, Graph& g) { + m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + if (m_decreased) + m_vis.edge_relaxed(e, g); + else + m_vis.edge_not_relaxed(e, g); + } + template + void gray_target(Edge e, Graph& g) { + m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + if (m_decreased) { + m_Q.update(target(e, g)); + m_vis.edge_relaxed(e, g); + } else + m_vis.edge_not_relaxed(e, g); + } + + template + void initialize_vertex(Vertex /*u*/, Graph& /*g*/) { } + template + void non_tree_edge(Edge, Graph&) { } + template + void discover_vertex(Vertex u, Graph& g) { m_vis.discover_vertex(u, g); } + template + void examine_vertex(Vertex u, Graph& g) { m_vis.examine_vertex(u, g); } + template + void examine_edge(Edge e, Graph& g) { + if (m_compare(get(m_weight, e), m_zero)) + throw negative_edge(); + m_vis.examine_edge(e, g); + } + template + void black_target(Edge, Graph&) { } + template + void finish_vertex(Vertex u, Graph& g) { m_vis.finish_vertex(u, g); } + + UniformCostVisitor m_vis; + UpdatableQueue& m_Q; + WeightMap m_weight; + PredecessorMap m_predecessor; + DistanceMap m_distance; + BinaryFunction m_combine; + BinaryPredicate m_compare; + bool m_decreased; + D m_zero; + }; + + } // namespace detail + + // Call breadth first search with default color map. + template + inline void + dijkstra_shortest_paths_no_init + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, + Compare compare, Combine combine, DistZero zero, + DijkstraVisitor vis) + { + std::vector color(num_vertices(g)); + default_color_type c = white_color; + dijkstra_shortest_paths_no_init( g, s, predecessor, distance, weight, + index_map, compare, combine, zero, vis, + make_iterator_property_map(&color[0], index_map, c)); + } + + // Call breadth first search + template + inline void + dijkstra_shortest_paths_no_init + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, + Compare compare, Combine combine, DistZero zero, + DijkstraVisitor vis, ColorMap color) + { + typedef indirect_cmp IndirectCmp; + IndirectCmp icmp(distance, compare); + + typedef typename graph_traits::vertex_descriptor Vertex; + +#ifdef BOOST_GRAPH_DIJKSTRA_TESTING + if (!dijkstra_relaxed_heap) { + typedef mutable_queue, IndirectCmp, IndexMap> + MutableQueue; + + MutableQueue Q(num_vertices(g), icmp, index_map); + + detail::dijkstra_bfs_visitor + bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, zero); + + breadth_first_visit(g, s, Q, bfs_vis, color); + return; + } +#endif // BOOST_GRAPH_DIJKSTRA_TESTING + + typedef relaxed_heap MutableQueue; + + MutableQueue Q(num_vertices(g), icmp, index_map); + + detail::dijkstra_bfs_visitor + bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, zero); + + breadth_first_visit(g, s, Q, bfs_vis, color); + } + + // Initialize distances and call breadth first search with default color map + template + inline void + dijkstra_shortest_paths + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + std::vector color(num_vertices(g)); + default_color_type c = white_color; + dijkstra_shortest_paths(g, s, predecessor, distance, weight, index_map, + compare, combine, inf, zero, vis, + make_iterator_property_map(&color[0], index_map, + c)); + } + + // Initialize distances and call breadth first search + template + inline void + dijkstra_shortest_paths + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis, ColorMap color) + { + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + vis.initialize_vertex(*ui, g); + put(distance, *ui, inf); + put(predecessor, *ui, *ui); + put(color, *ui, Color::white()); + } + put(distance, s, zero); + + dijkstra_shortest_paths_no_init(g, s, predecessor, distance, weight, + index_map, compare, combine, zero, vis, color); + } + + namespace detail { + + // Handle defaults for PredecessorMap and + // Distance Compare, Combine, Inf and Zero + template + inline void + dijkstra_dispatch2 + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + DistanceMap distance, WeightMap weight, IndexMap index_map, + const Params& params, ColorMap color) + { + // Default for predecessor map + dummy_property_map p_map; + + typedef typename property_traits::value_type D; + dijkstra_shortest_paths + (g, s, + choose_param(get_param(params, vertex_predecessor), p_map), + distance, weight, index_map, + choose_param(get_param(params, distance_compare_t()), + std::less()), + choose_param(get_param(params, distance_combine_t()), + closed_plus()), + choose_param(get_param(params, distance_inf_t()), + (std::numeric_limits::max)()), + choose_param(get_param(params, distance_zero_t()), + D()), + choose_param(get_param(params, graph_visitor), + make_dijkstra_visitor(null_visitor())), + color); + } + + template + inline void + dijkstra_dispatch1 + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + DistanceMap distance, WeightMap weight, IndexMap index_map, + const Params& params, ColorMap color) + { + // Default for distance map + typedef typename property_traits::value_type D; + typename std::vector::size_type + n = is_default_param(distance) ? num_vertices(g) : 1; + std::vector distance_map(n); + + // Default for color map + typename std::vector::size_type + m = is_default_param(color) ? num_vertices(g) : 1; + std::vector color_map(m); + + detail::dijkstra_dispatch2 + (g, s, choose_param(distance, make_iterator_property_map + (distance_map.begin(), index_map, + distance_map[0])), + weight, index_map, params, + choose_param(color, make_iterator_property_map + (color_map.begin(), index_map, + color_map[0]))); + } + } // namespace detail + + // Named Parameter Variant + template + inline void + dijkstra_shortest_paths + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params) + { + // Default for edge weight and vertex index map is to ask for them + // from the graph. Default for the visitor is null_visitor. + detail::dijkstra_dispatch1 + (g, s, + get_param(params, vertex_distance), + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + params, + get_param(params, vertex_color)); + } + +} // namespace boost + +#endif // BOOST_GRAPH_DIJKSTRA_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/dominator_tree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/dominator_tree.hpp new file mode 100644 index 0000000000..bb34bbe96a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/dominator_tree.hpp @@ -0,0 +1,488 @@ +//======================================================================= +// Copyright (C) 2005 Jong Soo Park +// +// 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) +//======================================================================= +// Dominator tree computation +#ifndef BOOST_GRAPH_DOMINATOR_HPP +#define BOOST_GRAPH_DOMINATOR_HPP + +#include +#include +#include +#include + +namespace boost { + namespace detail { + /** + * An extended time_stamper which also records vertices for each dfs number + */ + template + class time_stamper_with_vertex_vector + : public base_visitor< + time_stamper_with_vertex_vector > + { + public : + typedef Tag event_filter; + time_stamper_with_vertex_vector(TimeMap timeMap, VertexVector& v, + TimeT& t) + : timeStamper_(timeMap, t), v_(v) { } + + template + void + operator()(const typename property_traits::key_type& v, + const Graph& g) + { + timeStamper_(v, g); + v_[timeStamper_.m_time] = v; + } + + private : + time_stamper timeStamper_; + VertexVector& v_; + }; + + /** + * A convenient way to create a time_stamper_with_vertex_vector + */ + template + time_stamper_with_vertex_vector + stamp_times_with_vertex_vector(TimeMap timeMap, VertexVector& v, TimeT& t, + Tag) + { + return time_stamper_with_vertex_vector(timeMap, v, t); + } + + template + class dominator_visitor + { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertices_size_type VerticesSizeType; + + public : + /** + * @param g [in] the target graph of the dominator tree + * @param entry [in] the entry node of g + * @param domTreePredMap [out] the immediate dominator map + * (parent map in dominator tree) + */ + dominator_visitor(const Graph& g, const Vertex& entry, + DomTreePredMap domTreePredMap) + : semi_(num_vertices(g)), + ancestor_(num_vertices(g), graph_traits::null_vertex()), + samedom_(ancestor_), + best_(semi_), + semiMap_(make_iterator_property_map(semi_.begin(), + get(vertex_index, g))), + ancestorMap_(make_iterator_property_map(ancestor_.begin(), + get(vertex_index, g))), + bestMap_(make_iterator_property_map(best_.begin(), + get(vertex_index, g))), + buckets_(num_vertices(g)), + bucketMap_(make_iterator_property_map(buckets_.begin(), + get(vertex_index, g))), + entry_(entry), + domTreePredMap_(domTreePredMap), + samedomMap(make_iterator_property_map(samedom_.begin(), + get(vertex_index, g))) + { + } + + void + operator()(const Vertex& n, const TimeMap& dfnumMap, + const PredMap& parentMap, const Graph& g) + { + if (n == entry_) return; + + const VerticesSizeType numOfVertices = num_vertices(g); + const Vertex p(get(parentMap, n)); + Vertex s(p); + + // 1. Calculate the semidominator of n, + // based on the semidominator thm. + // * Semidominator thm. : To find the semidominator of a node n, + // consider all predecessors v of n in the CFG (Control Flow Graph). + // - If v is a proper ancestor of n in the spanning tree + // (so dfnum(v) < dfnum(n)), then v is a candidate for semi(n) + // - If v is a non-ancestor of n (so dfnum(v) > dfnum(n)) + // then for each u that is an ancestor of v (or u = v), + // Let semi(u) be a candidate for semi(n) + // of all these candidates, the one with lowest dfnum is + // the semidominator of n. + + // For each predecessor of n + typename graph_traits::in_edge_iterator inItr, inEnd; + for (tie(inItr, inEnd) = in_edges(n, g); inItr != inEnd; ++inItr) + { + const Vertex v = source(*inItr, g); + // To deal with unreachable nodes + if (get(dfnumMap, v) < 0 || get(dfnumMap, v) >= numOfVertices) + continue; + + Vertex s2; + if (get(dfnumMap, v) <= get(dfnumMap, n)) + s2 = v; + else + s2 = get(semiMap_, ancestor_with_lowest_semi_(v, dfnumMap)); + + if (get(dfnumMap, s2) < get(dfnumMap, s)) + s = s2; + } + put(semiMap_, n, s); + + // 2. Calculation of n's dominator is deferred until + // the path from s to n has been linked into the forest + get(bucketMap_, s).push_back(n); + get(ancestorMap_, n) = p; + get(bestMap_, n) = n; + + // 3. Now that the path from p to v has been linked into + // the spanning forest, these lines calculate the dominator of v, + // based on the dominator thm., or else defer the calculation + // until y's dominator is known + // * Dominator thm. : On the spanning-tree path below semi(n) and + // above or including n, let y be the node + // with the smallest-numbered semidominator. Then, + // + // idom(n) = semi(n) if semi(y)=semi(n) or + // idom(y) if semi(y) != semi(n) + typename std::deque::iterator buckItr; + for (buckItr = get(bucketMap_, p).begin(); + buckItr != get(bucketMap_, p).end(); + ++buckItr) + { + const Vertex v(*buckItr); + const Vertex y(ancestor_with_lowest_semi_(v, dfnumMap)); + if (get(semiMap_, y) == get(semiMap_, v)) + put(domTreePredMap_, v, p); + else + put(samedomMap, v, y); + } + + get(bucketMap_, p).clear(); + } + + protected : + + /** + * Evaluate function in Tarjan's path compression + */ + const Vertex + ancestor_with_lowest_semi_(const Vertex& v, const TimeMap& dfnumMap) + { + const Vertex a(get(ancestorMap_, v)); + + if (get(ancestorMap_, a) != graph_traits::null_vertex()) + { + const Vertex b(ancestor_with_lowest_semi_(a, dfnumMap)); + + put(ancestorMap_, v, get(ancestorMap_, a)); + + if (get(dfnumMap, get(semiMap_, b)) < + get(dfnumMap, get(semiMap_, get(bestMap_, v)))) + put(bestMap_, v, b); + } + + return get(bestMap_, v); + } + + std::vector semi_, ancestor_, samedom_, best_; + PredMap semiMap_, ancestorMap_, bestMap_; + std::vector< std::deque > buckets_; + + iterator_property_map >::iterator, + IndexMap> bucketMap_; + + const Vertex& entry_; + DomTreePredMap domTreePredMap_; + + public : + + PredMap samedomMap; + }; + + } // namespace detail + + /** + * @brief Build dominator tree using Lengauer-Tarjan algorithm. + * It takes O((V+E)log(V+E)) time. + * + * @pre dfnumMap, parentMap and verticesByDFNum have dfs results corresponding + * indexMap. + * If dfs has already run before, + * this function would be good for saving computations. + * @pre Unreachable nodes must be masked as + * graph_traits::null_vertex in parentMap. + * @pre Unreachable nodes must be masked as + * (std::numeric_limits::max)() in dfnumMap. + * + * @param domTreePredMap [out] : immediate dominator map (parent map + * in dom. tree) + * + * @note reference Appel. p. 452~453. algorithm 19.9, 19.10. + * + * @todo : Optimization in Finding Dominators in Practice, Loukas Georgiadis + */ + template + void + lengauer_tarjan_dominator_tree_without_dfs + (const Graph& g, + const typename graph_traits::vertex_descriptor& entry, + const IndexMap& indexMap, + TimeMap dfnumMap, PredMap parentMap, VertexVector& verticesByDFNum, + DomTreePredMap domTreePredMap) + { + // Typedefs and concept check + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertices_size_type VerticesSizeType; + + function_requires< BidirectionalGraphConcept >(); + + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + // 1. Visit each vertex in reverse post order and calculate sdom. + detail::dominator_visitor + visitor(g, entry, domTreePredMap); + + VerticesSizeType i; + for (i = 0; i < numOfVertices; ++i) + { + const Vertex u(verticesByDFNum[numOfVertices - 1 - i]); + if (u != graph_traits::null_vertex()) + visitor(u, dfnumMap, parentMap, g); + } + + // 2. Now all the deferred dominator calculations, + // based on the second clause of the dominator thm., are performed + for (i = 0; i < numOfVertices; ++i) + { + const Vertex n(verticesByDFNum[i]); + + if (n == entry || n == graph_traits::null_vertex()) + continue; + + Vertex u = get(visitor.samedomMap, n); + if (u != graph_traits::null_vertex()) + { + put(domTreePredMap, n, get(domTreePredMap, u)); + } + } + } + + /** + * Unlike lengauer_tarjan_dominator_tree_without_dfs, + * dfs is run in this function and + * the result is written to dfnumMap, parentMap, vertices. + * + * If the result of dfs required after this algorithm, + * this function can eliminate the need of rerunning dfs. + */ + template + void + lengauer_tarjan_dominator_tree + (const Graph& g, + const typename graph_traits::vertex_descriptor& entry, + const IndexMap& indexMap, + TimeMap dfnumMap, PredMap parentMap, VertexVector& verticesByDFNum, + DomTreePredMap domTreePredMap) + { + // Typedefs and concept check + typedef typename graph_traits::vertices_size_type VerticesSizeType; + + function_requires< BidirectionalGraphConcept >(); + + // 1. Depth first visit + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + VerticesSizeType time = + (std::numeric_limits::max)(); + std::vector + colors(numOfVertices, color_traits::white()); + depth_first_visit + (g, entry, + make_dfs_visitor + (make_pair(record_predecessors(parentMap, on_tree_edge()), + detail::stamp_times_with_vertex_vector + (dfnumMap, verticesByDFNum, time, on_discover_vertex()))), + make_iterator_property_map(colors.begin(), indexMap)); + + // 2. Run main algorithm. + lengauer_tarjan_dominator_tree_without_dfs(g, entry, indexMap, dfnumMap, + parentMap, verticesByDFNum, + domTreePredMap); + } + + /** + * Use vertex_index as IndexMap and make dfnumMap, parentMap, verticesByDFNum + * internally. + * If we don't need the result of dfs (dfnumMap, parentMap, verticesByDFNum), + * this function would be more convenient one. + */ + template + void + lengauer_tarjan_dominator_tree + (const Graph& g, + const typename graph_traits::vertex_descriptor& entry, + DomTreePredMap domTreePredMap) + { + // typedefs + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertices_size_type VerticesSizeType; + typedef typename property_map::const_type IndexMap; + typedef + iterator_property_map::iterator, + IndexMap> TimeMap; + typedef + iterator_property_map::iterator, IndexMap> + PredMap; + + // Make property maps + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + const IndexMap indexMap = get(vertex_index, g); + + std::vector dfnum(numOfVertices, 0); + TimeMap dfnumMap(make_iterator_property_map(dfnum.begin(), indexMap)); + + std::vector parent(numOfVertices, + graph_traits::null_vertex()); + PredMap parentMap(make_iterator_property_map(parent.begin(), indexMap)); + + std::vector verticesByDFNum(parent); + + // Run main algorithm + lengauer_tarjan_dominator_tree(g, entry, + indexMap, dfnumMap, parentMap, + verticesByDFNum, domTreePredMap); + } + + /** + * Muchnick. p. 182, 184 + * + * using iterative bit vector analysis + */ + template + void + iterative_bit_vector_dominator_tree + (const Graph& g, + const typename graph_traits::vertex_descriptor& entry, + const IndexMap& indexMap, + DomTreePredMap domTreePredMap) + { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator vertexItr; + typedef typename graph_traits::vertices_size_type VerticesSizeType; + typedef + iterator_property_map >::iterator, + IndexMap> vertexSetMap; + + function_requires >(); + + // 1. Finding dominator + // 1.1. Initialize + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + vertexItr vi, viend; + tie(vi, viend) = vertices(g); + const std::set N(vi, viend); + + bool change = true; + + std::vector< std::set > dom(numOfVertices, N); + vertexSetMap domMap(make_iterator_property_map(dom.begin(), indexMap)); + get(domMap, entry).clear(); + get(domMap, entry).insert(entry); + + while (change) + { + change = false; + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + { + if (*vi == entry) continue; + + std::set T(N); + + typename graph_traits::in_edge_iterator inItr, inEnd; + for (tie(inItr, inEnd) = in_edges(*vi, g); inItr != inEnd; ++inItr) + { + const Vertex p = source(*inItr, g); + + std::set tempSet; + std::set_intersection(T.begin(), T.end(), + get(domMap, p).begin(), + get(domMap, p).end(), + std::inserter(tempSet, tempSet.begin())); + T.swap(tempSet); + } + + T.insert(*vi); + if (T != get(domMap, *vi)) + { + change = true; + get(domMap, *vi).swap(T); + } + } // end of for (tie(vi, viend) = vertices(g) + } // end of while(change) + + // 2. Build dominator tree + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + get(domMap, *vi).erase(*vi); + + Graph domTree(numOfVertices); + + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + { + if (*vi == entry) continue; + + // We have to iterate through copied dominator set + const std::set tempSet(get(domMap, *vi)); + typename std::set::const_iterator s; + for (s = tempSet.begin(); s != tempSet.end(); ++s) + { + typename std::set::iterator t; + for (t = get(domMap, *vi).begin(); t != get(domMap, *vi).end(); ) + { + typename std::set::iterator old_t = t; + ++t; // Done early because t may become invalid + if (*old_t == *s) continue; + if (get(domMap, *s).find(*old_t) != get(domMap, *s).end()) + get(domMap, *vi).erase(old_t); + } + } + } + + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + { + if (*vi != entry && get(domMap, *vi).size() == 1) + { + Vertex temp = *get(domMap, *vi).begin(); + put(domTreePredMap, *vi, temp); + } + } + } + + template + void + iterative_bit_vector_dominator_tree + (const Graph& g, + const typename graph_traits::vertex_descriptor& entry, + DomTreePredMap domTreePredMap) + { + typename property_map::const_type + indexMap = get(vertex_index, g); + + iterative_bit_vector_dominator_tree(g, entry, indexMap, domTreePredMap); + } +} // namespace boost + +#endif // BOOST_GRAPH_DOMINATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/edge_connectivity.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/edge_connectivity.hpp new file mode 100644 index 0000000000..d78e3ee41a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/edge_connectivity.hpp @@ -0,0 +1,181 @@ +//======================================================================= +// Copyright 2000 University of Notre Dame. +// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee +// +// 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_EDGE_CONNECTIVITY +#define BOOST_EDGE_CONNECTIVITY + +// WARNING: not-yet fully tested! + +#include +#include +#include +#include +#include + +namespace boost { + + namespace detail { + + template + inline + std::pair::vertex_descriptor, + typename graph_traits::degree_size_type> + min_degree_vertex(Graph& g) + { + typedef graph_traits Traits; + typename Traits::vertex_descriptor p; + typedef typename Traits::degree_size_type size_type; + size_type delta = (std::numeric_limits::max)(); + + typename Traits::vertex_iterator i, iend; + for (tie(i, iend) = vertices(g); i != iend; ++i) + if (degree(*i, g) < delta) { + delta = degree(*i, g); + p = *i; + } + return std::make_pair(p, delta); + } + + template + void neighbors(const Graph& g, + typename graph_traits::vertex_descriptor u, + OutputIterator result) + { + typename graph_traits::adjacency_iterator ai, aend; + for (tie(ai, aend) = adjacent_vertices(u, g); ai != aend; ++ai) + *result++ = *ai; + } + + template + void neighbors(const Graph& g, + VertexIterator first, VertexIterator last, + OutputIterator result) + { + for (; first != last; ++first) + neighbors(g, *first, result); + } + + } // namespace detail + + // O(m n) + template + typename graph_traits::degree_size_type + edge_connectivity(VertexListGraph& g, OutputIterator disconnecting_set) + { + //------------------------------------------------------------------------- + // Type Definitions + typedef graph_traits Traits; + typedef typename Traits::vertex_iterator vertex_iterator; + typedef typename Traits::edge_iterator edge_iterator; + typedef typename Traits::out_edge_iterator out_edge_iterator; + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::degree_size_type degree_size_type; + typedef color_traits Color; + + typedef adjacency_list_traits Tr; + typedef typename Tr::edge_descriptor Tr_edge_desc; + typedef adjacency_list > > > + FlowGraph; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + //------------------------------------------------------------------------- + // Variable Declarations + vertex_descriptor u, v, p, k; + edge_descriptor e1, e2; + bool inserted; + vertex_iterator vi, vi_end; + edge_iterator ei, ei_end; + degree_size_type delta, alpha_star, alpha_S_k; + std::set S, neighbor_S; + std::vector S_star, non_neighbor_S; + std::vector color(num_vertices(g)); + std::vector pred(num_vertices(g)); + + //------------------------------------------------------------------------- + // Create a network flow graph out of the undirected graph + FlowGraph flow_g(num_vertices(g)); + + typename property_map::type + cap = get(edge_capacity, flow_g); + typename property_map::type + res_cap = get(edge_residual_capacity, flow_g); + typename property_map::type + rev_edge = get(edge_reverse, flow_g); + + for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { + u = source(*ei, g), v = target(*ei, g); + tie(e1, inserted) = add_edge(u, v, flow_g); + cap[e1] = 1; + tie(e2, inserted) = add_edge(v, u, flow_g); + cap[e2] = 1; // not sure about this + rev_edge[e1] = e2; + rev_edge[e2] = e1; + } + + //------------------------------------------------------------------------- + // The Algorithm + + tie(p, delta) = detail::min_degree_vertex(g); + S_star.push_back(p); + alpha_star = delta; + S.insert(p); + neighbor_S.insert(p); + detail::neighbors(g, S.begin(), S.end(), + std::inserter(neighbor_S, neighbor_S.begin())); + + std::set_difference(vertices(g).first, vertices(g).second, + neighbor_S.begin(), neighbor_S.end(), + std::back_inserter(non_neighbor_S)); + + while (!non_neighbor_S.empty()) { // at most n - 1 times + k = non_neighbor_S.front(); + + alpha_S_k = edmunds_karp_max_flow + (flow_g, p, k, cap, res_cap, rev_edge, &color[0], &pred[0]); + + if (alpha_S_k < alpha_star) { + alpha_star = alpha_S_k; + S_star.clear(); + for (tie(vi, vi_end) = vertices(flow_g); vi != vi_end; ++vi) + if (color[*vi] != Color::white()) + S_star.push_back(*vi); + } + S.insert(k); + neighbor_S.insert(k); + detail::neighbors(g, k, std::inserter(neighbor_S, neighbor_S.begin())); + non_neighbor_S.clear(); + std::set_difference(vertices(g).first, vertices(g).second, + neighbor_S.begin(), neighbor_S.end(), + std::back_inserter(non_neighbor_S)); + } + //------------------------------------------------------------------------- + // Compute edges of the cut [S*, ~S*] + std::vector in_S_star(num_vertices(g), false); + typename std::vector::iterator si; + for (si = S_star.begin(); si != S_star.end(); ++si) + in_S_star[*si] = true; + + degree_size_type c = 0; + for (si = S_star.begin(); si != S_star.end(); ++si) { + out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(*si, g); ei != ei_end; ++ei) + if (!in_S_star[target(*ei, g)]) { + *disconnecting_set++ = *ei; + ++c; + } + } + return c; + } + +} // namespace boost + +#endif // BOOST_EDGE_CONNECTIVITY diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/edge_list.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/edge_list.hpp new file mode 100644 index 0000000000..32c5c25964 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/edge_list.hpp @@ -0,0 +1,304 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_EDGE_LIST_HPP +#define BOOST_GRAPH_EDGE_LIST_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + // + // The edge_list class is an EdgeListGraph module that is constructed + // from a pair of iterators whose value type is a pair of vertex + // descriptors. + // + // For example: + // + // typedef std::pair E; + // list elist; + // ... + // typedef edge_list::iterator> Graph; + // Graph g(elist.begin(), elist.end()); + // + // If the iterators are random access, then Graph::edge_descriptor + // is of Integral type, otherwise it is a struct, though it is + // convertible to an Integral type. + // + + struct edge_list_tag { }; + + // The implementation class for edge_list. + template + class edge_list_impl + { + public: + typedef D edge_id; + typedef T Vpair; + typedef typename Vpair::first_type V; + typedef V vertex_descriptor; + typedef edge_list_tag graph_tag; + typedef void edge_property_type; + + struct edge_descriptor + { + edge_descriptor() { } + edge_descriptor(EdgeIter p, edge_id id) : _ptr(p), _id(id) { } + operator edge_id() { return _id; } + EdgeIter _ptr; + edge_id _id; + }; + typedef edge_descriptor E; + + struct edge_iterator + { + typedef edge_iterator self; + typedef E value_type; + typedef E& reference; + typedef E* pointer; + typedef std::ptrdiff_t difference_type; + typedef std::input_iterator_tag iterator_category; + edge_iterator() { } + edge_iterator(EdgeIter iter) : _iter(iter), _i(0) { } + E operator*() { return E(_iter, _i); } + self& operator++() { ++_iter; ++_i; return *this; } + self operator++(int) { self t = *this; ++(*this); return t; } + bool operator==(const self& x) { return _iter == x._iter; } + bool operator!=(const self& x) { return _iter != x._iter; } + EdgeIter _iter; + edge_id _i; + }; + typedef void out_edge_iterator; + typedef void in_edge_iterator; + typedef void adjacency_iterator; + typedef void vertex_iterator; + }; + + template + std::pair::edge_iterator, + typename edge_list_impl::edge_iterator> + edges(const edge_list_impl& g_) { + const G& g = static_cast(g_); + typedef typename edge_list_impl::edge_iterator edge_iterator; + return std::make_pair(edge_iterator(g._first), edge_iterator(g._last)); + } + template + typename edge_list_impl::vertex_descriptor + source(typename edge_list_impl::edge_descriptor e, + const edge_list_impl&) { + return (*e._ptr).first; + } + template + typename edge_list_impl::vertex_descriptor + target(typename edge_list_impl::edge_descriptor e, + const edge_list_impl&) { + return (*e._ptr).second; + } + + template + class el_edge_property_map + : public put_get_helper >{ + public: + typedef E key_type; + typedef D value_type; + typedef D reference; + typedef readable_property_map_tag category; + + value_type operator[](key_type e) const { + return e._i; + } + }; + struct edge_list_edge_property_selector { + template + struct bind_ { + typedef el_edge_property_map type; + typedef type const_type; + }; + }; + template <> + struct edge_property_selector { + typedef edge_list_edge_property_selector type; + }; + + template + typename property_map< edge_list_impl, edge_index_t>::type + get(edge_index_t, const edge_list_impl&) { + typedef typename property_map< edge_list_impl, + edge_index_t>::type EdgeIndexMap; + return EdgeIndexMap(); + } + + template + inline D + get(edge_index_t, const edge_list_impl&, + typename edge_list_impl::edge_descriptor e) { + return e._i; + } + + // A specialized implementation for when the iterators are random access. + + struct edge_list_ra_tag { }; + + template + class edge_list_impl_ra + { + public: + typedef D edge_id; + typedef T Vpair; + typedef typename Vpair::first_type V; + typedef edge_list_ra_tag graph_tag; + typedef void edge_property_type; + + typedef edge_id edge_descriptor; + typedef V vertex_descriptor; + typedef typename boost::integer_range::iterator edge_iterator; + typedef void out_edge_iterator; + typedef void in_edge_iterator; + typedef void adjacency_iterator; + typedef void vertex_iterator; + }; + + template + std::pair::edge_iterator, + typename edge_list_impl_ra::edge_iterator> + edges(const edge_list_impl_ra& g_) + { + const G& g = static_cast(g_); + typedef typename edge_list_impl_ra::edge_iterator edge_iterator; + return std::make_pair(edge_iterator(0), edge_iterator(g._last - g._first)); + } + template + typename edge_list_impl_ra::vertex_descriptor + source(typename edge_list_impl_ra::edge_descriptor e, + const edge_list_impl_ra& g_) + { + const G& g = static_cast(g_); + return g._first[e].first; + } + template + typename edge_list_impl_ra::vertex_descriptor + target(typename edge_list_impl_ra::edge_descriptor e, + const edge_list_impl_ra& g_) + { + const G& g = static_cast(g_); + return g._first[e].second; + } + template + class el_ra_edge_property_map + : public put_get_helper >{ + public: + typedef E key_type; + typedef E value_type; + typedef E reference; + typedef readable_property_map_tag category; + + value_type operator[](key_type e) const { + return e; + } + }; + struct edge_list_ra_edge_property_selector { + template + struct bind_ { + typedef el_ra_edge_property_map type; + typedef type const_type; + }; + }; + template <> + struct edge_property_selector { + typedef edge_list_ra_edge_property_selector type; + }; + template + inline + typename property_map< edge_list_impl_ra, edge_index_t>::type + get(edge_index_t, const edge_list_impl_ra&) { + typedef typename property_map< edge_list_impl_ra, + edge_index_t>::type EdgeIndexMap; + return EdgeIndexMap(); + } + + template + inline D + get(edge_index_t, const edge_list_impl_ra&, + typename edge_list_impl_ra::edge_descriptor e) { + return e; + } + + + // Some helper classes for determining if the iterators are random access + template + struct is_random { + enum { RET = false }; + typedef mpl::false_ type; + }; + template <> + struct is_random { + enum { RET = true }; typedef mpl::true_ type; + }; + + // The edge_list class conditionally inherits from one of the + // above two classes. + + template ::value_type, + class D = typename std::iterator_traits::difference_type, + class Cat = typename std::iterator_traits::iterator_category> +#else + class T, + class D, + class Cat> +#endif + class edge_list + : public mpl::if_< typename is_random::type, + edge_list_impl_ra< edge_list, EdgeIter,T,D>, + edge_list_impl< edge_list, EdgeIter,T,D> + >::type + { + public: + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + typedef edge_list_graph_tag traversal_category; + typedef std::size_t edges_size_type; + typedef std::size_t vertices_size_type; + typedef std::size_t degree_size_type; + edge_list(EdgeIter first, EdgeIter last) : _first(first), _last(last) { + m_num_edges = std::distance(first, last); + } + edge_list(EdgeIter first, EdgeIter last, edges_size_type E) + : _first(first), _last(last), m_num_edges(E) { } + + EdgeIter _first, _last; + edges_size_type m_num_edges; + }; + + template + std::size_t num_edges(const edge_list& el) { + return el.m_num_edges; + } + +#ifndef BOOST_NO_STD_ITERATOR_TRAITS + template + inline edge_list + make_edge_list(EdgeIter first, EdgeIter last) + { + return edge_list(first, last); + } +#endif + +} /* namespace boost */ + +#endif /* BOOST_GRAPH_EDGE_LIST_HPP */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/edmunds_karp_max_flow.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/edmunds_karp_max_flow.hpp new file mode 100644 index 0000000000..ddb49dc6d6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/edmunds_karp_max_flow.hpp @@ -0,0 +1,250 @@ +//======================================================================= +// Copyright 2000 University of Notre Dame. +// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee +// +// 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 EDMUNDS_KARP_MAX_FLOW_HPP +#define EDMUNDS_KARP_MAX_FLOW_HPP + +#include +#include +#include // for std::min and std::max +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + // The "labeling" algorithm from "Network Flows" by Ahuja, Magnanti, + // Orlin. I think this is the same as or very similar to the original + // Edmunds-Karp algorithm. This solves the maximum flow problem. + + namespace detail { + + template + filtered_graph > + residual_graph(Graph& g, ResCapMap residual_capacity) { + return filtered_graph > + (g, is_residual_edge(residual_capacity)); + } + + template + inline void + augment(Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + PredEdgeMap p, + ResCapMap residual_capacity, + RevEdgeMap reverse_edge) + { + typename graph_traits::edge_descriptor e; + typename graph_traits::vertex_descriptor u; + typedef typename property_traits::value_type FlowValue; + + // find minimum residual capacity along the augmenting path + FlowValue delta = (std::numeric_limits::max)(); + e = p[sink]; + do { + BOOST_USING_STD_MIN(); + delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[e]); + u = source(e, g); + e = p[u]; + } while (u != src); + + // push delta units of flow along the augmenting path + e = p[sink]; + do { + residual_capacity[e] -= delta; + residual_capacity[reverse_edge[e]] += delta; + u = source(e, g); + e = p[u]; + } while (u != src); + } + + } // namespace detail + + template + typename property_traits::value_type + edmunds_karp_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res, + ReverseEdgeMap rev, + ColorMap color, + PredEdgeMap pred) + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + typename graph_traits::vertex_iterator u_iter, u_end; + typename graph_traits::out_edge_iterator ei, e_end; + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) + for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) + res[*ei] = cap[*ei]; + + color[sink] = Color::gray(); + while (color[sink] != Color::white()) { + boost::queue Q; + breadth_first_search + (detail::residual_graph(g, res), src, Q, + make_bfs_visitor(record_edge_predecessors(pred, on_tree_edge())), + color); + if (color[sink] != Color::white()) + detail::augment(g, src, sink, pred, res, rev); + } // while + + typename property_traits::value_type flow = 0; + for (tie(ei, e_end) = out_edges(src, g); ei != e_end; ++ei) + flow += (cap[*ei] - res[*ei]); + return flow; + } // edmunds_karp_max_flow() + + namespace detail { + //------------------------------------------------------------------------- + // Handle default for color property map + + // use of class here is a VC++ workaround + template + struct edmunds_karp_dispatch2 { + template + static typename edge_capacity_value::type + apply + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + PredMap pred, + const bgl_named_params& params, + ColorMap color) + { + return edmunds_karp_max_flow + (g, src, sink, + choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), + choose_pmap(get_param(params, edge_residual_capacity), + g, edge_residual_capacity), + choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), + color, pred); + } + }; + template<> + struct edmunds_karp_dispatch2 { + template + static typename edge_capacity_value::type + apply + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + PredMap pred, + const bgl_named_params& params, + detail::error_property_not_found) + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::vertices_size_type size_type; + size_type n = is_default_param(get_param(params, vertex_color)) ? + num_vertices(g) : 1; + std::vector color_vec(n); + return edmunds_karp_max_flow + (g, src, sink, + choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), + choose_pmap(get_param(params, edge_residual_capacity), + g, edge_residual_capacity), + choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), + make_iterator_property_map(color_vec.begin(), choose_const_pmap + (get_param(params, vertex_index), + g, vertex_index), color_vec[0]), + pred); + } + }; + + //------------------------------------------------------------------------- + // Handle default for predecessor property map + + // use of class here is a VC++ workaround + template + struct edmunds_karp_dispatch1 { + template + static typename edge_capacity_value::type + apply(Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + const bgl_named_params& params, + PredMap pred) + { + typedef typename property_value< bgl_named_params, vertex_color_t>::type C; + return edmunds_karp_dispatch2::apply + (g, src, sink, pred, params, get_param(params, vertex_color)); + } + }; + template<> + struct edmunds_karp_dispatch1 { + + template + static typename edge_capacity_value::type + apply + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + const bgl_named_params& params, + detail::error_property_not_found) + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::vertices_size_type size_type; + size_type n = is_default_param(get_param(params, vertex_predecessor)) ? + num_vertices(g) : 1; + std::vector pred_vec(n); + + typedef typename property_value< bgl_named_params, vertex_color_t>::type C; + return edmunds_karp_dispatch2::apply + (g, src, sink, + make_iterator_property_map(pred_vec.begin(), choose_const_pmap + (get_param(params, vertex_index), + g, vertex_index), pred_vec[0]), + params, + get_param(params, vertex_color)); + } + }; + + } // namespace detail + + template + typename detail::edge_capacity_value::type + edmunds_karp_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + const bgl_named_params& params) + { + typedef typename property_value< bgl_named_params, vertex_predecessor_t>::type Pred; + return detail::edmunds_karp_dispatch1::apply + (g, src, sink, params, get_param(params, vertex_predecessor)); + } + + template + typename property_traits< + typename property_map::const_type + >::value_type + edmunds_karp_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink) + { + bgl_named_params params(0); + return edmunds_karp_max_flow(g, src, sink, params); + } + +} // namespace boost + +#endif // EDMUNDS_KARP_MAX_FLOW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/erdos_renyi_generator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/erdos_renyi_generator.hpp new file mode 100644 index 0000000000..605b0e1749 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/erdos_renyi_generator.hpp @@ -0,0 +1,228 @@ +// Copyright 2004, 2005 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_ERDOS_RENYI_GENERATOR_HPP +#define BOOST_GRAPH_ERDOS_RENYI_GENERATOR_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + class erdos_renyi_iterator + { + typedef typename graph_traits::directed_category directed_category; + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::edges_size_type edges_size_type; + + BOOST_STATIC_CONSTANT + (bool, + is_undirected = (is_base_and_derived::value + || is_same::value)); + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + erdos_renyi_iterator() : gen(), n(0), edges(0), allow_self_loops(false) {} + erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, + double fraction = 0.0, bool allow_self_loops = false) + : gen(&gen), n(n), edges(edges_size_type(fraction * n * n)), + allow_self_loops(allow_self_loops) + { + if (is_undirected) edges = edges / 2; + next(); + } + + erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, + edges_size_type m, bool allow_self_loops = false) + : gen(&gen), n(n), edges(m), + allow_self_loops(allow_self_loops) + { + next(); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + erdos_renyi_iterator& operator++() + { + --edges; + next(); + return *this; + } + + erdos_renyi_iterator operator++(int) + { + erdos_renyi_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const erdos_renyi_iterator& other) const + { return edges == other.edges; } + + bool operator!=(const erdos_renyi_iterator& other) const + { return !(*this == other); } + + private: + void next() + { + uniform_int rand_vertex(0, n-1); + current.first = rand_vertex(*gen); + do { + current.second = rand_vertex(*gen); + } while (current.first == current.second && !allow_self_loops); + } + + RandomGenerator* gen; + vertices_size_type n; + edges_size_type edges; + bool allow_self_loops; + value_type current; + }; + + template + class sorted_erdos_renyi_iterator + { + typedef typename graph_traits::directed_category directed_category; + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::edges_size_type edges_size_type; + + BOOST_STATIC_CONSTANT + (bool, + is_undirected = (is_base_and_derived::value + || is_same::value)); + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + sorted_erdos_renyi_iterator() + : gen(), rand_vertex(0.5), n(0), allow_self_loops(false), + src((std::numeric_limits::max)()), tgt(0), prob(0) {} + sorted_erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, + double prob = 0.0, + bool allow_self_loops = false) + : gen(), + // The "1.0 - prob" in the next line is to work around a Boost.Random + // (and TR1) bug in the specification of geometric_distribution. It + // should be replaced by "prob" when the issue is fixed. + rand_vertex(1.0 - prob), + n(n), allow_self_loops(allow_self_loops), src(0), tgt(0), prob(prob) + { + this->gen.reset(new uniform_01(gen)); + + if (prob == 0.0) {src = (std::numeric_limits::max)(); return;} + next(); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + sorted_erdos_renyi_iterator& operator++() + { + next(); + return *this; + } + + sorted_erdos_renyi_iterator operator++(int) + { + sorted_erdos_renyi_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const sorted_erdos_renyi_iterator& other) const + { return src == other.src && tgt == other.tgt; } + + bool operator!=(const sorted_erdos_renyi_iterator& other) const + { return !(*this == other); } + + private: + void next() + { + using std::sqrt; + using std::floor; + + // In order to get the edges from the generator in sorted order, one + // effective (but slow) procedure would be to use a + // bernoulli_distribution for each legal (src, tgt) pair. Because of the + // O(n^2) cost of that, a geometric distribution is used. The geometric + // distribution tells how many times the bernoulli_distribution would + // need to be run until it returns true. Thus, this distribution can be + // used to step through the edges which are actually present. Everything + // beyond "tgt += increment" is done to effectively convert linear + // indexing (the partial sums of the geometric distribution output) into + // graph edges. + assert (src != (std::numeric_limits::max)()); + vertices_size_type increment = rand_vertex(*gen); + tgt += increment; + if (is_undirected) { + // Update src and tgt based on position of tgt + // Basically, we want the greatest src_increment such that (in \bbQ): + // src_increment * (src + allow_self_loops + src_increment - 1/2) <= tgt + // The result of the LHS of this, evaluated with the computed + // src_increment, is then subtracted from tgt + double src_minus_half = (src + allow_self_loops) - 0.5; + double disc = src_minus_half * src_minus_half + 2 * tgt; + double src_increment_fp = floor(sqrt(disc) - src_minus_half); + vertices_size_type src_increment = vertices_size_type(src_increment_fp); + if (src + src_increment >= n) { + src = n; + } else { + tgt -= (src + allow_self_loops) * src_increment + + src_increment * (src_increment - 1) / 2; + src += src_increment; + } + } else { + // Number of out edge positions possible from each vertex in this graph + vertices_size_type possible_out_edges = n - (allow_self_loops ? 0 : 1); + src += (std::min)(n - src, tgt / possible_out_edges); + tgt %= possible_out_edges; + } + // Set end of graph code so (src, tgt) will be the same as for the end + // sorted_erdos_renyi_iterator + if (src >= n) {src = (std::numeric_limits::max)(); tgt = 0;} + // Copy (src, tgt) into current + current.first = src; + current.second = tgt; + // Adjust for (src, src) edge being forbidden + if (!allow_self_loops && tgt >= src) ++current.second; + } + + shared_ptr > gen; + geometric_distribution rand_vertex; + vertices_size_type n; + bool allow_self_loops; + vertices_size_type src, tgt; + value_type current; + double prob; + }; + +} // end namespace boost + +#endif // BOOST_GRAPH_ERDOS_RENYI_GENERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/exception.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/exception.hpp new file mode 100644 index 0000000000..09c82edc3c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/exception.hpp @@ -0,0 +1,44 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_EXCEPTION_HPP +#define BOOST_GRAPH_EXCEPTION_HPP + +#include +#include + +namespace boost { + + struct bad_graph : public std::invalid_argument { + bad_graph(const std::string& what_arg) + : std::invalid_argument(what_arg) { } + }; + + struct not_a_dag : public bad_graph { + not_a_dag() + : bad_graph("The graph must be a DAG.") { } + }; + + struct negative_edge : public bad_graph { + negative_edge() + : bad_graph("The graph may not contain an edge with negative weight."){ } + }; + + struct negative_cycle : public bad_graph { + negative_cycle() + : bad_graph("The graph may not contain negative cycles.") { } + }; + struct not_connected : public bad_graph { + not_connected() + : bad_graph("The graph must be connected.") { } + }; + +} // namespace boost + +#endif // BOOST_GRAPH_EXCEPTION_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/filtered_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/filtered_graph.hpp new file mode 100644 index 0000000000..2a30a7127c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/filtered_graph.hpp @@ -0,0 +1,507 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_FILTERED_GRAPH_HPP +#define BOOST_FILTERED_GRAPH_HPP + +#include +#include +#include +#include + +namespace boost { + + //========================================================================= + // Some predicate classes. + + struct keep_all { + template + bool operator()(const T&) const { return true; } + }; + + // Keep residual edges (used in maximum-flow algorithms). + template + struct is_residual_edge { + is_residual_edge() { } + is_residual_edge(ResidualCapacityEdgeMap rcap) : m_rcap(rcap) { } + template + bool operator()(const Edge& e) const { + return 0 < get(m_rcap, e); + } + ResidualCapacityEdgeMap m_rcap; + }; + + template + struct is_in_subset { + is_in_subset() : m_s(0) { } + is_in_subset(const Set& s) : m_s(&s) { } + + template + bool operator()(const Elt& x) const { + return set_contains(*m_s, x); + } + const Set* m_s; + }; + + template + struct is_not_in_subset { + is_not_in_subset() : m_s(0) { } + is_not_in_subset(const Set& s) : m_s(&s) { } + + template + bool operator()(const Elt& x) const { + return !set_contains(*m_s, x); + } + const Set* m_s; + }; + + namespace detail { + + template + struct out_edge_predicate { + out_edge_predicate() { } + out_edge_predicate(EdgePredicate ep, VertexPredicate vp, + const Graph& g) + : m_edge_pred(ep), m_vertex_pred(vp), m_g(&g) { } + + template + bool operator()(const Edge& e) const { + return m_edge_pred(e) && m_vertex_pred(target(e, *m_g)); + } + EdgePredicate m_edge_pred; + VertexPredicate m_vertex_pred; + const Graph* m_g; + }; + + template + struct in_edge_predicate { + in_edge_predicate() { } + in_edge_predicate(EdgePredicate ep, VertexPredicate vp, + const Graph& g) + : m_edge_pred(ep), m_vertex_pred(vp), m_g(&g) { } + + template + bool operator()(const Edge& e) const { + return m_edge_pred(e) && m_vertex_pred(source(e, *m_g)); + } + EdgePredicate m_edge_pred; + VertexPredicate m_vertex_pred; + const Graph* m_g; + }; + + template + struct edge_predicate { + edge_predicate() { } + edge_predicate(EdgePredicate ep, VertexPredicate vp, + const Graph& g) + : m_edge_pred(ep), m_vertex_pred(vp), m_g(&g) { } + + template + bool operator()(const Edge& e) const { + return m_edge_pred(e) + && m_vertex_pred(source(e, *m_g)) && m_vertex_pred(target(e, *m_g)); + } + EdgePredicate m_edge_pred; + VertexPredicate m_vertex_pred; + const Graph* m_g; + }; + + } // namespace detail + + + //=========================================================================== + // Filtered Graph + + struct filtered_graph_tag { }; + + // This base class is a stupid hack to change overload resolution + // rules for the source and target functions so that they are a + // worse match than the source and target functions defined for + // pairs in graph_traits.hpp. I feel dirty. -JGS + template + struct filtered_graph_base { + typedef graph_traits Traits; + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::edge_descriptor edge_descriptor; + filtered_graph_base(const G& g) : m_g(g) { } + //protected: + const G& m_g; + }; + + template + class filtered_graph : public filtered_graph_base { + typedef filtered_graph_base Base; + typedef graph_traits Traits; + typedef filtered_graph self; + public: + typedef Graph graph_type; + typedef detail::out_edge_predicate OutEdgePred; + typedef detail::in_edge_predicate InEdgePred; + typedef detail::edge_predicate EdgePred; + + // Constructors + filtered_graph(const Graph& g, EdgePredicate ep) + : Base(g), m_edge_pred(ep) { } + + filtered_graph(const Graph& g, EdgePredicate ep, VertexPredicate vp) + : Base(g), m_edge_pred(ep), m_vertex_pred(vp) { } + + // Graph requirements + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::edge_descriptor edge_descriptor; + typedef typename Traits::directed_category directed_category; + typedef typename Traits::edge_parallel_category edge_parallel_category; + typedef typename Traits::traversal_category traversal_category; + + // IncidenceGraph requirements + typedef filter_iterator< + OutEdgePred, typename Traits::out_edge_iterator + > out_edge_iterator; + + typedef typename Traits::degree_size_type degree_size_type; + + // AdjacencyGraph requirements + typedef typename adjacency_iterator_generator::type adjacency_iterator; + + // BidirectionalGraph requirements + typedef filter_iterator< + InEdgePred, typename Traits::in_edge_iterator + > in_edge_iterator; + + // VertexListGraph requirements + typedef filter_iterator< + VertexPredicate, typename Traits::vertex_iterator + > vertex_iterator; + typedef typename Traits::vertices_size_type vertices_size_type; + + // EdgeListGraph requirements + typedef filter_iterator< + EdgePred, typename Traits::edge_iterator + > edge_iterator; + typedef typename Traits::edges_size_type edges_size_type; + + typedef typename ::boost::edge_property_type::type edge_property_type; + typedef typename ::boost::vertex_property_type::type vertex_property_type; + typedef filtered_graph_tag graph_tag; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + // Bundled properties support + template + typename graph::detail::bundled_result::type& + operator[](Descriptor x) + { return const_cast(this->m_g)[x]; } + + template + typename graph::detail::bundled_result::type const& + operator[](Descriptor x) const + { return this->m_g[x]; } +#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + + static vertex_descriptor null_vertex() + { + return Graph::null_vertex(); + } + + //private: + EdgePredicate m_edge_pred; + VertexPredicate m_vertex_pred; + }; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + struct vertex_bundle_type > + : vertex_bundle_type { }; + + template + struct edge_bundle_type > + : edge_bundle_type { }; +#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + + //=========================================================================== + // Non-member functions for the Filtered Edge Graph + + // Helper functions + template + inline filtered_graph + make_filtered_graph(Graph& g, EdgePredicate ep) { + return filtered_graph(g, ep); + } + template + inline filtered_graph + make_filtered_graph(Graph& g, EdgePredicate ep, VertexPredicate vp) { + return filtered_graph(g, ep, vp); + } + + template + inline filtered_graph + make_filtered_graph(const Graph& g, EdgePredicate ep) { + return filtered_graph(g, ep); + } + template + inline filtered_graph + make_filtered_graph(const Graph& g, EdgePredicate ep, VertexPredicate vp) { + return filtered_graph(g, ep, vp); + } + + template + std::pair::vertex_iterator, + typename filtered_graph::vertex_iterator> + vertices(const filtered_graph& g) + { + typedef filtered_graph Graph; + typename graph_traits::vertex_iterator f, l; + tie(f, l) = vertices(g.m_g); + typedef typename Graph::vertex_iterator iter; + return std::make_pair(iter(g.m_vertex_pred, f, l), + iter(g.m_vertex_pred, l, l)); + } + + template + std::pair::edge_iterator, + typename filtered_graph::edge_iterator> + edges(const filtered_graph& g) + { + typedef filtered_graph Graph; + typename Graph::EdgePred pred(g.m_edge_pred, g.m_vertex_pred, g); + typename graph_traits::edge_iterator f, l; + tie(f, l) = edges(g.m_g); + typedef typename Graph::edge_iterator iter; + return std::make_pair(iter(pred, f, l), iter(pred, l, l)); + } + + // An alternative for num_vertices() and num_edges() would be to + // count the number in the filtered graph. This is problematic + // because of the interaction with the vertex indices... they would + // no longer go from 0 to num_vertices(), which would cause trouble + // for algorithms allocating property storage in an array. We could + // try to create a mapping to new recalibrated indices, but I don't + // see an efficient way to do this. + // + // However, the current solution is still unsatisfactory because + // the following semantic constraints no longer hold: + // tie(vi, viend) = vertices(g); + // assert(std::distance(vi, viend) == num_vertices(g)); + + template + typename filtered_graph::vertices_size_type + num_vertices(const filtered_graph& g) { + return num_vertices(g.m_g); + } + + template + typename filtered_graph::edges_size_type + num_edges(const filtered_graph& g) { + return num_edges(g.m_g); + } + + template + typename filtered_graph_base::vertex_descriptor + source(typename filtered_graph_base::edge_descriptor e, + const filtered_graph_base& g) + { + return source(e, g.m_g); + } + + template + typename filtered_graph_base::vertex_descriptor + target(typename filtered_graph_base::edge_descriptor e, + const filtered_graph_base& g) + { + return target(e, g.m_g); + } + + template + std::pair::out_edge_iterator, + typename filtered_graph::out_edge_iterator> + out_edges(typename filtered_graph::vertex_descriptor u, + const filtered_graph& g) + { + typedef filtered_graph Graph; + typename Graph::OutEdgePred pred(g.m_edge_pred, g.m_vertex_pred, g); + typedef typename Graph::out_edge_iterator iter; + typename graph_traits::out_edge_iterator f, l; + tie(f, l) = out_edges(u, g.m_g); + return std::make_pair(iter(pred, f, l), iter(pred, l, l)); + } + + template + typename filtered_graph::degree_size_type + out_degree(typename filtered_graph::vertex_descriptor u, + const filtered_graph& g) + { + typename filtered_graph::degree_size_type n = 0; + typename filtered_graph::out_edge_iterator f, l; + for (tie(f, l) = out_edges(u, g); f != l; ++f) + ++n; + return n; + } + + template + std::pair::adjacency_iterator, + typename filtered_graph::adjacency_iterator> + adjacent_vertices(typename filtered_graph::vertex_descriptor u, + const filtered_graph& g) + { + typedef filtered_graph Graph; + typedef typename Graph::adjacency_iterator adjacency_iterator; + typename Graph::out_edge_iterator f, l; + tie(f, l) = out_edges(u, g); + return std::make_pair(adjacency_iterator(f, const_cast(&g)), + adjacency_iterator(l, const_cast(&g))); + } + + template + std::pair::in_edge_iterator, + typename filtered_graph::in_edge_iterator> + in_edges(typename filtered_graph::vertex_descriptor u, + const filtered_graph& g) + { + typedef filtered_graph Graph; + typename Graph::InEdgePred pred(g.m_edge_pred, g.m_vertex_pred, g); + typedef typename Graph::in_edge_iterator iter; + typename graph_traits::in_edge_iterator f, l; + tie(f, l) = in_edges(u, g.m_g); + return std::make_pair(iter(pred, f, l), iter(pred, l, l)); + } + + template + typename filtered_graph::degree_size_type + in_degree(typename filtered_graph::vertex_descriptor u, + const filtered_graph& g) + { + typename filtered_graph::degree_size_type n = 0; + typename filtered_graph::in_edge_iterator f, l; + for (tie(f, l) = in_edges(u, g); f != l; ++f) + ++n; + return n; + } + + template + std::pair::edge_descriptor, bool> + edge(typename filtered_graph::vertex_descriptor u, + typename filtered_graph::vertex_descriptor v, + const filtered_graph& g) + { + typename graph_traits::edge_descriptor e; + bool exists; + tie(e, exists) = edge(u, v, g.m_g); + return std::make_pair(e, exists && g.m_edge_pred(e)); + } + + template + std::pair::out_edge_iterator, + typename filtered_graph::out_edge_iterator> + edge_range(typename filtered_graph::vertex_descriptor u, + typename filtered_graph::vertex_descriptor v, + const filtered_graph& g) + { + typedef filtered_graph Graph; + typename Graph::OutEdgePred pred(g.m_edge_pred, g.m_vertex_pred, g); + typedef typename Graph::out_edge_iterator iter; + typename graph_traits::out_edge_iterator f, l; + tie(f, l) = edge_range(u, v, g.m_g); + return std::make_pair(iter(pred, f, l), iter(pred, l, l)); + } + + + //=========================================================================== + // Property map + + namespace detail { + struct filtered_graph_property_selector { + template + struct bind_ { + typedef typename FilteredGraph::graph_type Graph; + typedef property_map Map; + typedef typename Map::type type; + typedef typename Map::const_type const_type; + }; + }; + } // namespace detail + + template <> + struct vertex_property_selector { + typedef detail::filtered_graph_property_selector type; + }; + template <> + struct edge_property_selector { + typedef detail::filtered_graph_property_selector type; + }; + + template + typename property_map::type + get(Property p, filtered_graph& g) + { + return get(p, const_cast(g.m_g)); + } + + template + typename property_map::const_type + get(Property p, const filtered_graph& g) + { + return get(p, (const G&)g.m_g); + } + + template + typename property_map_value::type + get(Property p, const filtered_graph& g, const Key& k) + { + return get(p, (const G&)g.m_g, k); + } + + template + void + put(Property p, const filtered_graph& g, const Key& k, + const Value& val) + { + put(p, const_cast(g.m_g), k, val); + } + + //=========================================================================== + // Some filtered subgraph specializations + + template + struct vertex_subset_filter { + typedef filtered_graph > type; + }; + template + inline typename vertex_subset_filter::type + make_vertex_subset_filter(Graph& g, const Set& s) { + typedef typename vertex_subset_filter::type Filter; + is_in_subset p(s); + return Filter(g, keep_all(), p); + } + + template + struct vertex_subset_compliment_filter { + typedef filtered_graph > type; + }; + template + inline typename vertex_subset_compliment_filter::type + make_vertex_subset_compliment_filter(Graph& g, const Set& s) { + typedef typename vertex_subset_compliment_filter::type Filter; + is_not_in_subset p(s); + return Filter(g, keep_all(), p); + } + + +} // namespace boost + + +#endif // BOOST_FILTERED_GRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/floyd_warshall_shortest.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/floyd_warshall_shortest.hpp new file mode 100644 index 0000000000..6204ca0e32 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/floyd_warshall_shortest.hpp @@ -0,0 +1,251 @@ +// Copyright 2002 Rensselaer Polytechnic Institute + +// 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) + +// Authors: Lauren Foutz +// Scott Hill + +/* + This file implements the functions + + template + bool floyd_warshall_initialized_all_pairs_shortest_paths( + const VertexListGraph& g, DistanceMatrix& d, + const bgl_named_params& params) + + AND + + template + bool floyd_warshall_all_pairs_shortest_paths( + const VertexAndEdgeListGraph& g, DistanceMatrix& d, + const bgl_named_params& params) +*/ + + +#ifndef BOOST_GRAPH_FLOYD_WARSHALL_HPP +#define BOOST_GRAPH_FLOYD_WARSHALL_HPP + +#include +#include +#include +#include +#include + +namespace boost +{ + namespace detail { + template + T min_with_compare(const T& x, const T& y, const BinaryPredicate& compare) + { + if (compare(x, y)) return x; + else return y; + } + + template + bool floyd_warshall_dispatch(const VertexListGraph& g, + DistanceMatrix& d, const BinaryPredicate &compare, + const BinaryFunction &combine, const Infinity& inf, + const Zero& zero) + { + typename graph_traits::vertex_iterator + i, lasti, j, lastj, k, lastk; + + + for (tie(k, lastk) = vertices(g); k != lastk; k++) + for (tie(i, lasti) = vertices(g); i != lasti; i++) + if(d[*i][*k] != inf) + for (tie(j, lastj) = vertices(g); j != lastj; j++) + if(d[*k][*j] != inf) + d[*i][*j] = + detail::min_with_compare(d[*i][*j], + combine(d[*i][*k], d[*k][*j]), + compare); + + + for (tie(i, lasti) = vertices(g); i != lasti; i++) + if (compare(d[*i][*i], zero)) + return false; + return true; + } + } + + template + bool floyd_warshall_initialized_all_pairs_shortest_paths( + const VertexListGraph& g, DistanceMatrix& d, + const BinaryPredicate& compare, + const BinaryFunction& combine, const Infinity& inf, + const Zero& zero) + { + function_requires >(); + + return detail::floyd_warshall_dispatch(g, d, compare, combine, + inf, zero); + } + + + + template + bool floyd_warshall_all_pairs_shortest_paths( + const VertexAndEdgeListGraph& g, + DistanceMatrix& d, const WeightMap& w, + const BinaryPredicate& compare, const BinaryFunction& combine, + const Infinity& inf, const Zero& zero) + { + function_requires >(); + function_requires >(); + function_requires >(); + + typename graph_traits::vertex_iterator + firstv, lastv, firstv2, lastv2; + typename graph_traits::edge_iterator first, last; + + + for(tie(firstv, lastv) = vertices(g); firstv != lastv; firstv++) + for(tie(firstv2, lastv2) = vertices(g); firstv2 != lastv2; firstv2++) + d[*firstv][*firstv2] = inf; + + + for(tie(firstv, lastv) = vertices(g); firstv != lastv; firstv++) + d[*firstv][*firstv] = zero; + + + for(tie(first, last) = edges(g); first != last; first++) + { + if (d[source(*first, g)][target(*first, g)] != inf) { + d[source(*first, g)][target(*first, g)] = + detail::min_with_compare( + get(w, *first), + d[source(*first, g)][target(*first, g)], + compare); + } else + d[source(*first, g)][target(*first, g)] = get(w, *first); + } + + bool is_undirected = is_same::directed_category, + undirected_tag>::value; + if (is_undirected) + { + for(tie(first, last) = edges(g); first != last; first++) + { + if (d[target(*first, g)][source(*first, g)] != inf) + d[target(*first, g)][source(*first, g)] = + detail::min_with_compare( + get(w, *first), + d[target(*first, g)][source(*first, g)], + compare); + else + d[target(*first, g)][source(*first, g)] = get(w, *first); + } + } + + + return detail::floyd_warshall_dispatch(g, d, compare, combine, + inf, zero); + } + + + namespace detail { + template + bool floyd_warshall_init_dispatch(const VertexListGraph& g, + DistanceMatrix& d, WeightMap w, + const bgl_named_params& params) + { + typedef typename property_traits::value_type WM; + + return floyd_warshall_initialized_all_pairs_shortest_paths(g, d, + choose_param(get_param(params, distance_compare_t()), + std::less()), + choose_param(get_param(params, distance_combine_t()), + closed_plus()), + choose_param(get_param(params, distance_inf_t()), + std::numeric_limits::max BOOST_PREVENT_MACRO_SUBSTITUTION()), + choose_param(get_param(params, distance_zero_t()), + WM())); + } + + + + template + bool floyd_warshall_noninit_dispatch(const VertexAndEdgeListGraph& g, + DistanceMatrix& d, WeightMap w, + const bgl_named_params& params) + { + typedef typename property_traits::value_type WM; + + return floyd_warshall_all_pairs_shortest_paths(g, d, w, + choose_param(get_param(params, distance_compare_t()), + std::less()), + choose_param(get_param(params, distance_combine_t()), + closed_plus()), + choose_param(get_param(params, distance_inf_t()), + std::numeric_limits::max BOOST_PREVENT_MACRO_SUBSTITUTION()), + choose_param(get_param(params, distance_zero_t()), + WM())); + } + + + } // namespace detail + + + + template + bool floyd_warshall_initialized_all_pairs_shortest_paths( + const VertexListGraph& g, DistanceMatrix& d, + const bgl_named_params& params) + { + return detail::floyd_warshall_init_dispatch(g, d, + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + params); + } + + template + bool floyd_warshall_initialized_all_pairs_shortest_paths( + const VertexListGraph& g, DistanceMatrix& d) + { + bgl_named_params params(0); + return detail::floyd_warshall_init_dispatch(g, d, + get(edge_weight, g), params); + } + + + + + template + bool floyd_warshall_all_pairs_shortest_paths( + const VertexAndEdgeListGraph& g, DistanceMatrix& d, + const bgl_named_params& params) + { + return detail::floyd_warshall_noninit_dispatch(g, d, + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + params); + } + + template + bool floyd_warshall_all_pairs_shortest_paths( + const VertexAndEdgeListGraph& g, DistanceMatrix& d) + { + bgl_named_params params(0); + return detail::floyd_warshall_noninit_dispatch(g, d, + get(edge_weight, g), params); + } + + +} // namespace boost + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/fruchterman_reingold.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/fruchterman_reingold.hpp new file mode 100644 index 0000000000..f5ea6af7b3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/fruchterman_reingold.hpp @@ -0,0 +1,420 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP +#define BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP + +#include +#include +#include +#include +#include +#include +#include // for std::min and std::max + +namespace boost { + +struct square_distance_attractive_force { + template + T + operator()(typename graph_traits::edge_descriptor, + T k, + T d, + const Graph&) const + { + return d * d / k; + } +}; + +struct square_distance_repulsive_force { + template + T + operator()(typename graph_traits::vertex_descriptor, + typename graph_traits::vertex_descriptor, + T k, + T d, + const Graph&) const + { + return k * k / d; + } +}; + +template +struct linear_cooling { + typedef T result_type; + + linear_cooling(std::size_t iterations) + : temp(T(iterations) / T(10)), step(0.1) { } + + linear_cooling(std::size_t iterations, T temp) + : temp(temp), step(temp / T(iterations)) { } + + T operator()() + { + T old_temp = temp; + temp -= step; + if (temp < T(0)) temp = T(0); + return old_temp; + } + + private: + T temp; + T step; +}; + +struct all_force_pairs +{ + template + void operator()(const Graph& g, ApplyForce apply_force) + { + typedef typename graph_traits::vertex_iterator vertex_iterator; + vertex_iterator v, end; + for (tie(v, end) = vertices(g); v != end; ++v) { + vertex_iterator u = v; + for (++u; u != end; ++u) { + apply_force(*u, *v); + apply_force(*v, *u); + } + } + } +}; + +template +struct grid_force_pairs +{ + template + explicit + grid_force_pairs(Dim width, Dim height, PositionMap position, const Graph& g) + : width(width), height(height), position(position) + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + two_k = Dim(2) * sqrt(width*height / num_vertices(g)); + } + + template + void operator()(const Graph& g, ApplyForce apply_force) + { + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef std::list bucket_t; + typedef std::vector buckets_t; + + std::size_t columns = std::size_t(width / two_k + Dim(1)); + std::size_t rows = std::size_t(height / two_k + Dim(1)); + buckets_t buckets(rows * columns); + vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + std::size_t column = std::size_t((position[*v].x + width / 2) / two_k); + std::size_t row = std::size_t((position[*v].y + height / 2) / two_k); + + if (column >= columns) column = columns - 1; + if (row >= rows) row = rows - 1; + buckets[row * columns + column].push_back(*v); + } + + for (std::size_t row = 0; row < rows; ++row) + for (std::size_t column = 0; column < columns; ++column) { + bucket_t& bucket = buckets[row * columns + column]; + typedef typename bucket_t::iterator bucket_iterator; + for (bucket_iterator u = bucket.begin(); u != bucket.end(); ++u) { + // Repulse vertices in this bucket + bucket_iterator v = u; + for (++v; v != bucket.end(); ++v) { + apply_force(*u, *v); + apply_force(*v, *u); + } + + std::size_t adj_start_row = row == 0? 0 : row - 1; + std::size_t adj_end_row = row == rows - 1? row : row + 1; + std::size_t adj_start_column = column == 0? 0 : column - 1; + std::size_t adj_end_column = column == columns - 1? column : column + 1; + for (std::size_t other_row = adj_start_row; other_row <= adj_end_row; + ++other_row) + for (std::size_t other_column = adj_start_column; + other_column <= adj_end_column; ++other_column) + if (other_row != row || other_column != column) { + // Repulse vertices in this bucket + bucket_t& other_bucket + = buckets[other_row * columns + other_column]; + for (v = other_bucket.begin(); v != other_bucket.end(); ++v) + apply_force(*u, *v); + } + } + } + } + + private: + Dim width; + Dim height; + PositionMap position; + Dim two_k; +}; + +template +inline grid_force_pairs +make_grid_force_pairs(Dim width, Dim height, const PositionMap& position, + const Graph& g) +{ return grid_force_pairs(width, height, position, g); } + +template +void +scale_graph(const Graph& g, PositionMap position, + Dim left, Dim top, Dim right, Dim bottom) +{ + if (num_vertices(g) == 0) return; + + if (bottom > top) { + using std::swap; + swap(bottom, top); + } + + typedef typename graph_traits::vertex_iterator vertex_iterator; + + // Find min/max ranges + Dim minX = position[*vertices(g).first].x, maxX = minX; + Dim minY = position[*vertices(g).first].y, maxY = minY; + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + minX = min BOOST_PREVENT_MACRO_SUBSTITUTION (minX, position[*vi].x); + maxX = max BOOST_PREVENT_MACRO_SUBSTITUTION (maxX, position[*vi].x); + minY = min BOOST_PREVENT_MACRO_SUBSTITUTION (minY, position[*vi].y); + maxY = max BOOST_PREVENT_MACRO_SUBSTITUTION (maxY, position[*vi].y); + } + + // Scale to bounding box provided + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { + position[*vi].x = ((position[*vi].x - minX) / (maxX - minX)) + * (right - left) + left; + position[*vi].y = ((position[*vi].y - minY) / (maxY - minY)) + * (top - bottom) + bottom; + } +} + +namespace detail { + template + struct fr_apply_force + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + fr_apply_force(const PositionMap& position, + const DisplacementMap& displacement, + RepulsiveForce repulsive_force, Dim k, const Graph& g) + : position(position), displacement(displacement), + repulsive_force(repulsive_force), k(k), g(g) + { } + + void operator()(vertex_descriptor u, vertex_descriptor v) + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + if (u != v) { + Dim delta_x = position[v].x - position[u].x; + Dim delta_y = position[v].y - position[u].y; + Dim dist = sqrt(delta_x * delta_x + delta_y * delta_y); + Dim fr = repulsive_force(u, v, k, dist, g); + displacement[v].x += delta_x / dist * fr; + displacement[v].y += delta_y / dist * fr; + } + } + + private: + PositionMap position; + DisplacementMap displacement; + RepulsiveForce repulsive_force; + Dim k; + const Graph& g; + }; + +} // end namespace detail + +template +void +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + Dim width, + Dim height, + AttractiveForce attractive_force, + RepulsiveForce repulsive_force, + ForcePairs force_pairs, + Cooling cool, + DisplacementMap displacement) +{ + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_iterator edge_iterator; + +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + + Dim area = width * height; + // assume positions are initialized randomly + Dim k = sqrt(area / num_vertices(g)); + + detail::fr_apply_force + apply_force(position, displacement, repulsive_force, k, g); + + Dim temp = cool(); + if (temp) do { + // Calculate repulsive forces + vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + displacement[*v].x = 0; + displacement[*v].y = 0; + } + force_pairs(g, apply_force); + + // Calculate attractive forces + edge_iterator e, e_end; + for (tie(e, e_end) = edges(g); e != e_end; ++e) { + vertex_descriptor v = source(*e, g); + vertex_descriptor u = target(*e, g); + Dim delta_x = position[v].x - position[u].x; + Dim delta_y = position[v].y - position[u].y; + Dim dist = sqrt(delta_x * delta_x + delta_y * delta_y); + Dim fa = attractive_force(*e, k, dist, g); + + displacement[v].x -= delta_x / dist * fa; + displacement[v].y -= delta_y / dist * fa; + displacement[u].x += delta_x / dist * fa; + displacement[u].y += delta_y / dist * fa; + } + + // Update positions + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + Dim disp_size = sqrt(displacement[*v].x * displacement[*v].x + + displacement[*v].y * displacement[*v].y); + position[*v].x += displacement[*v].x / disp_size + * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp); + position[*v].y += displacement[*v].y / disp_size + * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp); + position[*v].x = min BOOST_PREVENT_MACRO_SUBSTITUTION + (width / 2, + max BOOST_PREVENT_MACRO_SUBSTITUTION(-width / 2, + position[*v].x)); + position[*v].y = min BOOST_PREVENT_MACRO_SUBSTITUTION + (height / 2, + max BOOST_PREVENT_MACRO_SUBSTITUTION(-height / 2, + position[*v].y)); + } + } while (temp = cool()); +} + +namespace detail { + template + struct fr_force_directed_layout + { + template + static void + run(const Graph& g, + PositionMap position, + Dim width, + Dim height, + AttractiveForce attractive_force, + RepulsiveForce repulsive_force, + ForcePairs force_pairs, + Cooling cool, + DisplacementMap displacement, + const bgl_named_params&) + { + fruchterman_reingold_force_directed_layout + (g, position, width, height, attractive_force, repulsive_force, + force_pairs, cool, displacement); + } + }; + + template<> + struct fr_force_directed_layout + { + template + static void + run(const Graph& g, + PositionMap position, + Dim width, + Dim height, + AttractiveForce attractive_force, + RepulsiveForce repulsive_force, + ForcePairs force_pairs, + Cooling cool, + error_property_not_found, + const bgl_named_params& params) + { + std::vector > displacements(num_vertices(g)); + fruchterman_reingold_force_directed_layout + (g, position, width, height, attractive_force, repulsive_force, + force_pairs, cool, + make_iterator_property_map + (displacements.begin(), + choose_const_pmap(get_param(params, vertex_index), g, + vertex_index), + simple_point())); + } + }; + +} // end namespace detail + +template +void +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + Dim width, + Dim height, + const bgl_named_params& params) +{ + typedef typename property_value, + vertex_displacement_t>::type D; + + detail::fr_force_directed_layout::run + (g, position, width, height, + choose_param(get_param(params, attractive_force_t()), + square_distance_attractive_force()), + choose_param(get_param(params, repulsive_force_t()), + square_distance_repulsive_force()), + choose_param(get_param(params, force_pairs_t()), + make_grid_force_pairs(width, height, position, g)), + choose_param(get_param(params, cooling_t()), + linear_cooling(100)), + get_param(params, vertex_displacement_t()), + params); +} + +template +void +fruchterman_reingold_force_directed_layout(const Graph& g, + PositionMap position, + Dim width, + Dim height) +{ + fruchterman_reingold_force_directed_layout + (g, position, width, height, + attractive_force(square_distance_attractive_force())); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_archetypes.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_archetypes.hpp new file mode 100644 index 0000000000..ce4c85fd08 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_archetypes.hpp @@ -0,0 +1,290 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_ARCHETYPES_HPP +#define BOOST_GRAPH_ARCHETYPES_HPP + +#include +#include + +namespace boost { // should use a different namespace for this + + namespace detail { + struct null_graph_archetype : public null_archetype<> { + struct traversal_category { }; + }; + } + + //=========================================================================== + template + struct incidence_graph_archetype : public Base + { + typedef typename Base::traversal_category base_trav_cat; + struct traversal_category + : public incidence_graph_tag, public base_trav_cat { }; +#if 0 + typedef immutable_graph_tag mutability_category; +#endif + typedef Vertex vertex_descriptor; + typedef unsigned int degree_size_type; + typedef unsigned int vertices_size_type; + typedef unsigned int edges_size_type; + struct edge_descriptor { + edge_descriptor() { } + edge_descriptor(const detail::dummy_constructor&) { } + bool operator==(const edge_descriptor&) const { return false; } + bool operator!=(const edge_descriptor&) const { return false; } + }; + typedef input_iterator_archetype out_edge_iterator; + + typedef Directed directed_category; + typedef ParallelCategory edge_parallel_category; + + typedef void adjacency_iterator; + typedef void in_edge_iterator; + typedef void vertex_iterator; + typedef void edge_iterator; + }; + template + V source(const typename incidence_graph_archetype::edge_descriptor&, + const incidence_graph_archetype& ) + { + return V(static_object::get()); + } + template + V target(const typename incidence_graph_archetype::edge_descriptor&, + const incidence_graph_archetype& ) + { + return V(static_object::get()); + } + + template + std::pair::out_edge_iterator, + typename incidence_graph_archetype::out_edge_iterator> + out_edges(const V&, const incidence_graph_archetype& ) + { + typedef typename incidence_graph_archetype::out_edge_iterator Iter; + return std::make_pair(Iter(), Iter()); + } + + template + typename incidence_graph_archetype::degree_size_type + out_degree(const V&, const incidence_graph_archetype& ) + { + return 0; + } + + //=========================================================================== + template + struct adjacency_graph_archetype : public Base + { + typedef typename Base::traversal_category base_trav_cat; + struct traversal_category + : public adjacency_graph_tag, public base_trav_cat { }; + typedef Vertex vertex_descriptor; + typedef unsigned int degree_size_type; + typedef unsigned int vertices_size_type; + typedef unsigned int edges_size_type; + typedef void edge_descriptor; + typedef input_iterator_archetype adjacency_iterator; + + typedef Directed directed_category; + typedef ParallelCategory edge_parallel_category; + + typedef void in_edge_iterator; + typedef void out_edge_iterator; + typedef void vertex_iterator; + typedef void edge_iterator; + }; + + template + std::pair::adjacency_iterator, + typename adjacency_graph_archetype::adjacency_iterator> + adjacent_vertices(const V&, const adjacency_graph_archetype& ) + { + typedef typename adjacency_graph_archetype::adjacency_iterator Iter; + return std::make_pair(Iter(), Iter()); + } + + template + typename adjacency_graph_archetype::degree_size_type + out_degree(const V&, const adjacency_graph_archetype& ) + { + return 0; + } + + //=========================================================================== + template + struct vertex_list_graph_archetype : public Base + { + typedef incidence_graph_archetype + Incidence; + typedef adjacency_graph_archetype + Adjacency; + + typedef typename Base::traversal_category base_trav_cat; + struct traversal_category + : public vertex_list_graph_tag, public base_trav_cat { }; +#if 0 + typedef immutable_graph_tag mutability_category; +#endif + typedef Vertex vertex_descriptor; + typedef unsigned int degree_size_type; + typedef typename Incidence::edge_descriptor edge_descriptor; + typedef typename Incidence::out_edge_iterator out_edge_iterator; + typedef typename Adjacency::adjacency_iterator adjacency_iterator; + + typedef input_iterator_archetype vertex_iterator; + typedef unsigned int vertices_size_type; + typedef unsigned int edges_size_type; + + typedef Directed directed_category; + typedef ParallelCategory edge_parallel_category; + + typedef void in_edge_iterator; + typedef void edge_iterator; + }; + + template + std::pair::vertex_iterator, + typename vertex_list_graph_archetype::vertex_iterator> + vertices(const vertex_list_graph_archetype& ) + { + typedef typename vertex_list_graph_archetype::vertex_iterator Iter; + return std::make_pair(Iter(), Iter()); + } + + template + typename vertex_list_graph_archetype::vertices_size_type + num_vertices(const vertex_list_graph_archetype& ) + { + return 0; + } + + // ambiguously inherited from incidence graph and adjacency graph + template + typename vertex_list_graph_archetype::degree_size_type + out_degree(const V&, const vertex_list_graph_archetype& ) + { + return 0; + } + + //=========================================================================== + + struct property_graph_archetype_tag { }; + + template + struct property_graph_archetype : public GraphArchetype + { + typedef property_graph_archetype_tag graph_tag; + typedef ValueArch vertex_property_type; + typedef ValueArch edge_property_type; + }; + + struct choose_edge_property_map_archetype { + template + struct bind_ { + typedef mutable_lvalue_property_map_archetype + type; + typedef lvalue_property_map_archetype + const_type; + }; + }; + template <> + struct edge_property_selector { + typedef choose_edge_property_map_archetype type; + }; + + struct choose_vertex_property_map_archetype { + template + struct bind_ { + typedef mutable_lvalue_property_map_archetype + type; + typedef lvalue_property_map_archetype + const_type; + }; + }; + + template <> + struct vertex_property_selector { + typedef choose_vertex_property_map_archetype type; + }; + + template + typename property_map, P>::type + get(P, property_graph_archetype&) { + typename property_map, P>::type pmap; + return pmap; + } + + template + typename property_map, P>::const_type + get(P, const property_graph_archetype&) { + typename property_map, P>::const_type pmap; + return pmap; + } + + template + typename property_traits, P>::const_type>::value_type + get(P p, const property_graph_archetype& g, K k) { + return get( get(p, g), k); + } + + template + void + put(P p, property_graph_archetype& g, + const Key& key, const V& value) + { + typedef typename boost::property_map, P>::type Map; + Map pmap = get(p, g); + put(pmap, key, value); + } + + struct color_value_archetype { + color_value_archetype() { } + color_value_archetype(detail::dummy_constructor) { } + bool operator==(const color_value_archetype& ) const { return true; } + bool operator!=(const color_value_archetype& ) const { return true; } + }; + template <> + struct color_traits { + static color_value_archetype white() + { + return color_value_archetype + (static_object::get()); + } + static color_value_archetype gray() + { + return color_value_archetype + (static_object::get()); + } + static color_value_archetype black() + { + return color_value_archetype + (static_object::get()); + } + }; + + template + class buffer_archetype { + public: + void push(const T&) {} + void pop() {} + T& top() { return static_object::get(); } + const T& top() const { return static_object::get(); } + bool empty() const { return true; } + }; + +} // namespace boost + + +#endif // BOOST_GRAPH_ARCHETYPES_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_as_tree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_as_tree.hpp new file mode 100644 index 0000000000..7619dfcc0a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_as_tree.hpp @@ -0,0 +1,154 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_GRAPH_AS_TREE_HPP +#define BOOST_GRAPH_GRAPH_AS_TREE_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + class graph_as_tree_base + { + typedef Derived Tree; + public: + typedef Node node_descriptor; + typedef ChIt children_iterator; + + graph_as_tree_base(Graph& g, Node root) : _g(g), _root(root) { } + + friend Node root(const Tree& t) { return t._root; } + + template + friend std::pair + children(N n, const Tree& t) { return adjacent_vertices(n, t._g); } + + template + friend Node parent(N n, const Tree& t) { + return boost::get(t.parent_pa(), n); + } + + Graph& _g; + Node _root; + }; + + struct graph_as_tree_tag { }; + + template ::vertex_descriptor +#endif + , class ChIt +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + = typename graph_traits::adjacency_iterator +#endif + > + class graph_as_tree + : public graph_as_tree_base > + { + typedef graph_as_tree self; + typedef graph_as_tree_base super; + public: + graph_as_tree(Graph& g, Node root) : super(g, root) { } + + graph_as_tree(Graph& g, Node root, ParentMap p) : super(g, root), _p(p) { + breadth_first_search(g, root, + visitor(make_bfs_visitor + (record_predecessors(p, boost::on_tree_edge())))); + } + ParentMap parent_pa() const { return _p; } + typedef graph_as_tree_tag graph_tag; // for property_map + protected: + ParentMap _p; + }; + + + namespace detail { + + struct graph_as_tree_vertex_property_selector { + template + struct bind_ { + typedef typename GraphAsTree::base_type Graph; + typedef property_map PMap; + typedef typename PMap::type type; + typedef typename PMap::const_type const_type; + }; + }; + + struct graph_as_tree_edge_property_selector { + template + struct bind_ { + typedef typename GraphAsTree::base_type Graph; + typedef property_map PMap; + typedef typename PMap::type type; + typedef typename PMap::const_type const_type; + }; + }; + + } // namespace detail + + template <> + struct vertex_property_selector { + typedef detail::graph_as_tree_vertex_property_selector type; + }; + + template <> + struct edge_property_selector { + typedef detail::graph_as_tree_edge_property_selector type; + }; + + template + typename property_map::type + get(Property p, graph_as_tree& g) + { + return get(p, g._g); + } + + template + typename property_map::const_type + get(Property p, const graph_as_tree& g) + { + const Graph& gref = g._g; // in case GRef is non-const + return get(p, gref); + } + + template + typename property_traits< + typename property_map::const_type + >::value_type + get(Property p, const graph_as_tree& g, const Key& k) + { + return get(p, g._g, k); + } + + template + void + put(Property p, const graph_as_tree& g, const Key& k, + const Value& val) + { + put(p, g._g, k, val); + } + +} // namespace boost + +#endif // BOOST_GRAPH_GRAPH_AS_TREE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_concepts.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_concepts.hpp new file mode 100644 index 0000000000..c6a3fe6cfe --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_concepts.hpp @@ -0,0 +1,510 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_CONCEPTS_HPP +#define BOOST_GRAPH_CONCEPTS_HPP + +#include +#include +#include +#include +#include +#include + +#include + +namespace boost +{ +// dwa 2003/7/11 -- This clearly shouldn't be necessary, but if +// you want to use vector_as_graph, it is! I'm sure the graph +// library leaves these out all over the place. Probably a +// redesign involving specializing a template with a static +// member function is in order :( +// +// It is needed in order to allow us to write using boost::vertices as +// needed for ADL when using vector_as_graph below. +#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) \ + && !BOOST_WORKAROUND(__GNUC__, <= 2) \ + && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# define BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK +#endif + +#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK +template +typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); +#endif + + namespace concepts { + BOOST_concept(MultiPassInputIterator,(T)) { + BOOST_CONCEPT_USAGE(MultiPassInputIterator) { + BOOST_CONCEPT_ASSERT((InputIterator)); + } + }; + + BOOST_concept(Graph,(G)) + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::directed_category directed_category; + typedef typename graph_traits::edge_parallel_category + edge_parallel_category; + + typedef typename graph_traits::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(Graph) + { + BOOST_CONCEPT_ASSERT((DefaultConstructible)); + BOOST_CONCEPT_ASSERT((EqualityComparable)); + BOOST_CONCEPT_ASSERT((Assignable)); + } + G g; + }; + + BOOST_concept(IncidenceGraph,(G)) + : Graph + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::out_edge_iterator + out_edge_iterator; + + typedef typename graph_traits::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(IncidenceGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator)); + BOOST_CONCEPT_ASSERT((DefaultConstructible)); + BOOST_CONCEPT_ASSERT((EqualityComparable)); + BOOST_CONCEPT_ASSERT((Assignable)); + BOOST_CONCEPT_ASSERT((Convertible)); + + p = out_edges(u, g); + n = out_degree(u, g); + e = *p.first; + u = source(e, g); + v = target(e, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = out_edges(u, cg); + n = out_degree(u, cg); + e = *p.first; + u = source(e, cg); + v = target(e, cg); + } + std::pair p; + typename graph_traits::vertex_descriptor u, v; + typename graph_traits::edge_descriptor e; + typename graph_traits::degree_size_type n; + G g; + }; + + BOOST_concept(BidirectionalGraph,(G)) + : IncidenceGraph + { + typedef typename graph_traits::in_edge_iterator + in_edge_iterator; + typedef typename graph_traits::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(BidirectionalGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator)); + BOOST_CONCEPT_ASSERT((Convertible)); + + p = in_edges(v, g); + n = in_degree(v, g); + e = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { + p = in_edges(v, cg); + n = in_degree(v, cg); + e = *p.first; + } + std::pair p; + typename graph_traits::vertex_descriptor v; + typename graph_traits::edge_descriptor e; + typename graph_traits::degree_size_type n; + G g; + }; + + BOOST_concept(AdjacencyGraph,(G)) + : Graph + { + typedef typename graph_traits::adjacency_iterator + adjacency_iterator; + typedef typename graph_traits::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(AdjacencyGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator)); + BOOST_CONCEPT_ASSERT((Convertible)); + + p = adjacent_vertices(v, g); + v = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { + p = adjacent_vertices(v, cg); + } + std::pair p; + typename graph_traits::vertex_descriptor v; + G g; + }; + + BOOST_concept(VertexListGraph,(G)) + : Graph + { + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(VertexListGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator)); + BOOST_CONCEPT_ASSERT((Convertible)); + +#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + p = vertices(g); + v = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { +#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + + p = vertices(cg); + v = *p.first; + V = num_vertices(cg); + } + std::pair p; + typename graph_traits::vertex_descriptor v; + G g; + vertices_size_type V; + }; + + BOOST_concept(EdgeListGraph,(G)) + : Graph + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::edge_iterator edge_iterator; + typedef typename graph_traits::edges_size_type edges_size_type; + typedef typename graph_traits::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(EdgeListGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator)); + BOOST_CONCEPT_ASSERT((DefaultConstructible)); + BOOST_CONCEPT_ASSERT((EqualityComparable)); + BOOST_CONCEPT_ASSERT((Assignable)); + BOOST_CONCEPT_ASSERT((Convertible)); + + p = edges(g); + e = *p.first; + u = source(e, g); + v = target(e, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = edges(cg); + E = num_edges(cg); + e = *p.first; + u = source(e, cg); + v = target(e, cg); + } + std::pair p; + typename graph_traits::vertex_descriptor u, v; + typename graph_traits::edge_descriptor e; + edges_size_type E; + G g; + }; + + BOOST_concept(VertexAndEdgeListGraph,(G)) + : VertexListGraph + , EdgeListGraph + { + }; + + // Where to put the requirement for this constructor? + // G g(n_vertices); + // Not in mutable graph, then LEDA graph's can't be models of + // MutableGraph. + + BOOST_concept(EdgeMutableGraph,(G)) + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + + BOOST_CONCEPT_USAGE(EdgeMutableGraph) { + p = add_edge(u, v, g); + remove_edge(u, v, g); + remove_edge(e, g); + clear_vertex(v, g); + } + G g; + edge_descriptor e; + std::pair p; + typename graph_traits::vertex_descriptor u, v; + }; + + BOOST_concept(VertexMutableGraph,(G)) + { + + BOOST_CONCEPT_USAGE(VertexMutableGraph) { + v = add_vertex(g); + remove_vertex(v, g); + } + G g; + typename graph_traits::vertex_descriptor u, v; + }; + + BOOST_concept(MutableGraph,(G)) + : EdgeMutableGraph + , VertexMutableGraph + { + }; + + template + struct dummy_edge_predicate { + bool operator()(const edge_descriptor&) const { + return false; + } + }; + + BOOST_concept(MutableIncidenceGraph,(G)) + : MutableGraph + { + BOOST_CONCEPT_USAGE(MutableIncidenceGraph) { + remove_edge(iter, g); + remove_out_edge_if(u, p, g); + } + G g; + typedef typename graph_traits::edge_descriptor edge_descriptor; + dummy_edge_predicate p; + typename boost::graph_traits::vertex_descriptor u; + typename boost::graph_traits::out_edge_iterator iter; + }; + + BOOST_concept(MutableBidirectionalGraph,(G)) + : MutableIncidenceGraph + { + BOOST_CONCEPT_USAGE(MutableBidirectionalGraph) + { + remove_in_edge_if(u, p, g); + } + G g; + typedef typename graph_traits::edge_descriptor edge_descriptor; + dummy_edge_predicate p; + typename boost::graph_traits::vertex_descriptor u; + }; + + BOOST_concept(MutableEdgeListGraph,(G)) + : EdgeMutableGraph + { + BOOST_CONCEPT_USAGE(MutableEdgeListGraph) { + remove_edge_if(p, g); + } + G g; + typedef typename graph_traits::edge_descriptor edge_descriptor; + dummy_edge_predicate p; + }; + + BOOST_concept(VertexMutablePropertyGraph,(G)) + : VertexMutableGraph + { + BOOST_CONCEPT_USAGE(VertexMutablePropertyGraph) { + v = add_vertex(vp, g); + } + G g; + typename graph_traits::vertex_descriptor v; + typename vertex_property::type vp; + }; + + BOOST_concept(EdgeMutablePropertyGraph,(G)) + : EdgeMutableGraph + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + + BOOST_CONCEPT_USAGE(EdgeMutablePropertyGraph) { + p = add_edge(u, v, ep, g); + } + G g; + std::pair p; + typename graph_traits::vertex_descriptor u, v; + typename edge_property::type ep; + }; + + BOOST_concept(AdjacencyMatrix,(G)) + : Graph + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + + BOOST_CONCEPT_USAGE(AdjacencyMatrix) { + p = edge(u, v, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = edge(u, v, cg); + } + typename graph_traits::vertex_descriptor u, v; + std::pair p; + G g; + }; + + BOOST_concept(ReadablePropertyGraph,(G)(X)(Property)) + : Graph + { + typedef typename property_map::const_type const_Map; + + BOOST_CONCEPT_USAGE(ReadablePropertyGraph) + { + BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept)); + + const_constraints(g); + } + void const_constraints(const G& cg) { + const_Map pmap = get(Property(), cg); + pval = get(Property(), cg, x); + ignore_unused_variable_warning(pmap); + } + G g; + X x; + typename property_traits::value_type pval; + }; + + BOOST_concept(PropertyGraph,(G)(X)(Property)) + : ReadablePropertyGraph + { + typedef typename property_map::type Map; + BOOST_CONCEPT_USAGE(PropertyGraph) { + BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept)); + + Map pmap = get(Property(), g); + pval = get(Property(), g, x); + put(Property(), g, x, pval); + ignore_unused_variable_warning(pmap); + } + G g; + X x; + typename property_traits::value_type pval; + }; + + BOOST_concept(LvaluePropertyGraph,(G)(X)(Property)) + : ReadablePropertyGraph + { + typedef typename property_map::type Map; + typedef typename property_map::const_type const_Map; + + BOOST_CONCEPT_USAGE(LvaluePropertyGraph) { + BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept)); + + pval = get(Property(), g, x); + put(Property(), g, x, pval); + } + G g; + X x; + typename property_traits::value_type pval; + }; + + // This needs to move out of the graph library + BOOST_concept(Buffer,(B)) + { + BOOST_CONCEPT_USAGE(Buffer) { + b.push(t); + b.pop(); + typename B::value_type& v = b.top(); + const_constraints(b); + ignore_unused_variable_warning(v); + } + void const_constraints(const B& cb) { + const typename B::value_type& v = cb.top(); + n = cb.size(); + bool e = cb.empty(); + ignore_unused_variable_warning(v); + ignore_unused_variable_warning(e); + } + typename B::size_type n; + typename B::value_type t; + B b; + }; + + BOOST_concept(ColorValue,(C)) + : EqualityComparable + , DefaultConstructible + { + BOOST_CONCEPT_USAGE(ColorValue) { + c = color_traits::white(); + c = color_traits::gray(); + c = color_traits::black(); + } + C c; + }; + + BOOST_concept(BasicMatrix,(M)(I)(V)) + { + BOOST_CONCEPT_USAGE(BasicMatrix) { + V& elt = A[i][j]; + const_constraints(A); + ignore_unused_variable_warning(elt); + } + void const_constraints(const M& cA) { + const V& elt = cA[i][j]; + ignore_unused_variable_warning(elt); + } + M A; + I i, j; + }; + + } // end namespace concepts + + using boost::concepts::MultiPassInputIteratorConcept; + using boost::concepts::GraphConcept; + using boost::concepts::IncidenceGraphConcept; + using boost::concepts::BidirectionalGraphConcept; + using boost::concepts::AdjacencyGraphConcept; + using boost::concepts::VertexListGraphConcept; + using boost::concepts::EdgeListGraphConcept; + using boost::concepts::VertexAndEdgeListGraphConcept; + using boost::concepts::EdgeMutableGraphConcept; + using boost::concepts::VertexMutableGraphConcept; + using boost::concepts::MutableGraphConcept; + using boost::concepts::MutableIncidenceGraphConcept; + using boost::concepts::MutableBidirectionalGraphConcept; + using boost::concepts::MutableEdgeListGraphConcept; + using boost::concepts::VertexMutablePropertyGraphConcept; + using boost::concepts::EdgeMutablePropertyGraphConcept; + using boost::concepts::AdjacencyMatrixConcept; + using boost::concepts::ReadablePropertyGraphConcept; + using boost::concepts::PropertyGraphConcept; + using boost::concepts::LvaluePropertyGraphConcept; + using boost::concepts::BufferConcept; + using boost::concepts::ColorValueConcept; + using boost::concepts::BasicMatrixConcept; +} // namespace boost + +#include + +#endif /* BOOST_GRAPH_CONCEPTS_H */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_selectors.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_selectors.hpp new file mode 100644 index 0000000000..777ebefc94 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_selectors.hpp @@ -0,0 +1,38 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_SELECTORS_HPP +#define BOOST_GRAPH_SELECTORS_HPP + +#include + +namespace boost { + + //=========================================================================== + // Selectors for the Directed template parameter of adjacency_list + // and adjacency_matrix. + + struct directedS { enum { is_directed = true, is_bidir = false }; + typedef mpl::true_ is_directed_t; + typedef mpl::false_ is_bidir_t; + }; + struct undirectedS { + enum { is_directed = false, is_bidir = false }; + typedef mpl::false_ is_directed_t; + typedef mpl::false_ is_bidir_t; + }; + struct bidirectionalS { + enum { is_directed = true, is_bidir = true }; + typedef mpl::true_ is_directed_t; + typedef mpl::true_ is_bidir_t; + }; + +} // namespace boost + +#endif // BOOST_GRAPH_SELECTORS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_test.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_test.hpp new file mode 100644 index 0000000000..554ddbad46 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_test.hpp @@ -0,0 +1,382 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_TEST_HPP +#define BOOST_GRAPH_TEST_HPP + +#include +#include +#include +#include +#include +#include +#include // for connects + + +// UNDER CONSTRUCTION + +namespace boost { + + template + struct graph_test + { + + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::vertices_size_type v_size_t; + typedef typename graph_traits::degree_size_type deg_size_t; + typedef typename graph_traits::edges_size_type e_size_t; + typedef typename graph_traits::out_edge_iterator out_edge_iter; + typedef typename property_map::type index_map_t; + typedef iterator_property_map::iterator, + index_map_t,vertex_t,vertex_t&> IsoMap; + + struct ignore_vertex { + ignore_vertex() { } + ignore_vertex(vertex_t v) : v(v) { } + bool operator()(vertex_t x) const { return x != v; } + vertex_t v; + }; + struct ignore_edge { + ignore_edge() { } + ignore_edge(edge_t e) : e(e) { } + bool operator()(edge_t x) const { return x != e; } + edge_t e; + }; + struct ignore_edges { + ignore_edges(vertex_t s, vertex_t t, const Graph& g) + : s(s), t(t), g(g) { } + bool operator()(edge_t x) const { + return !(source(x, g) == s && target(x, g) == t); + } + vertex_t s; vertex_t t; const Graph& g; + }; + + //========================================================================= + // Traversal Operations + + void test_incidence_graph + (const std::vector& vertex_set, + const std::vector< std::pair >& edge_set, + const Graph& g) + { + typedef typename std::vector::const_iterator vertex_iter; + typedef typename std::vector< std::pair > + ::const_iterator edge_iter; + typedef typename graph_traits::out_edge_iterator out_edge_iter; + + for (vertex_iter ui = vertex_set.begin(); ui != vertex_set.end(); ++ui) { + vertex_t u = *ui; + std::vector adj; + for (edge_iter e = edge_set.begin(); e != edge_set.end(); ++e) + if (e->first == u) + adj.push_back(e->second); + + std::pair p = out_edges(u, g); + BOOST_CHECK(out_degree(u, g) == adj.size()); + BOOST_CHECK(deg_size_t(std::distance(p.first, p.second)) + == out_degree(u, g)); + for (; p.first != p.second; ++p.first) { + edge_t e = *p.first; + BOOST_CHECK(source(e, g) == u); + BOOST_CHECK(container_contains(adj, target(e, g)) == true); + } + } + } + + void test_bidirectional_graph + (const std::vector& vertex_set, + const std::vector< std::pair >& edge_set, + const Graph& g) + { + typedef typename std::vector::const_iterator vertex_iter; + typedef typename std::vector< std::pair > + ::const_iterator edge_iter; + typedef typename graph_traits::in_edge_iterator in_edge_iter; + + for (vertex_iter vi = vertex_set.begin(); vi != vertex_set.end(); ++vi) { + vertex_t v = *vi; + std::vector inv_adj; + for (edge_iter e = edge_set.begin(); e != edge_set.end(); ++e) + if (e->second == v) + inv_adj.push_back(e->first); + + std::pair p = in_edges(v, g); + BOOST_CHECK(in_degree(v, g) == inv_adj.size()); + BOOST_CHECK(deg_size_t(std::distance(p.first, p.second)) + == in_degree(v, g)); + for (; p.first != p.second; ++p.first) { + edge_t e = *p.first; + BOOST_CHECK(target(e, g) == v); + BOOST_CHECK(container_contains(inv_adj, source(e, g)) == true); + } + } + } + + void test_adjacency_graph + (const std::vector& vertex_set, + const std::vector< std::pair >& edge_set, + const Graph& g) + { + typedef typename std::vector::const_iterator vertex_iter; + typedef typename std::vector > + ::const_iterator edge_iter; + typedef typename graph_traits::adjacency_iterator adj_iter; + + for (vertex_iter ui = vertex_set.begin(); ui != vertex_set.end(); ++ui) { + vertex_t u = *ui; + std::vector adj; + for (edge_iter e = edge_set.begin(); e != edge_set.end(); ++e) + if (e->first == u) + adj.push_back(e->second); + + std::pair p = adjacent_vertices(u, g); + BOOST_CHECK(deg_size_t(std::distance(p.first, p.second)) == adj.size()); + for (; p.first != p.second; ++p.first) { + vertex_t v = *p.first; + BOOST_CHECK(container_contains(adj, v) == true); + } + } + } + + void test_vertex_list_graph + (const std::vector& vertex_set, const Graph& g) + { + typedef typename graph_traits::vertex_iterator v_iter; + std::pair p = vertices(g); + BOOST_CHECK(num_vertices(g) == vertex_set.size()); + v_size_t n = std::distance(p.first, p.second); + BOOST_CHECK(n == num_vertices(g)); + for (; p.first != p.second; ++p.first) { + vertex_t v = *p.first; + BOOST_CHECK(container_contains(vertex_set, v) == true); + } + } + + void test_edge_list_graph + (const std::vector& vertex_set, + const std::vector< std::pair >& edge_set, + const Graph& g) + { + typedef typename graph_traits::edge_iterator e_iter; + std::pair p = edges(g); + BOOST_CHECK(num_edges(g) == edge_set.size()); + e_size_t m = std::distance(p.first, p.second); + BOOST_CHECK(m == num_edges(g)); + for (; p.first != p.second; ++p.first) { + edge_t e = *p.first; + BOOST_CHECK(any_if(edge_set, connects(source(e, g), target(e, g), g))); + BOOST_CHECK(container_contains(vertex_set, source(e, g)) == true); + BOOST_CHECK(container_contains(vertex_set, target(e, g)) == true); + } + } + + void test_adjacency_matrix + (const std::vector& vertex_set, + const std::vector< std::pair >& edge_set, + const Graph& g) + { + std::pair p; + for (typename std::vector > + ::const_iterator i = edge_set.begin(); + i != edge_set.end(); ++i) { + p = edge(i->first, i->second, g); + BOOST_CHECK(p.second == true); + BOOST_CHECK(source(p.first, g) == i->first); + BOOST_CHECK(target(p.first, g) == i->second); + } + typename std::vector::const_iterator j, k; + for (j = vertex_set.begin(); j != vertex_set.end(); ++j) + for (k = vertex_set.begin(); k != vertex_set.end(); ++k) { + p = edge(*j, *k, g); + if (p.second == true) + BOOST_CHECK(any_if(edge_set, + connects(source(p.first, g), target(p.first, g), g)) == true); + } + } + + //========================================================================= + // Mutating Operations + + void test_add_vertex(Graph& g) + { + Graph cpy; + std::vector iso_vec(num_vertices(g)); + IsoMap iso_map(iso_vec.begin(), get(vertex_index, g)); + copy_graph(g, cpy, orig_to_copy(iso_map)); + + assert((verify_isomorphism(g, cpy, iso_map))); + + vertex_t v = add_vertex(g); + + BOOST_CHECK(num_vertices(g) == num_vertices(cpy) + 1); + + BOOST_CHECK(out_degree(v, g) == 0); + + // Make sure the rest of the graph stayed the same + BOOST_CHECK((verify_isomorphism + (make_filtered_graph(g, keep_all(), ignore_vertex(v)), cpy, + iso_map))); + } + + void test_add_edge(vertex_t u, vertex_t v, Graph& g) + { + Graph cpy; + std::vector iso_vec(num_vertices(g)); + IsoMap iso_map(iso_vec.begin(), get(vertex_index, g)); + copy_graph(g, cpy, orig_to_copy(iso_map)); + + bool parallel_edge_exists = container_contains(adjacent_vertices(u, g), v); + + std::pair p = add_edge(u, v, g); + edge_t e = p.first; + bool added = p.second; + + if (is_undirected(g) && u == v) // self edge + BOOST_CHECK(added == false); + else if (parallel_edge_exists) + BOOST_CHECK(allows_parallel_edges(g) && added == true + || !allows_parallel_edges(g) && added == false); + else + BOOST_CHECK(added == true); + + if (p.second == true) { // edge added + BOOST_CHECK(num_edges(g) == num_edges(cpy) + 1); + + BOOST_CHECK(container_contains(out_edges(u, g), e) == true); + + BOOST_CHECK((verify_isomorphism + (make_filtered_graph(g, ignore_edge(e)), cpy, iso_map))); + } + else { // edge not added + if (! (is_undirected(g) && u == v)) { + // e should be a parallel edge + BOOST_CHECK(source(e, g) == u); + BOOST_CHECK(target(e, g) == v); + } + // The graph should not be changed. + BOOST_CHECK((verify_isomorphism(g, cpy, iso_map))); + } + } // test_add_edge() + + + void test_remove_edge(vertex_t u, vertex_t v, Graph& g) + { + Graph cpy; + std::vector iso_vec(num_vertices(g)); + IsoMap iso_map(iso_vec.begin(), get(vertex_index, g)); + copy_graph(g, cpy, orig_to_copy(iso_map)); + + deg_size_t occurances = count(adjacent_vertices(u, g), v); + + remove_edge(u, v, g); + + BOOST_CHECK(num_edges(g) + occurances == num_edges(cpy)); + BOOST_CHECK((verify_isomorphism + (g, make_filtered_graph(cpy, ignore_edges(u,v,cpy)), + iso_map))); + } + + void test_remove_edge(edge_t e, Graph& g) + { + Graph cpy; + std::vector iso_vec(num_vertices(g)); + IsoMap iso_map(iso_vec.begin(), get(vertex_index, g)); + copy_graph(g, cpy, orig_to_copy(iso_map)); + + vertex_t u = source(e, g), v = target(e, g); + deg_size_t occurances = count(adjacent_vertices(u, g), v); + + remove_edge(e, g); + + BOOST_CHECK(num_edges(g) + 1 == num_edges(cpy)); + BOOST_CHECK(count(adjacent_vertices(u, g), v) + 1 == occurances); + BOOST_CHECK((verify_isomorphism + (g, make_filtered_graph(cpy, ignore_edge(e)), + iso_map))); + } + + void test_clear_vertex(vertex_t v, Graph& g) + { + Graph cpy; + std::vector iso_vec(num_vertices(g)); + IsoMap iso_map(iso_vec.begin(), get(vertex_index, g)); + copy_graph(g, cpy, orig_to_copy(iso_map)); + + clear_vertex(v, g); + + BOOST_CHECK(out_degree(v, g) == 0); + BOOST_CHECK(num_vertices(g) == num_vertices(cpy)); + BOOST_CHECK((verify_isomorphism + (g, make_filtered_graph(cpy, keep_all(), ignore_vertex(v)), + iso_map))); + } + + //========================================================================= + // Property Map + + template + void test_readable_vertex_property_graph + (const std::vector& vertex_prop, PropertyTag, const Graph& g) + { + typedef typename property_map::const_type const_Map; + const_Map pmap = get(PropertyTag(), g); + typename std::vector::const_iterator i = vertex_prop.begin(); + + for (typename boost::graph_traits::vertex_iterator + bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second; + bgl_first_9 != bgl_last_9; bgl_first_9 = bgl_last_9) + for (typename boost::graph_traits::vertex_descriptor v; + bgl_first_9 != bgl_last_9 ? (v = *bgl_first_9, true) : false; + ++bgl_first_9) { + //BGL_FORALL_VERTICES_T(v, g, Graph) { + typename property_traits::value_type + pval1 = get(pmap, v), pval2 = get(PropertyTag(), g, v); + BOOST_CHECK(pval1 == pval2); + BOOST_CHECK(pval1 == *i++); + } + } + + template + void test_vertex_property_graph + (const std::vector& vertex_prop, PropertyTag tag, Graph& g) + { + typedef typename property_map::type PMap; + PMap pmap = get(PropertyTag(), g); + typename std::vector::const_iterator i = vertex_prop.begin(); + for (typename boost::graph_traits::vertex_iterator + bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second; + bgl_first_9 != bgl_last_9; bgl_first_9 = bgl_last_9) + for (typename boost::graph_traits::vertex_descriptor v; + bgl_first_9 != bgl_last_9 ? (v = *bgl_first_9, true) : false; + ++bgl_first_9) + // BGL_FORALL_VERTICES_T(v, g, Graph) + put(pmap, v, *i++); + + test_readable_vertex_property_graph(vertex_prop, tag, g); + + BGL_FORALL_VERTICES_T(v, g, Graph) + put(pmap, v, vertex_prop[0]); + + typename std::vector::const_iterator j = vertex_prop.begin(); + BGL_FORALL_VERTICES_T(v, g, Graph) + put(PropertyTag(), g, v, *j++); + + test_readable_vertex_property_graph(vertex_prop, tag, g); + } + + + }; + + +} // namespace boost + +#include + +#endif // BOOST_GRAPH_TEST_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_traits.hpp new file mode 100644 index 0000000000..1c5a26589b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_traits.hpp @@ -0,0 +1,168 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_TRAITS_HPP +#define BOOST_GRAPH_TRAITS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + struct graph_traits { + typedef typename G::vertex_descriptor vertex_descriptor; + typedef typename G::edge_descriptor edge_descriptor; + typedef typename G::adjacency_iterator adjacency_iterator; + typedef typename G::out_edge_iterator out_edge_iterator; + typedef typename G::in_edge_iterator in_edge_iterator; + typedef typename G::vertex_iterator vertex_iterator; + typedef typename G::edge_iterator edge_iterator; + + typedef typename G::directed_category directed_category; + typedef typename G::edge_parallel_category edge_parallel_category; + typedef typename G::traversal_category traversal_category; + + typedef typename G::vertices_size_type vertices_size_type; + typedef typename G::edges_size_type edges_size_type; + typedef typename G::degree_size_type degree_size_type; + + static inline vertex_descriptor null_vertex(); + }; + + template + inline typename graph_traits::vertex_descriptor + graph_traits::null_vertex() + { + return G::null_vertex(); + } + + // directed_category tags + struct directed_tag { }; + struct undirected_tag { }; + struct bidirectional_tag : public directed_tag { }; + + namespace detail { + inline bool is_directed(directed_tag) { return true; } + inline bool is_directed(undirected_tag) { return false; } + } + + template + bool is_directed(const Graph&) { + typedef typename graph_traits::directed_category Cat; + return detail::is_directed(Cat()); + } + template + bool is_undirected(const Graph& g) { + return ! is_directed(g); + } + + // edge_parallel_category tags + struct allow_parallel_edge_tag {}; + struct disallow_parallel_edge_tag {}; + + namespace detail { + inline bool allows_parallel(allow_parallel_edge_tag) { return true; } + inline bool allows_parallel(disallow_parallel_edge_tag) { return false; } + } + + template + bool allows_parallel_edges(const Graph&) { + typedef typename graph_traits::edge_parallel_category Cat; + return detail::allows_parallel(Cat()); + } + + // traversal_category tags + struct incidence_graph_tag { }; + struct adjacency_graph_tag { }; + struct bidirectional_graph_tag : + public virtual incidence_graph_tag { }; + struct vertex_list_graph_tag { }; + struct edge_list_graph_tag { }; + struct adjacency_matrix_tag { }; + + //?? not the right place ?? Lee + typedef boost::forward_traversal_tag multi_pass_input_iterator_tag; + + template + struct edge_property_type { + typedef typename G::edge_property_type type; + }; + template + struct vertex_property_type { + typedef typename G::vertex_property_type type; + }; + template + struct graph_property_type { + typedef typename G::graph_property_type type; + }; + + struct no_vertex_bundle {}; + struct no_edge_bundle {}; + + template + struct vertex_bundle_type + { + typedef typename G::vertex_bundled type; + }; + + template + struct edge_bundle_type + { + typedef typename G::edge_bundled type; + }; + + namespace graph { namespace detail { + template + class bundled_result + { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename mpl::if_c<(is_same::value), + vertex_bundle_type, + edge_bundle_type >::type bundler; + + public: + typedef typename bundler::type type; + }; + } } // end namespace graph::detail +} // namespace boost + +// Since pair is in namespace std, Koenig lookup will find source and +// target if they are also defined in namespace std. This is illegal, +// but the alternative is to put source and target in the global +// namespace which causes name conflicts with other libraries (like +// SUIF). +namespace std { + + /* Some helper functions for dealing with pairs as edges */ + template + T source(pair p, const G&) { return p.first; } + + template + T target(pair p, const G&) { return p.second; } + +} + +#if defined(__GNUC__) && defined(__SGI_STL_PORT) +// For some reason g++ with STLport does not see the above definition +// of source() and target() unless we bring them into the boost +// namespace. +namespace boost { + using std::source; + using std::target; +} +#endif + +#endif // BOOST_GRAPH_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_utility.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_utility.hpp new file mode 100644 index 0000000000..018442b91b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graph_utility.hpp @@ -0,0 +1,425 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_UTILITY_HPP +#define BOOST_GRAPH_UTILITY_HPP + +#include +#include +#include +#include +#include +#include + +#if !defined BOOST_NO_SLIST +# ifdef BOOST_SLIST_HEADER +# include BOOST_SLIST_HEADER +# else +# include +# endif +#endif + +#include +#include +#include +#include +// iota moved to detail/algorithm.hpp +#include + +namespace boost { + + // Provide an undirected graph interface alternative to the + // the source() and target() edge functions. + template + inline + std::pair::vertex_descriptor, + typename graph_traits::vertex_descriptor> + incident(typename graph_traits::edge_descriptor e, + UndirectedGraph& g) + { + return std::make_pair(source(e,g), target(e,g)); + } + + // Provide an undirected graph interface alternative + // to the out_edges() function. + template + inline + std::pair::out_edge_iterator, + typename graph_traits::out_edge_iterator> + incident_edges(typename graph_traits::vertex_descriptor u, + Graph& g) + { + return out_edges(u, g); + } + + template + inline typename graph_traits::vertex_descriptor + opposite(typename graph_traits::edge_descriptor e, + typename graph_traits::vertex_descriptor v, + const Graph& g) + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + if (v == source(e, g)) + return target(e, g); + else if (v == target(e, g)) + return source(e, g); + else + return vertex_descriptor(); + } + + //=========================================================================== + // Some handy predicates + + template + struct incident_from_predicate { + incident_from_predicate(Vertex u, const Graph& g) + : m_u(u), m_g(g) { } + template + bool operator()(const Edge& e) const { + return source(e, m_g) == m_u; + } + Vertex m_u; + const Graph& m_g; + }; + template + inline incident_from_predicate + incident_from(Vertex u, const Graph& g) { + return incident_from_predicate(u, g); + } + + template + struct incident_to_predicate { + incident_to_predicate(Vertex u, const Graph& g) + : m_u(u), m_g(g) { } + template + bool operator()(const Edge& e) const { + return target(e, m_g) == m_u; + } + Vertex m_u; + const Graph& m_g; + }; + template + inline incident_to_predicate + incident_to(Vertex u, const Graph& g) { + return incident_to_predicate(u, g); + } + + template + struct incident_on_predicate { + incident_on_predicate(Vertex u, const Graph& g) + : m_u(u), m_g(g) { } + template + bool operator()(const Edge& e) const { + return source(e, m_g) == m_u || target(e, m_g) == m_u; + } + Vertex m_u; + const Graph& m_g; + }; + template + inline incident_on_predicate + incident_on(Vertex u, const Graph& g) { + return incident_on_predicate(u, g); + } + + template + struct connects_predicate { + connects_predicate(Vertex u, Vertex v, const Graph& g) + : m_u(u), m_v(v), m_g(g) { } + template + bool operator()(const Edge& e) const { + if (is_directed(m_g)) + return source(e, m_g) == m_u && target(e, m_g) == m_v; + else + return (source(e, m_g) == m_u && target(e, m_g) == m_v) + || (source(e, m_g) == m_v && target(e, m_g) == m_u); + } + Vertex m_u, m_v; + const Graph& m_g; + }; + template + inline connects_predicate + connects(Vertex u, Vertex v, const Graph& g) { + return connects_predicate(u, v, g); + } + + + // Need to convert all of these printing functions to take an ostream object + // -JGS + + template + void print_in_edges(const IncidenceGraph& G, Name name) + { + typename graph_traits::vertex_iterator ui,ui_end; + for (tie(ui,ui_end) = vertices(G); ui != ui_end; ++ui) { + std::cout << get(name,*ui) << " <-- "; + typename graph_traits + ::in_edge_iterator ei, ei_end; + for(tie(ei,ei_end) = in_edges(*ui,G); ei != ei_end; ++ei) + std::cout << get(name,source(*ei,G)) << " "; + std::cout << std::endl; + } + } + + template + void print_graph_dispatch(const IncidenceGraph& G, Name name, directed_tag) + { + typename graph_traits::vertex_iterator ui,ui_end; + for (tie(ui,ui_end) = vertices(G); ui != ui_end; ++ui) { + std::cout << get(name,*ui) << " --> "; + typename graph_traits + ::out_edge_iterator ei, ei_end; + for(tie(ei,ei_end) = out_edges(*ui,G); ei != ei_end; ++ei) + std::cout << get(name,target(*ei,G)) << " "; + std::cout << std::endl; + } + } + template + void print_graph_dispatch(const IncidenceGraph& G, Name name, undirected_tag) + { + typename graph_traits::vertex_iterator ui,ui_end; + for (tie(ui,ui_end) = vertices(G); ui != ui_end; ++ui) { + std::cout << get(name,*ui) << " <--> "; + typename graph_traits + ::out_edge_iterator ei, ei_end; + for(tie(ei,ei_end) = out_edges(*ui,G); ei != ei_end; ++ei) + std::cout << get(name,target(*ei,G)) << " "; + std::cout << std::endl; + } + } + template + void print_graph(const IncidenceGraph& G, Name name) + { + typedef typename graph_traits + ::directed_category Cat; + print_graph_dispatch(G, name, Cat()); + } + template + void print_graph(const IncidenceGraph& G) { + print_graph(G, get(vertex_index, G)); + } + + template + void print_edges(const EdgeListGraph& G, Name name) + { + typename graph_traits::edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(G); ei != ei_end; ++ei) + std::cout << "(" << get(name, source(*ei, G)) + << "," << get(name, target(*ei, G)) << ") "; + std::cout << std::endl; + } + + template + void print_edges2(const EdgeListGraph& G, VertexName vname, EdgeName ename) + { + typename graph_traits::edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(G); ei != ei_end; ++ei) + std::cout << get(ename, *ei) << "(" << get(vname, source(*ei, G)) + << "," << get(vname, target(*ei, G)) << ") "; + std::cout << std::endl; + } + + template + void print_vertices(const VertexListGraph& G, Name name) + { + typename graph_traits::vertex_iterator vi,vi_end; + for (tie(vi,vi_end) = vertices(G); vi != vi_end; ++vi) + std::cout << get(name,*vi) << " "; + std::cout << std::endl; + } + + template + bool is_adj_dispatch(Graph& g, Vertex a, Vertex b, bidirectional_tag) + { + typedef typename graph_traits::edge_descriptor + edge_descriptor; + typename graph_traits::adjacency_iterator vi, viend, + adj_found; + tie(vi, viend) = adjacent_vertices(a, g); + adj_found = std::find(vi, viend, b); + if (adj_found == viend) + return false; + + typename graph_traits::out_edge_iterator oi, oiend, + out_found; + tie(oi, oiend) = out_edges(a, g); + out_found = std::find_if(oi, oiend, incident_to(b, g)); + if (out_found == oiend) + return false; + + typename graph_traits::in_edge_iterator ii, iiend, + in_found; + tie(ii, iiend) = in_edges(b, g); + in_found = std::find_if(ii, iiend, incident_from(a, g)); + if (in_found == iiend) + return false; + + return true; + } + template + bool is_adj_dispatch(Graph& g, Vertex a, Vertex b, directed_tag) + { + typedef typename graph_traits::edge_descriptor + edge_descriptor; + typename graph_traits::adjacency_iterator vi, viend, found; + tie(vi, viend) = adjacent_vertices(a, g); +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 && defined(__SGI_STL_PORT) + // Getting internal compiler error with std::find() + found = viend; + for (; vi != viend; ++vi) + if (*vi == b) { + found = vi; + break; + } +#else + found = std::find(vi, viend, b); +#endif + if ( found == viend ) + return false; + + typename graph_traits::out_edge_iterator oi, oiend, + out_found; + tie(oi, oiend) = out_edges(a, g); + +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 && defined(__SGI_STL_PORT) + // Getting internal compiler error with std::find() + out_found = oiend; + for (; oi != oiend; ++oi) + if (target(*oi, g) == b) { + out_found = oi; + break; + } +#else + out_found = std::find_if(oi, oiend, incident_to(b, g)); +#endif + if (out_found == oiend) + return false; + return true; + } + template + bool is_adj_dispatch(Graph& g, Vertex a, Vertex b, undirected_tag) + { + return is_adj_dispatch(g, a, b, directed_tag()); + } + + template + bool is_adjacent(Graph& g, Vertex a, Vertex b) { + typedef typename graph_traits::directed_category Cat; + return is_adj_dispatch(g, a, b, Cat()); + } + + template + bool in_edge_set(Graph& g, Edge e) + { + typename Graph::edge_iterator ei, ei_end, found; + tie(ei, ei_end) = edges(g); + found = std::find(ei, ei_end, e); + return found != ei_end; + } + + template + bool in_vertex_set(Graph& g, Vertex v) + { + typename Graph::vertex_iterator vi, vi_end, found; + tie(vi, vi_end) = vertices(g); + found = std::find(vi, vi_end, v); + return found != vi_end; + } + + template + bool in_edge_set(Graph& g, Vertex u, Vertex v) + { + typename Graph::edge_iterator ei, ei_end; + for (tie(ei,ei_end) = edges(g); ei != ei_end; ++ei) + if (source(*ei,g) == u && target(*ei,g) == v) + return true; + return false; + } + + // is x a descendant of y? + template + inline bool is_descendant + (typename property_traits::value_type x, + typename property_traits::value_type y, + ParentMap parent) + { + if (get(parent, x) == x) // x is the root of the tree + return false; + else if (get(parent, x) == y) + return true; + else + return is_descendant(get(parent, x), y, parent); + } + + // is y reachable from x? + template + inline bool is_reachable + (typename graph_traits::vertex_descriptor x, + typename graph_traits::vertex_descriptor y, + const IncidenceGraph& g, + VertexColorMap color) // should start out white for every vertex + { + typedef typename property_traits::value_type ColorValue; + dfs_visitor<> vis; + depth_first_visit(g, x, vis, color); + return get(color, y) != color_traits::white(); + } + + // Is the undirected graph connected? + // Is the directed graph strongly connected? + template + inline bool is_connected(const VertexListGraph& g, VertexColorMap color) + { + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typename graph_traits::vertex_iterator + ui, ui_end, vi, vi_end, ci, ci_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + if (*ui != *vi) { + for (tie(ci, ci_end) = vertices(g); ci != ci_end; ++ci) + put(color, *ci, Color::white()); + if (! is_reachable(*ui, *vi, g, color)) + return false; + } + return true; + } + + template + bool is_self_loop + (typename graph_traits::edge_descriptor e, + const Graph& g) + { + return source(e, g) == target(e, g); + } + + + template + std::pair + make_list(const T1& t1, const T2& t2) + { return std::make_pair(t1, t2); } + + template + std::pair > + make_list(const T1& t1, const T2& t2, const T3& t3) + { return std::make_pair(t1, std::make_pair(t2, t3)); } + + template + std::pair > > + make_list(const T1& t1, const T2& t2, const T3& t3, const T4& t4) + { return std::make_pair(t1, std::make_pair(t2, std::make_pair(t3, t4))); } + + template + std::pair > > > + make_list(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) + { return std::make_pair(t1, std::make_pair(t2, std::make_pair(t3, std::make_pair(t4, t5)))); } + +} /* namespace boost */ + +#endif /* BOOST_GRAPH_UTILITY_HPP*/ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graphml.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graphml.hpp new file mode 100644 index 0000000000..be7a804e3f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graphml.hpp @@ -0,0 +1,332 @@ +// Copyright (C) 2006 Tiago de Paula Peixoto +// Copyright (C) 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 +// Tiago de Paula Peixoto + +#ifndef BOOST_GRAPH_GRAPHML_HPP +#define BOOST_GRAPH_GRAPHML_HPP + +#include +#include +#include +#include +#include // for exceptions +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + +///////////////////////////////////////////////////////////////////////////// +// Graph reader exceptions +///////////////////////////////////////////////////////////////////////////// +struct parse_error: public graph_exception +{ + parse_error(const std::string& error) {statement = "parse error: " + error;} + virtual ~parse_error() throw() {} + virtual const char* what() const throw() {return statement.c_str();} + std::string statement; +}; + + +class mutate_graph +{ +public: + virtual ~mutate_graph() {} + virtual bool is_directed() const = 0; + + virtual boost::any do_add_vertex() = 0; + virtual std::pair do_add_edge(boost::any source, boost::any target) = 0; + + virtual void + set_graph_property(const std::string& name, const std::string& value, const std::string& value_type) = 0; + + virtual void + set_vertex_property(const std::string& name, boost::any vertex, const std::string& value, const std::string& value_type) = 0; + + virtual void + set_edge_property(const std::string& name, boost::any edge, const std::string& value, const std::string& value_type) = 0; +}; + +template +class mutate_graph_impl : public mutate_graph +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + public: + mutate_graph_impl(MutableGraph& g, dynamic_properties& dp) + : m_g(g), m_dp(dp) { } + + bool is_directed() const + { + return is_convertible::directed_category, + directed_tag>::value; + } + + virtual any do_add_vertex() + { + return any(add_vertex(m_g)); + } + + virtual std::pair do_add_edge(any source, any target) + { + std::pair retval = add_edge(any_cast(source), + any_cast(target), m_g); + return std::make_pair(any(retval.first), retval.second); + } + + virtual void + set_graph_property(const std::string& name, const std::string& value, const std::string& value_type) + { + bool type_found = false; + try + { + mpl::for_each(put_property + (name, m_dp, m_g, value, value_type, m_type_names, type_found)); + } + catch (bad_lexical_cast) + { + throw parse_error("invalid value \"" + value + "\" for key " + + name + " of type " + value_type); + } + if (!type_found) + throw parse_error("unrecognized type \"" + value_type + + "\" for key " + name); + + } + + virtual void + set_vertex_property(const std::string& name, any vertex, const std::string& value, const std::string& value_type) + { + bool type_found = false; + try + { + mpl::for_each(put_property + (name, m_dp, any_cast(vertex), + value, value_type, m_type_names, type_found)); + } + catch (bad_lexical_cast) + { + throw parse_error("invalid value \"" + value + "\" for key " + + name + " of type " + value_type); + } + if (!type_found) + throw parse_error("unrecognized type \"" + value_type + + "\" for key " + name); + + } + + virtual void + set_edge_property(const std::string& name, any edge, const std::string& value, const std::string& value_type) + { + bool type_found = false; + try + { + mpl::for_each(put_property + (name, m_dp, any_cast(edge), + value, value_type, m_type_names, type_found)); + } + catch (bad_lexical_cast) + { + throw parse_error("invalid value \"" + value + "\" for key " + + name + " of type " + value_type); + } + if (!type_found) + throw parse_error("unrecognized type \"" + value_type + + "\" for key " + name); + } + + template + class put_property + { + public: + put_property(const std::string& name, dynamic_properties& dp, const Key& key, + const std::string& value, const std::string& value_type, + char** type_names, bool& type_found) + : m_name(name), m_dp(dp), m_key(key), m_value(value), + m_value_type(value_type), m_type_names(type_names), + m_type_found(type_found) {} + template + void operator()(Value) + { + if (m_value_type == m_type_names[mpl::find::type::pos::value]) + { + put(m_name, m_dp, m_key, lexical_cast(m_value)); + m_type_found = true; + } + } + private: + const std::string& m_name; + dynamic_properties& m_dp; + const Key& m_key; + const std::string& m_value; + const std::string& m_value_type; + char** m_type_names; + bool& m_type_found; + }; + +protected: + MutableGraph& m_g; + dynamic_properties& m_dp; + typedef mpl::vector value_types; + static char* m_type_names[]; +}; + +template +char* mutate_graph_impl::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"}; + +void +read_graphml(std::istream& in, mutate_graph& g); + +template +void +read_graphml(std::istream& in, MutableGraph& g, dynamic_properties& dp) +{ + mutate_graph_impl mg(g,dp); + read_graphml(in, mg); +} + +template +class get_type_name +{ +public: + get_type_name(const std::type_info& type, char** type_names, std::string& type_name) + : m_type(type), m_type_names(type_names), m_type_name(type_name) {} + template + void operator()(Type) + { + if (typeid(Type) == m_type) + m_type_name = m_type_names[mpl::find::type::pos::value]; + } +private: + const std::type_info &m_type; + char** m_type_names; + std::string &m_type_name; +}; + + +template +void +write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, + const dynamic_properties& dp, bool ordered_vertices=false) +{ + typedef typename graph_traits::directed_category directed_category; + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + BOOST_STATIC_CONSTANT(bool, + graph_is_directed = + (is_convertible::value)); + + out << "\n" + << "\n"; + + typedef mpl::vector value_types; + char* type_names[] = {"boolean", "int", "int", "int", "int", "long", "long", "long", "long", "float", "double", "double", "string"}; + std::map graph_key_ids; + std::map vertex_key_ids; + std::map edge_key_ids; + int key_count = 0; + + // Output keys + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + std::string key_id = "key" + lexical_cast(key_count++); + if (i->second->key() == typeid(Graph)) + vertex_key_ids[i->first] = key_id; + else if (i->second->key() == typeid(vertex_descriptor)) + vertex_key_ids[i->first] = key_id; + else if (i->second->key() == typeid(edge_descriptor)) + edge_key_ids[i->first] = key_id; + else + continue; + std::string type_name = "string"; + mpl::for_each(get_type_name(i->second->value(), type_names, type_name)); + out << " second->key() == typeid(Graph) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\"" + << " attr.name=\"" << i->first << "\"" + << " attr.type=\"" << type_name << "\"" + << " />\n"; + } + + out << " \n"; + + // Output graph data + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + if (i->second->key() == typeid(Graph)) + { + out << " first] << "\">" + << i->second->get_string(g) << "\n"; + } + } + + typedef typename graph_traits::vertex_iterator vertex_iterator; + vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) + { + out << " \n"; + // Output data + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + if (i->second->key() == typeid(vertex_descriptor)) + { + out << " first] << "\">" + << i->second->get_string(*v) << "\n"; + } + } + out << " \n"; + } + + typedef typename graph_traits::edge_iterator edge_iterator; + edge_iterator e, e_end; + typename graph_traits::edges_size_type edge_count = 0; + for (tie(e, e_end) = edges(g); e != e_end; ++e) + { + out << " \n"; + + // Output data + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + if (i->second->key() == typeid(edge_descriptor)) + { + out << " first] << "\">" + << i->second->get_string(*e) << "\n"; + } + } + out << " \n"; + } + + out << " \n" + << "\n"; +} + + +template +void +write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp, + bool ordered_vertices=false) +{ + write_graphml(out, g, get(vertex_index, g), dp, ordered_vertices); +} + +} // boost namespace + +#endif // BOOST_GRAPH_GRAPHML_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/graphviz.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/graphviz.hpp new file mode 100644 index 0000000000..b010dd8450 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/graphviz.hpp @@ -0,0 +1,783 @@ +//======================================================================= +// Copyright 2001 University of Notre Dame. +// Copyright 2003 Jeremy Siek +// Authors: Lie-Quan Lee and Jeremy Siek +// +// 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_GRAPHVIZ_HPP +#define BOOST_GRAPHVIZ_HPP + +#include +#include +#include +#include +#include +#include // for FILE +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_HAS_DECLSPEC +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_GRAPH_DYN_LINK) +# ifdef BOOST_GRAPH_SOURCE +# define BOOST_GRAPH_DECL __declspec(dllexport) +# else +# define BOOST_GRAPH_DECL __declspec(dllimport) +# endif // BOOST_GRAPH_SOURCE +# endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC + +#ifndef BOOST_GRAPH_DECL +# define BOOST_GRAPH_DECL +#endif + +namespace boost { + + template + struct graphviz_io_traits { + static std::string name() { + return "digraph"; + } + static std::string delimiter() { + return "->"; + } }; + + template <> + struct graphviz_io_traits { + static std::string name() { + return "graph"; + } + static std::string delimiter() { + return "--"; + } + }; + + struct default_writer { + void operator()(std::ostream&) const { + } + template + void operator()(std::ostream&, const VorE&) const { + } + }; + + template + class label_writer { + public: + label_writer(Name _name) : name(_name) {} + template + void operator()(std::ostream& out, const VertexOrEdge& v) const { + out << "[label=\"" << get(name, v) << "\"]"; + } + private: + Name name; + }; + template + inline label_writer + make_label_writer(Name n) { + return label_writer(n); + } + + enum edge_attribute_t { edge_attribute = 1111 }; + enum vertex_attribute_t { vertex_attribute = 2222 }; + enum graph_graph_attribute_t { graph_graph_attribute = 3333 }; + enum graph_vertex_attribute_t { graph_vertex_attribute = 4444 }; + enum graph_edge_attribute_t { graph_edge_attribute = 5555 }; + + BOOST_INSTALL_PROPERTY(edge, attribute); + BOOST_INSTALL_PROPERTY(vertex, attribute); + BOOST_INSTALL_PROPERTY(graph, graph_attribute); + BOOST_INSTALL_PROPERTY(graph, vertex_attribute); + BOOST_INSTALL_PROPERTY(graph, edge_attribute); + + + template + inline void write_attributes(const Attribute& attr, std::ostream& out) { + typename Attribute::const_iterator i, iend; + i = attr.begin(); + iend = attr.end(); + + while ( i != iend ) { + out << i->first << "=\"" << i->second << "\""; + ++i; + if ( i != iend ) + out << ", "; + } + } + + template + inline void write_all_attributes(Attributes attributes, + const std::string& name, + std::ostream& out) + { + typename Attributes::const_iterator i = attributes.begin(), + end = attributes.end(); + if (i != end) { + out << name << " [\n"; + write_attributes(attributes, out); + out << "];\n"; + } + } + + inline void write_all_attributes(detail::error_property_not_found, + const std::string&, + std::ostream&) + { + // Do nothing - no attributes exist + } + + + + + template + struct graph_attributes_writer + { + graph_attributes_writer(GraphGraphAttributes gg, + GraphNodeAttributes gn, + GraphEdgeAttributes ge) + : g_attributes(gg), n_attributes(gn), e_attributes(ge) { } + + void operator()(std::ostream& out) const { + write_all_attributes(g_attributes, "graph", out); + write_all_attributes(n_attributes, "node", out); + write_all_attributes(e_attributes, "edge", out); + } + GraphGraphAttributes g_attributes; + GraphNodeAttributes n_attributes; + GraphEdgeAttributes e_attributes; + }; + + template + graph_attributes_writer + make_graph_attributes_writer(const GAttrMap& g_attr, const NAttrMap& n_attr, + const EAttrMap& e_attr) { + return graph_attributes_writer + (g_attr, n_attr, e_attr); + } + + + template + graph_attributes_writer + ::type, + typename graph_property::type, + typename graph_property::type> + make_graph_attributes_writer(const Graph& g) + { + typedef typename graph_property::type + GAttrMap; + typedef typename graph_property::type + NAttrMap; + typedef typename graph_property::type + EAttrMap; + GAttrMap gam = get_property(g, graph_graph_attribute); + NAttrMap nam = get_property(g, graph_vertex_attribute); + EAttrMap eam = get_property(g, graph_edge_attribute); + graph_attributes_writer writer(gam, nam, eam); + return writer; + } + + template + struct attributes_writer { + attributes_writer(AttributeMap attr) + : attributes(attr) { } + + template + void operator()(std::ostream& out, const VorE& e) const { + this->write_attribute(out, attributes[e]); + } + + private: + template + void write_attribute(std::ostream& out, + const AttributeSequence& seq) const + { + if (!seq.empty()) { + out << "["; + write_attributes(seq, out); + out << "]"; + } + } + + void write_attribute(std::ostream&, + detail::error_property_not_found) const + { + } + AttributeMap attributes; + }; + + template + attributes_writer + ::const_type> + make_edge_attributes_writer(const Graph& g) + { + typedef typename property_map::const_type + EdgeAttributeMap; + return attributes_writer(get(edge_attribute, g)); + } + + template + attributes_writer + ::const_type> + make_vertex_attributes_writer(const Graph& g) + { + typedef typename property_map::const_type + VertexAttributeMap; + return attributes_writer(get(vertex_attribute, g)); + } + + template + inline void write_graphviz(std::ostream& out, const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw, + VertexID vertex_id) + { + typedef typename graph_traits::directed_category cat_type; + typedef graphviz_io_traits Traits; + std::string name = "G"; + out << Traits::name() << " " << name << " {" << std::endl; + + gpw(out); //print graph properties + + typename graph_traits::vertex_iterator i, end; + + for(tie(i,end) = vertices(g); i != end; ++i) { + out << get(vertex_id, *i); + vpw(out, *i); //print vertex attributes + out << ";" << std::endl; + } + typename graph_traits::edge_iterator ei, edge_end; + for(tie(ei, edge_end) = edges(g); ei != edge_end; ++ei) { + out << get(vertex_id, source(*ei, g)) << Traits::delimiter() << get(vertex_id, target(*ei, g)) << " "; + epw(out, *ei); //print edge attributes + out << ";" << std::endl; + } + out << "}" << std::endl; + } + + template + inline void write_graphviz(std::ostream& out, const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw) + { write_graphviz(out, g, vpw, epw, gpw, get(vertex_index, g)); } + +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 + // ambiguous overload problem with VC++ + template + inline void + write_graphviz(std::ostream& out, const Graph& g) { + default_writer dw; + default_writer gw; + write_graphviz(out, g, dw, dw, gw); + } +#endif + + template + inline void + write_graphviz(std::ostream& out, const Graph& g, VertexWriter vw) { + default_writer dw; + default_writer gw; + write_graphviz(out, g, vw, dw, gw); + } + + template + inline void + write_graphviz(std::ostream& out, const Graph& g, + VertexWriter vw, EdgeWriter ew) { + default_writer gw; + write_graphviz(out, g, vw, ew, gw); + } + + namespace detail { + + template + void write_graphviz_subgraph (std::ostream& out, + const subgraph& g, + RandomAccessIterator vertex_marker, + RandomAccessIterator edge_marker, + VertexID vertex_id) + { + typedef subgraph Graph; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::directed_category cat_type; + typedef graphviz_io_traits Traits; + + typedef typename graph_property::type NameType; + const NameType& g_name = get_property(g, graph_name); + + if ( g.is_root() ) + out << Traits::name() ; + else + out << "subgraph"; + + out << " " << g_name << " {" << std::endl; + + typename Graph::const_children_iterator i_child, j_child; + + //print graph/node/edge attributes +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + typedef typename graph_property::type + GAttrMap; + typedef typename graph_property::type + NAttrMap; + typedef typename graph_property::type + EAttrMap; + GAttrMap gam = get_property(g, graph_graph_attribute); + NAttrMap nam = get_property(g, graph_vertex_attribute); + EAttrMap eam = get_property(g, graph_edge_attribute); + graph_attributes_writer writer(gam, nam, eam); + writer(out); +#else + make_graph_attributes_writer(g)(out); +#endif + + //print subgraph + for ( tie(i_child,j_child) = g.children(); + i_child != j_child; ++i_child ) + write_graphviz_subgraph(out, *i_child, vertex_marker, edge_marker, + vertex_id); + + // Print out vertices and edges not in the subgraphs. + + typename graph_traits::vertex_iterator i, end; + typename graph_traits::edge_iterator ei, edge_end; + + for(tie(i,end) = vertices(g); i != end; ++i) { + Vertex v = g.local_to_global(*i); + int pos = get(vertex_id, v); + if ( vertex_marker[pos] ) { + vertex_marker[pos] = false; + out << pos; +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + typedef typename property_map::const_type + VertexAttributeMap; + attributes_writer vawriter(get(vertex_attribute, + g.root())); + vawriter(out, v); +#else + make_vertex_attributes_writer(g.root())(out, v); +#endif + out << ";" << std::endl; + } + } + + for (tie(ei, edge_end) = edges(g); ei != edge_end; ++ei) { + Vertex u = g.local_to_global(source(*ei,g)), + v = g.local_to_global(target(*ei, g)); + int pos = get(get(edge_index, g.root()), g.local_to_global(*ei)); + if ( edge_marker[pos] ) { + edge_marker[pos] = false; + out << get(vertex_id, u) << " " << Traits::delimiter() + << " " << get(vertex_id, v); +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + typedef typename property_map::const_type + EdgeAttributeMap; + attributes_writer eawriter(get(edge_attribute, g)); + eawriter(out, *ei); +#else + make_edge_attributes_writer(g)(out, *ei); //print edge properties +#endif + out << ";" << std::endl; + } + } + out << "}" << std::endl; + } + } // namespace detail + + // requires graph_name graph property + template + void write_graphviz(std::ostream& out, const subgraph& g) { + std::vector edge_marker(num_edges(g), true); + std::vector vertex_marker(num_vertices(g), true); + + detail::write_graphviz_subgraph(out, g, + vertex_marker.begin(), + edge_marker.begin(), + get(vertex_index, g)); + } + + template + void write_graphviz(const std::string& filename, const subgraph& g) { + std::ofstream out(filename.c_str()); + std::vector edge_marker(num_edges(g), true); + std::vector vertex_marker(num_vertices(g), true); + + detail::write_graphviz_subgraph(out, g, + vertex_marker.begin(), + edge_marker.begin(), + get(vertex_index, g)); + } + + template + void write_graphviz(std::ostream& out, const subgraph& g, + VertexID vertex_id) + { + std::vector edge_marker(num_edges(g), true); + std::vector vertex_marker(num_vertices(g), true); + + detail::write_graphviz_subgraph(out, g, + vertex_marker.begin(), + edge_marker.begin(), + vertex_id); + } + + template + void write_graphviz(const std::string& filename, const subgraph& g, + VertexID vertex_id) + { + std::ofstream out(filename.c_str()); + std::vector edge_marker(num_edges(g), true); + std::vector vertex_marker(num_vertices(g), true); + + detail::write_graphviz_subgraph(out, g, + vertex_marker.begin(), + edge_marker.begin(), + vertex_id); + } + + typedef std::map GraphvizAttrList; + + typedef property + GraphvizVertexProperty; + + typedef property > + GraphvizEdgeProperty; + + typedef property > > > + GraphvizGraphProperty; + + typedef subgraph > + GraphvizDigraph; + + typedef subgraph > + GraphvizGraph; + + + // These four require linking the BGL-Graphviz library: libbgl-viz.a + // from the /src directory. + extern void read_graphviz(const std::string& file, GraphvizDigraph& g); + extern void read_graphviz(FILE* file, GraphvizDigraph& g); + + extern void read_graphviz(const std::string& file, GraphvizGraph& g); + extern void read_graphviz(FILE* file, GraphvizGraph& g); + + class dynamic_properties_writer + { + public: + dynamic_properties_writer(const dynamic_properties& dp) : dp(&dp) { } + + template + void operator()(std::ostream& out, Descriptor key) const + { + bool first = true; + for (dynamic_properties::const_iterator i = dp->begin(); + i != dp->end(); ++i) { + if (typeid(key) == i->second->key()) { + if (first) out << " ["; + else out << ", "; + first = false; + + out << i->first << "=\"" << i->second->get_string(key) << "\""; + } + } + + if (!first) out << "]"; + } + + private: + const dynamic_properties* dp; + }; + + class dynamic_vertex_properties_writer + { + public: + dynamic_vertex_properties_writer(const dynamic_properties& dp, + const std::string& node_id) + : dp(&dp), node_id(&node_id) { } + + template + void operator()(std::ostream& out, Descriptor key) const + { + bool first = true; + for (dynamic_properties::const_iterator i = dp->begin(); + i != dp->end(); ++i) { + if (typeid(key) == i->second->key() + && i->first != *node_id) { + if (first) out << " ["; + else out << ", "; + first = false; + + out << i->first << "=\"" << i->second->get_string(key) << "\""; + } + } + + if (!first) out << "]"; + } + + private: + const dynamic_properties* dp; + const std::string* node_id; + }; + + namespace graph { namespace detail { + + template + struct node_id_property_map + { + typedef std::string value_type; + typedef value_type reference; + typedef Vertex key_type; + typedef readable_property_map_tag category; + + node_id_property_map() {} + + node_id_property_map(const dynamic_properties& dp, + const std::string& node_id) + : dp(&dp), node_id(&node_id) { } + + const dynamic_properties* dp; + const std::string* node_id; + }; + + template + inline std::string + get(node_id_property_map pm, + typename node_id_property_map::key_type v) + { return get(*pm.node_id, *pm.dp, v); } + + } } // end namespace graph::detail + + template + inline void + write_graphviz(std::ostream& out, const Graph& g, + const dynamic_properties& dp, + const std::string& node_id = "node_id") + { + typedef typename graph_traits::vertex_descriptor Vertex; + write_graphviz(out, g, dp, node_id, + graph::detail::node_id_property_map(dp, node_id)); + } + + template + void + write_graphviz(std::ostream& out, const Graph& g, + const dynamic_properties& dp, const std::string& node_id, + VertexID id) + { + write_graphviz + (out, g, + /*vertex_writer=*/dynamic_vertex_properties_writer(dp, node_id), + /*edge_writer=*/dynamic_properties_writer(dp), + /*graph_writer=*/default_writer(), + id); + } + +///////////////////////////////////////////////////////////////////////////// +// Graph reader exceptions +///////////////////////////////////////////////////////////////////////////// +struct graph_exception : public std::exception { + virtual ~graph_exception() throw() {} + virtual const char* what() const throw() = 0; +}; + +struct bad_parallel_edge : public graph_exception { + std::string from; + std::string to; + mutable std::string statement; + bad_parallel_edge(const std::string& i, const std::string& j) : + from(i), to(j) {} + + virtual ~bad_parallel_edge() throw() {} + const char* what() const throw() { + if(statement.empty()) + statement = + std::string("Failed to add parallel edge: (") + + from + "," + to + ")\n"; + + return statement.c_str(); + } +}; + +struct directed_graph_error : public graph_exception { + virtual ~directed_graph_error() throw() {} + virtual const char* what() const throw() { + return + "read_graphviz: " + "Tried to read a directed graph into an undirected graph."; + } +}; + +struct undirected_graph_error : public graph_exception { + virtual ~undirected_graph_error() throw() {} + virtual const char* what() const throw() { + return + "read_graphviz: " + "Tried to read an undirected graph into a directed graph."; + } +}; + +namespace detail { namespace graph { + +typedef std::string id_t; +typedef id_t node_t; + +// edges are not uniquely determined by adjacent nodes +class edge_t { + int idx_; + explicit edge_t(int i) : idx_(i) {} +public: + static edge_t new_edge() { + static int idx = 0; + return edge_t(idx++); + }; + + bool operator==(const edge_t& rhs) const { + return idx_ == rhs.idx_; + } + bool operator<(const edge_t& rhs) const { + return idx_ < rhs.idx_; + } +}; + +class mutate_graph +{ + public: + virtual ~mutate_graph() {} + virtual bool is_directed() const = 0; + virtual void do_add_vertex(const node_t& node) = 0; + + virtual void + do_add_edge(const edge_t& edge, const node_t& source, const node_t& target) + = 0; + + virtual void + set_node_property(const id_t& key, const node_t& node, const id_t& value) = 0; + + virtual void + set_edge_property(const id_t& key, const edge_t& edge, const id_t& value) = 0; + + virtual void // RG: need new second parameter to support BGL subgraphs + set_graph_property(const id_t& key, const id_t& value) = 0; +}; + +template +class mutate_graph_impl : public mutate_graph +{ + typedef typename graph_traits::vertex_descriptor bgl_vertex_t; + typedef typename graph_traits::edge_descriptor bgl_edge_t; + + public: + mutate_graph_impl(MutableGraph& graph, dynamic_properties& dp, + std::string node_id_prop) + : graph_(graph), dp_(dp), node_id_prop_(node_id_prop) { } + + ~mutate_graph_impl() {} + + bool is_directed() const + { + return + boost::is_convertible< + typename boost::graph_traits::directed_category, + boost::directed_tag>::value; + } + + virtual void do_add_vertex(const node_t& node) + { + // Add the node to the graph. + bgl_vertex_t v = add_vertex(graph_); + + // Set up a mapping from name to BGL vertex. + bgl_nodes.insert(std::make_pair(node, v)); + + // node_id_prop_ allows the caller to see the real id names for nodes. + put(node_id_prop_, dp_, v, node); + } + + void + do_add_edge(const edge_t& edge, const node_t& source, const node_t& target) + { + std::pair result = + add_edge(bgl_nodes[source], bgl_nodes[target], graph_); + + if(!result.second) { + // In the case of no parallel edges allowed + throw bad_parallel_edge(source, target); + } else { + bgl_edges.insert(std::make_pair(edge, result.first)); + } + } + + void + set_node_property(const id_t& key, const node_t& node, const id_t& value) + { + put(key, dp_, bgl_nodes[node], value); + } + + void + set_edge_property(const id_t& key, const edge_t& edge, const id_t& value) + { + put(key, dp_, bgl_edges[edge], value); + } + + void + set_graph_property(const id_t& key, const id_t& value) + { + /* RG: pointer to graph prevents copying */ + put(key, dp_, &graph_, value); + } + + + protected: + MutableGraph& graph_; + dynamic_properties& dp_; + std::string node_id_prop_; + std::map bgl_nodes; + std::map bgl_edges; +}; + +BOOST_GRAPH_DECL +bool read_graphviz(std::istream& in, mutate_graph& graph); + +} } // end namespace detail::graph + +// Parse the passed stream as a GraphViz dot file. +template +bool read_graphviz(std::istream& in, MutableGraph& graph, + dynamic_properties& dp, + std::string const& node_id = "node_id") +{ + detail::graph::mutate_graph_impl m_graph(graph, dp, node_id); + return detail::graph::read_graphviz(in, m_graph); +} + +} // namespace boost + +#ifdef BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +# include +#endif // BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS + +#endif // BOOST_GRAPHVIZ_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/gursoy_atun_layout.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/gursoy_atun_layout.hpp new file mode 100644 index 0000000000..7cc1f9738d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/gursoy_atun_layout.hpp @@ -0,0 +1,631 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_GURSOY_ATUN_LAYOUT_HPP +#define BOOST_GRAPH_GURSOY_ATUN_LAYOUT_HPP + +// Gursoy-Atun graph layout, based on: +// "Neighbourhood Preserving Load Balancing: A Self-Organizing Approach" +// in EuroPar 2000, p. 234 of LNCS 1900 +// http://springerlink.metapress.com/link.asp?id=pcu07ew5rhexp9yt + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +namespace detail { + +struct over_distance_limit : public std::exception {}; + +template +struct update_position_visitor { + typedef typename Topology::point_type Point; + PositionMap position_map; + NodeDistanceMap node_distance; + const Topology& space; + Point input_vector; + double distance_limit; + double learning_constant; + double falloff_ratio; + + typedef boost::on_examine_vertex event_filter; + + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + + update_position_visitor(PositionMap position_map, + NodeDistanceMap node_distance, + const Topology& space, + const Point& input_vector, + double distance_limit, + double learning_constant, + double falloff_ratio): + position_map(position_map), node_distance(node_distance), + space(space), + input_vector(input_vector), distance_limit(distance_limit), + learning_constant(learning_constant), falloff_ratio(falloff_ratio) {} + + void operator()(vertex_descriptor v, const Graph&) const + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::pow; +#endif + + if (get(node_distance, v) > distance_limit) + throw over_distance_limit(); + Point old_position = get(position_map, v); + double distance = get(node_distance, v); + double fraction = + learning_constant * pow(falloff_ratio, distance * distance); + put(position_map, v, + space.move_position_toward(old_position, fraction, input_vector)); + } +}; + +template +struct gursoy_shortest +{ + template + static inline void + run(const Graph& g, typename graph_traits::vertex_descriptor s, + NodeDistanceMap node_distance, UpdatePosition& update_position, + EdgeWeightMap weight) + { + boost::dijkstra_shortest_paths(g, s, weight_map(weight). + visitor(boost::make_dijkstra_visitor(std::make_pair( + boost::record_distances(node_distance, boost::on_edge_relaxed()), + update_position)))); + } +}; + +template<> +struct gursoy_shortest +{ + template + static inline void + run(const Graph& g, typename graph_traits::vertex_descriptor s, + NodeDistanceMap node_distance, UpdatePosition& update_position, + dummy_property_map) + { + boost::breadth_first_search(g, s, + visitor(boost::make_bfs_visitor(std::make_pair( + boost::record_distances(node_distance, boost::on_tree_edge()), + update_position)))); + } +}; + +} // namespace detail + +template +void +gursoy_atun_step + (const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position, + Diameter diameter, + double learning_constant, + VertexIndexMap vertex_index_map, + EdgeWeightMap weight) +{ +#ifndef BOOST_NO_STDC_NAMESPACE + using std::pow; + using std::exp; +#endif + + typedef typename graph_traits::vertex_iterator + vertex_iterator; + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef typename Topology::point_type point_type; + vertex_iterator i, iend; + std::vector distance_from_input_vector(num_vertices(graph)); + typedef boost::iterator_property_map::iterator, + VertexIndexMap, + double, double&> + DistanceFromInputMap; + DistanceFromInputMap distance_from_input(distance_from_input_vector.begin(), + vertex_index_map); + std::vector node_distance_map_vector(num_vertices(graph)); + typedef boost::iterator_property_map::iterator, + VertexIndexMap, + double, double&> + NodeDistanceMap; + NodeDistanceMap node_distance(node_distance_map_vector.begin(), + vertex_index_map); + point_type input_vector = space.random_point(); + vertex_descriptor min_distance_loc + = graph_traits::null_vertex(); + double min_distance = 0.0; + bool min_distance_unset = true; + for (boost::tie(i, iend) = vertices(graph); i != iend; ++i) { + double this_distance = space.distance(get(position, *i), input_vector); + put(distance_from_input, *i, this_distance); + if (min_distance_unset || this_distance < min_distance) { + min_distance = this_distance; + min_distance_loc = *i; + } + min_distance_unset = false; + } + assert (!min_distance_unset); // Graph must have at least one vertex + boost::detail::update_position_visitor< + PositionMap, NodeDistanceMap, Topology, + VertexListAndIncidenceGraph> + update_position(position, node_distance, space, + input_vector, diameter, learning_constant, + exp(-1. / (2 * diameter * diameter))); + std::fill(node_distance_map_vector.begin(), node_distance_map_vector.end(), 0); + try { + typedef detail::gursoy_shortest shortest; + shortest::run(graph, min_distance_loc, node_distance, update_position, + weight); + } catch (detail::over_distance_limit) { + /* Thrown to break out of BFS or Dijkstra early */ + } +} + +template +void gursoy_atun_refine(const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position, + int nsteps, + double diameter_initial, + double diameter_final, + double learning_constant_initial, + double learning_constant_final, + VertexIndexMap vertex_index_map, + EdgeWeightMap weight) +{ +#ifndef BOOST_NO_STDC_NAMESPACE + using std::pow; + using std::exp; +#endif + + typedef typename graph_traits::vertex_iterator + vertex_iterator; + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef typename Topology::point_type point_type; + vertex_iterator i, iend; + double diameter_ratio = (double)diameter_final / diameter_initial; + double learning_constant_ratio = + learning_constant_final / learning_constant_initial; + std::vector distance_from_input_vector(num_vertices(graph)); + typedef boost::iterator_property_map::iterator, + VertexIndexMap, + double, double&> + DistanceFromInputMap; + DistanceFromInputMap distance_from_input(distance_from_input_vector.begin(), + vertex_index_map); + std::vector node_distance_map_vector(num_vertices(graph)); + typedef boost::iterator_property_map::iterator, + VertexIndexMap, double, double&> + NodeDistanceMap; + NodeDistanceMap node_distance(node_distance_map_vector.begin(), + vertex_index_map); + for (int round = 0; round < nsteps; ++round) { + double part_done = (double)round / (nsteps - 1); + int diameter = (int)(diameter_initial * pow(diameter_ratio, part_done)); + double learning_constant = + learning_constant_initial * pow(learning_constant_ratio, part_done); + gursoy_atun_step(graph, space, position, diameter, learning_constant, + vertex_index_map, weight); + } +} + +template +void gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position, + int nsteps, + double diameter_initial, + double diameter_final, + double learning_constant_initial, + double learning_constant_final, + VertexIndexMap vertex_index_map, + EdgeWeightMap weight) +{ + typedef typename graph_traits::vertex_iterator + vertex_iterator; + vertex_iterator i, iend; + for (boost::tie(i, iend) = vertices(graph); i != iend; ++i) { + put(position, *i, space.random_point()); + } + gursoy_atun_refine(graph, space, + position, nsteps, + diameter_initial, diameter_final, + learning_constant_initial, learning_constant_final, + vertex_index_map, weight); +} + +template +void gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position, + int nsteps, + double diameter_initial, + double diameter_final, + double learning_constant_initial, + double learning_constant_final, + VertexIndexMap vertex_index_map) +{ + gursoy_atun_layout(graph, space, position, nsteps, + diameter_initial, diameter_final, + learning_constant_initial, learning_constant_final, + vertex_index_map, dummy_property_map()); +} + +template +void gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position, + int nsteps, + double diameter_initial, + double diameter_final = 1.0, + double learning_constant_initial = 0.8, + double learning_constant_final = 0.2) +{ + gursoy_atun_layout(graph, space, position, nsteps, diameter_initial, + diameter_final, learning_constant_initial, + learning_constant_final, get(vertex_index, graph)); +} + +template +void gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position, + int nsteps) +{ +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif + + gursoy_atun_layout(graph, space, position, nsteps, + sqrt((double)num_vertices(graph))); +} + +template +void gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position) +{ + gursoy_atun_layout(graph, space, position, num_vertices(graph)); +} + +template +void +gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, + const Topology& space, + PositionMap position, + const bgl_named_params& params) +{ +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif + + std::pair diam(sqrt(double(num_vertices(graph))), 1.0); + std::pair learn(0.8, 0.2); + gursoy_atun_layout(graph, space, position, + choose_param(get_param(params, iterations_t()), + num_vertices(graph)), + choose_param(get_param(params, diameter_range_t()), + diam).first, + choose_param(get_param(params, diameter_range_t()), + diam).second, + choose_param(get_param(params, learning_constant_range_t()), + learn).first, + choose_param(get_param(params, learning_constant_range_t()), + learn).second, + choose_const_pmap(get_param(params, vertex_index), graph, + vertex_index), + choose_param(get_param(params, edge_weight), + dummy_property_map())); +} + +/*********************************************************** + * Topologies * + ***********************************************************/ +template +class convex_topology +{ + struct point + { + point() { } + double& operator[](std::size_t i) {return values[i];} + const double& operator[](std::size_t i) const {return values[i];} + + private: + double values[Dims]; + }; + + public: + typedef point point_type; + + double distance(point a, point b) const + { + double dist = 0; + for (std::size_t i = 0; i < Dims; ++i) { + double diff = b[i] - a[i]; + dist += diff * diff; + } + // Exact properties of the distance are not important, as long as + // < on what this returns matches real distances + return dist; + } + + point move_position_toward(point a, double fraction, point b) const + { + point result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] + (b[i] - a[i]) * fraction; + return result; + } +}; + +template +class hypercube_topology : public convex_topology +{ + typedef uniform_01 rand_t; + + public: + typedef typename convex_topology::point_type point_type; + + explicit hypercube_topology(double scaling = 1.0) + : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)), + scaling(scaling) + { } + + hypercube_topology(RandomNumberGenerator& gen, double scaling = 1.0) + : gen_ptr(), rand(new rand_t(gen)), scaling(scaling) { } + + point_type random_point() const + { + point_type p; + for (std::size_t i = 0; i < Dims; ++i) + p[i] = (*rand)() * scaling; + return p; + } + + private: + shared_ptr gen_ptr; + shared_ptr rand; + double scaling; +}; + +template +class square_topology : public hypercube_topology<2, RandomNumberGenerator> +{ + typedef hypercube_topology<2, RandomNumberGenerator> inherited; + + public: + explicit square_topology(double scaling = 1.0) : inherited(scaling) { } + + square_topology(RandomNumberGenerator& gen, double scaling = 1.0) + : inherited(gen, scaling) { } +}; + +template +class cube_topology : public hypercube_topology<3, RandomNumberGenerator> +{ + typedef hypercube_topology<3, RandomNumberGenerator> inherited; + + public: + explicit cube_topology(double scaling = 1.0) : inherited(scaling) { } + + cube_topology(RandomNumberGenerator& gen, double scaling = 1.0) + : inherited(gen, scaling) { } +}; + +template +class ball_topology : public convex_topology +{ + typedef uniform_01 rand_t; + + public: + typedef typename convex_topology::point_type point_type; + + explicit ball_topology(double radius = 1.0) + : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)), + radius(radius) + { } + + ball_topology(RandomNumberGenerator& gen, double radius = 1.0) + : gen_ptr(), rand(new rand_t(gen)), radius(radius) { } + + point_type random_point() const + { + point_type p; + double dist_sum; + do { + dist_sum = 0.0; + for (std::size_t i = 0; i < Dims; ++i) { + double x = (*rand)() * 2*radius - radius; + p[i] = x; + dist_sum += x * x; + } + } while (dist_sum > radius*radius); + return p; + } + + private: + shared_ptr gen_ptr; + shared_ptr rand; + double radius; +}; + +template +class circle_topology : public ball_topology<2, RandomNumberGenerator> +{ + typedef ball_topology<2, RandomNumberGenerator> inherited; + + public: + explicit circle_topology(double radius = 1.0) : inherited(radius) { } + + circle_topology(RandomNumberGenerator& gen, double radius = 1.0) + : inherited(gen, radius) { } +}; + +template +class sphere_topology : public ball_topology<3, RandomNumberGenerator> +{ + typedef ball_topology<3, RandomNumberGenerator> inherited; + + public: + explicit sphere_topology(double radius = 1.0) : inherited(radius) { } + + sphere_topology(RandomNumberGenerator& gen, double radius = 1.0) + : inherited(gen, radius) { } +}; + +template +class heart_topology +{ + // Heart is defined as the union of three shapes: + // Square w/ corners (+-1000, -1000), (0, 0), (0, -2000) + // Circle centered at (-500, -500) radius 500*sqrt(2) + // Circle centered at (500, -500) radius 500*sqrt(2) + // Bounding box (-1000, -2000) - (1000, 500*(sqrt(2) - 1)) + + struct point + { + point() { values[0] = 0.0; values[1] = 0.0; } + point(double x, double y) { values[0] = x; values[1] = y; } + + double& operator[](std::size_t i) { return values[i]; } + double operator[](std::size_t i) const { return values[i]; } + + private: + double values[2]; + }; + + bool in_heart(point p) const + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::abs; + using std::pow; +#endif + + if (p[1] < abs(p[0]) - 2000) return false; // Bottom + if (p[1] <= -1000) return true; // Diagonal of square + if (pow(p[0] - -500, 2) + pow(p[1] - -500, 2) <= 500000) + return true; // Left circle + if (pow(p[0] - 500, 2) + pow(p[1] - -500, 2) <= 500000) + return true; // Right circle + return false; + } + + bool segment_within_heart(point p1, point p2) const + { + // Assumes that p1 and p2 are within the heart + if ((p1[0] < 0) == (p2[0] < 0)) return true; // Same side of symmetry line + if (p1[0] == p2[0]) return true; // Vertical + double slope = (p2[1] - p1[1]) / (p2[0] - p1[0]); + double intercept = p1[1] - p1[0] * slope; + if (intercept > 0) return false; // Crosses between circles + return true; + } + + typedef uniform_01 rand_t; + + public: + typedef point point_type; + + heart_topology() + : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)) { } + + heart_topology(RandomNumberGenerator& gen) + : gen_ptr(), rand(new rand_t(gen)) { } + + point random_point() const + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif + + point result; + double sqrt2 = sqrt(2.); + do { + result[0] = (*rand)() * (1000 + 1000 * sqrt2) - (500 + 500 * sqrt2); + result[1] = (*rand)() * (2000 + 500 * (sqrt2 - 1)) - 2000; + } while (!in_heart(result)); + return result; + } + + double distance(point a, point b) const + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif + if (segment_within_heart(a, b)) { + // Straight line + return sqrt((b[0] - a[0]) * (b[0] - a[0]) + (b[1] - a[1]) * (b[1] - a[1])); + } else { + // Straight line bending around (0, 0) + return sqrt(a[0] * a[0] + a[1] * a[1]) + sqrt(b[0] * b[0] + b[1] * b[1]); + } + } + + point move_position_toward(point a, double fraction, point b) const + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif + + if (segment_within_heart(a, b)) { + // Straight line + return point(a[0] + (b[0] - a[0]) * fraction, + a[1] + (b[1] - a[1]) * fraction); + } else { + double distance_to_point_a = sqrt(a[0] * a[0] + a[1] * a[1]); + double distance_to_point_b = sqrt(b[0] * b[0] + b[1] * b[1]); + double location_of_point = distance_to_point_a / + (distance_to_point_a + distance_to_point_b); + if (fraction < location_of_point) + return point(a[0] * (1 - fraction / location_of_point), + a[1] * (1 - fraction / location_of_point)); + else + return point( + b[0] * ((fraction - location_of_point) / (1 - location_of_point)), + b[1] * ((fraction - location_of_point) / (1 - location_of_point))); + } + } + + private: + shared_ptr gen_ptr; + shared_ptr rand; +}; + +} // namespace boost + +#endif // BOOST_GRAPH_GURSOY_ATUN_LAYOUT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/howard_cycle_ratio.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/howard_cycle_ratio.hpp new file mode 100644 index 0000000000..ec248713f4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/howard_cycle_ratio.hpp @@ -0,0 +1,611 @@ +/*! +* Copyright 2007 Technical University of Catalonia +* +* 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: Dmitry Bufistov +* Andrey Parfenov +*/ + +#ifndef BOOST_GRAPH_HOWARD_CYCLE_RATIO_HOWARD_HPP +#define BOOST_GRAPH_HOWARD_CYCLE_RATIO_HOWARD_HPP + +/*! +* \file Maximum cycle ratio algorithm (Jean Cochet-Terrasson, Guy +* Cochen and others) +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + namespace detail { + /// To avoid round error. + static const double mcr_howard_ltolerance = 0.00001; + + /*! + * Calculate maximum cycle ratio of "good" directed multigraph + * g. Use Howard's iteration policy algorithm ("Numerical + * Computation of Spectral Elements in MAX-PLUS algebra" by Jean + * Cochet-Terrasson, Guy Cochen and others). + * + * \param g = (V, E) - a "good" directed multigraph (out_degree of + * each vertex is greater then 0). If graph is strongly connected + * then it is "good". + * + * \param vim - Vertex Index, read property Map: V -> [0, + * num_vertices(g)). + * + * \param ewm - edge weight read property map: E -> R + * + * \param ewm2 - edge weight2 read property map: E -> R+ + * + * \return maximum_{for all cycles C}CR(C), or + * -(std::numeric_limits)::max() if g is not "good". + */ + template + class Cmcr_Howard + { + public: + Cmcr_Howard(const TGraph& g, TVertexIndexMap vim, TWeight1EdgeMap ewm, + TWeight2EdgeMap ew2m) + : m_g(g), m_vim(vim), m_ew1m(ewm), m_ew2m(ew2m), + m_g2pi_g_vm(std::vector().end(), m_vim), /// Stupid dummy initialization + m_minus_infinity(-(std::numeric_limits::max)()) + { + typedef typename boost::graph_traits::directed_category DirCat; + BOOST_STATIC_ASSERT((boost::is_convertible::value == true)); + m_cr = m_minus_infinity; + } + + double operator()() + { + return maximum_cycle_ratio_Howard(); + } + + virtual ~Cmcr_Howard() { } + + protected: + typedef typename boost::graph_traits::vertex_descriptor + mcr_vertex_t; + typedef typename boost::graph_traits::edge_descriptor + mcr_edge_t; + + const TGraph& m_g; + typedef std::vector eigenmode_t; + eigenmode_t m_eigen_value; + eigenmode_t m_eigen_vector; + TVertexIndexMap m_vim; + TWeight1EdgeMap m_ew1m; + TWeight2EdgeMap m_ew2m; + + typedef typename boost::remove_const::value_type>::type mcr_edge_weight1_t; + typedef typename boost::remove_const::value_type>::type mcr_edge_weight2_t; + typedef typename boost::adjacency_list< + boost::listS, boost::vecS, boost::bidirectionalS, + boost::no_property, + boost::property > > + pi_graph_t; + typedef typename boost::property_map::type TPiGraphVertexIndexMap; + typedef typename boost::property_map::type TPiGraphEdgeWeight1Map; + typedef typename boost::property_map::type TPiGraphEdgeWeight2Map; + + typedef typename boost::property_traits::value_type pigraph_vertex_index_t; + + pi_graph_t m_pi_g; + typedef typename boost::graph_traits::vertex_descriptor pi_vertex_t; + typedef typename boost::graph_traits::edge_descriptor pi_edge_t; + typedef typename boost::iterator_property_map::iterator, TVertexIndexMap> g2pi_g_vm_t; + g2pi_g_vm_t m_g2pi_g_vm; ///Graph to Pi graph vertex map + std::vector m_g2pig; + int m_step_number; + const double m_minus_infinity; + typedef typename std::vector critical_cycle_t; + double m_cr; ///Cycle ratio that already has been found + + class bad_graph + { + public: + typedef typename boost::property_traits::value_type + v_index_t; + + bad_graph(v_index_t bvi) : bad_vertex_index(bvi) {} + v_index_t what() const throw() + { + return bad_vertex_index; + } + + private: + v_index_t bad_vertex_index; + }; + + double maximum_cycle_ratio_Howard() + { + try + { + construct_pi_graph(); + } + catch (const bad_graph& a) + { + return m_minus_infinity; + } + std::vector max_eigen_val(boost::num_vertices(m_g)); + m_eigen_value.resize(boost::num_vertices(m_g)); + m_eigen_vector.resize(boost::num_vertices(m_g)); + m_step_number = 0; + do + { + pi_eingen_value(get(vertex_index, m_pi_g), get(boost::edge_weight, m_pi_g), get(boost::edge_weight2, m_pi_g)); + ++m_step_number; + } + while (improve_policy_try1(max_eigen_val) || improve_policy_try2(max_eigen_val)); + return *(std::max_element(m_eigen_value.begin(), m_eigen_value.end())); + } + + /*! + * Construct an arbitrary policy m_pi_g. + */ + void construct_pi_graph() + { + m_g2pig.resize(boost::num_vertices(m_g)); + m_g2pi_g_vm = boost::make_iterator_property_map(m_g2pig.begin(), m_vim); + BGL_FORALL_VERTICES_T(vd, m_g, TGraph) + { + m_g2pi_g_vm[vd] = boost::add_vertex(m_pi_g); + store_pivertex(m_g2pi_g_vm[vd], vd); + } + BGL_FORALL_VERTICES_T(vd1, m_g, TGraph) + { + if (boost::out_edges(vd1, m_g).first == boost::out_edges(vd1, m_g).second) throw bad_graph(m_vim[vd1]); + mcr_edge_t ed = *boost::out_edges(vd1, m_g).first; + pi_edge_t pied = boost::add_edge(m_g2pi_g_vm[source(ed, m_g)], m_g2pi_g_vm[target(ed, m_g)], m_pi_g).first; + boost::put(boost::edge_weight, m_pi_g, pied, m_ew1m[ed]); + boost::put(boost::edge_weight2, m_pi_g, pied, m_ew2m[ed]); + } + } + + class bfs_eingmode_visitor : public boost::default_bfs_visitor + { + public: + bfs_eingmode_visitor(TPiGraphVertexIndexMap vi_m, TPiGraphEdgeWeight1Map w_m, TPiGraphEdgeWeight2Map& d_m, + eigenmode_t& e_val, eigenmode_t& e_vec, double ev) : m_index_map(vi_m), m_weight_map(w_m), m_delay_map(d_m), + m_eig_value(&e_val), m_eig_vec(&e_vec), m_eigen_value(ev) { } + + template < typename Edge, typename g_t> + void examine_edge(Edge e, const g_t & g) const + { + typedef typename boost::graph_traits::vertex_descriptor Vertex; + Vertex u = boost::target(e, g), v = boost::source(e, g); + pigraph_vertex_index_t ind = m_index_map[u]; + (*m_eig_value)[ind] = m_eigen_value; + (*m_eig_vec)[ind] = m_weight_map[e] - m_eigen_value * m_delay_map[e] + (*m_eig_vec)[m_index_map[v]]; + } + private: + TPiGraphVertexIndexMap m_index_map; + TPiGraphEdgeWeight1Map m_weight_map; + TPiGraphEdgeWeight2Map m_delay_map; + eigenmode_t* m_eig_value; + eigenmode_t* m_eig_vec; + double m_eigen_value; + }; + + /*! + * Find a vertex in the Pi Graph which belongs to cycle, just a DFV until back edge found + */ + pi_vertex_t find_good_source(const pi_vertex_t start_vertex) + { + pi_vertex_t good_vertex = start_vertex; + typename std::set s; + s.insert(start_vertex); + do + { + good_vertex = boost::target(*boost::out_edges(good_vertex, m_pi_g).first, m_pi_g); + } + while (s.insert(good_vertex).second); + return good_vertex; + } + virtual void store_pivertex(pi_vertex_t pivd, mcr_vertex_t vd) {} + virtual void store_critical_edge(pi_edge_t ed, critical_cycle_t& cc) {} + virtual void store_critical_cycle(critical_cycle_t& cc) {} + + /*! + * \param startV - vertex that belongs to a cycle in policy graph m_pi_g + */ + double calculate_eigen_value(pi_vertex_t startV) + { + std::pair accum_sums(0., 0.); + pi_vertex_t vd = startV; + critical_cycle_t cc; + do + { + pi_edge_t tmp_ed = *(boost::out_edges(vd, m_pi_g).first); + store_critical_edge(tmp_ed, cc); + accum_sums.first += boost::get(boost::edge_weight, m_pi_g, tmp_ed); + accum_sums.second += boost::get(boost::edge_weight2, m_pi_g, tmp_ed); + vd = boost::target(tmp_ed, m_pi_g); + } + while (vd != startV); + //assert((std::abs(accum_sums.first) <= 0.00000001) && "Division by zerro!"); + double cr = accum_sums.first / accum_sums.second; + if (cr > m_cr) + { + m_cr = cr; + store_critical_cycle(cc); + } + else + { + + } + return cr; + } + + /*! + * Value determination. Find a generalized eigenmode (n^{k+1}, x^{k+1}) of A^{Ï_{k+1}} of the pi graph (Algorithm IV.1). + */ + void pi_eingen_value( + TPiGraphVertexIndexMap index_map, + TPiGraphEdgeWeight1Map weight_map, + TPiGraphEdgeWeight2Map weigh2_map) + { + using namespace boost; + typedef std::vector color_map_t; + color_map_t vcm(num_vertices(m_pi_g), white_color);//Vertex color map + color_map_t::iterator uv_itr = vcm.begin(); //Undiscovered vertex + reverse_graph rev_g(m_pi_g); //For backward breadth visit + + while ((uv_itr = std::find_if(uv_itr, vcm.end(), + boost::bind(std::equal_to(), boost::white_color, _1))) != vcm.end()) + ///While there are undiscovered vertices + { + pi_vertex_t gv = find_good_source(pi_vertex_t(uv_itr - vcm.begin())); + pigraph_vertex_index_t gv_ind = index_map[gv]; + m_eigen_value[gv_ind] = calculate_eigen_value(gv) ; + bfs_eingmode_visitor bfs_vis(index_map, weight_map, weigh2_map, m_eigen_value, m_eigen_vector, m_eigen_value[gv_ind]); + typename boost::queue Q; + breadth_first_visit(rev_g, gv, Q, bfs_vis, make_iterator_property_map(vcm.begin(), index_map)); + } + } + + void improve_policy(mcr_vertex_t vd, mcr_edge_t new_edge) + { + remove_edge(*(out_edges(m_g2pi_g_vm[vd], m_pi_g).first), m_pi_g); + pi_edge_t ned = add_edge(m_g2pi_g_vm[vd], m_g2pi_g_vm[target(new_edge, m_g)], m_pi_g).first; + put(edge_weight, m_pi_g, ned, m_ew1m[new_edge]); + put(edge_weight2, m_pi_g, ned, m_ew2m[new_edge]); + } + /*! + * Policy Improvement. Improve the policy graph. The new policy graph has greater cycle ratio. + * \return false if nothing can be improved. + */ + bool improve_policy_try1(std::vector& max_eing_vals) + { + bool improved = false; + BGL_FORALL_VERTICES_T(vd, m_g, TGraph) + { + double max_ev = m_minus_infinity;/// Maximum eigen value for vertex + mcr_edge_t cr_ed;///Critical edge + + BGL_FORALL_OUTEDGES_T(vd, outed, m_g, TGraph) + { + if (m_eigen_value[m_vim[target(outed, m_g)]] > max_ev) + { + max_ev = m_eigen_value[m_vim[boost::target(outed, m_g)]]; + cr_ed = outed; + } + } + if (max_ev > m_eigen_value[get(m_vim,vd)]) + { + improve_policy(vd, cr_ed); + improved = true; + } + max_eing_vals[get(m_vim,vd)] = max_ev; + } + return improved; + } + + /*! + * \param max_eigen_values[u] = max_(for all adjacent vertices (u,v)) m_eigen_value[v] + */ + bool improve_policy_try2(const std::vector& max_eigen_values) + { + bool improved = false; + BGL_FORALL_VERTICES_T(vd, m_g, TGraph) + { + mcr_edge_t impr_edge; + double max_val = m_minus_infinity; + BGL_FORALL_OUTEDGES_T(vd, outed, m_g, TGraph) + { + ///If vertex vd is in the K(vd) set + if (max_eigen_values[get(m_vim, vd)] <= m_eigen_value[get(m_vim, target(outed, m_g))]) + { + double c_val = m_ew1m[outed] - m_ew2m[outed] * m_eigen_value[m_vim[boost::target(outed, m_g)]] + + m_eigen_vector[m_vim[boost::target(outed, m_g)]]; + if (c_val > max_val) + { + max_val = c_val; + impr_edge = outed; + } + } + } + if ((max_val - m_eigen_vector[get(m_vim, vd)]) > mcr_howard_ltolerance) + ///If m_eigen_vector[vd] == max_val + { + improve_policy(vd, impr_edge); + improved = true; + } + } + return improved; + } + };///Cmcr_Howard + + /*! + * \return maximum cycle ratio and one critical cycle. + */ + template + class Cmcr_Howard1 : public Cmcr_Howard + { + public: + typedef Cmcr_Howard inhr_t; + Cmcr_Howard1(const TGraph& g, TVertexIndexMap vim, TWeight1EdgeMap ewm, TWeight2EdgeMap ew2m) : inhr_t(g, vim, ewm, ew2m) + { + m_pi_g2g.resize(boost::num_vertices(g)); + m_pi_g2g_vm = boost::make_iterator_property_map(m_pi_g2g.begin(), boost::get(boost::vertex_index, this->m_pi_g)); + } + + void get_critical_cycle(typename inhr_t::critical_cycle_t& cc) { return cc.swap(m_critical_cycle); } + protected: + void store_pivertex(typename inhr_t::pi_vertex_t pivd, typename inhr_t::mcr_vertex_t vd) + { + m_pi_g2g_vm[pivd] = vd; + } + void store_critical_edge(typename inhr_t::pi_edge_t ed, typename inhr_t::critical_cycle_t& cc) + { + typename inhr_t::pi_vertex_t s = boost::source(ed, this->m_pi_g); + typename inhr_t::pi_vertex_t t = boost::target(ed, this->m_pi_g); + assert(boost::edge(m_pi_g2g_vm[s], m_pi_g2g_vm[t], this->m_g).second); + cc.push_back(boost::edge(m_pi_g2g_vm[s], m_pi_g2g_vm[t], this->m_g).first); ///Store corresponding edge of the m_g + } + void store_critical_cycle(typename inhr_t::critical_cycle_t& cc) + { + m_critical_cycle.swap(cc); + } + private: + typename inhr_t::critical_cycle_t m_critical_cycle; + typedef typename boost::iterator_property_map::iterator, typename inhr_t::TPiGraphVertexIndexMap> pi_g2g_vm_t; + pi_g2g_vm_t m_pi_g2g_vm; ///Maps policy graph vertices to input graph vertices + typename std::vector m_pi_g2g; + }; + + /*! + * Add sink vertex - this will make any graph good, the selfloop will have ratio equal to infinity + * Properties must be "self increasing" + */ + template + typename boost::graph_traits::vertex_descriptor + make_graph_good(TGraph& g, TWeight1EdgeMap ewm, TWeight2EdgeMap ew2m, + typename boost::property_traits::value_type infinity) + { + typedef typename boost::graph_traits::edge_descriptor Edge; + typename boost::graph_traits::vertex_descriptor sink = boost::add_vertex(g); + + BGL_FORALL_VERTICES_T(vd, g, TGraph) + { + Edge newed = boost::add_edge(vd, sink, g).first; + boost::put(ewm, newed, 0); + boost::put(ew2m, newed, 1); + } + Edge selfed = boost::edge(sink, sink, g).first; + boost::put(ewm, selfed, infinity); + return sink; + } + + /*! + * Construct from input graph g "safe" (suitable for maximum_cycle_ratio1() call) version - safeg + */ + template + void construct_safe_graph(const TG& g, TIndVertexMap vim, TW1EdgeMap ew1m, TW2EdgeMap ew2m, TSafeG& safeg, SafeG2GEdgeMap& sg2gm) + { + assert(num_vertices(g) == num_vertices(safeg)); + typedef typename graph_traits::edge_descriptor tmp_edge_t; + typedef typename graph_traits::edge_descriptor edge_t; + typename graph_traits::edge_iterator ei, ei_end; + + for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + tmp_edge_t tmped = add_edge(vim[source(*ei, g)], vim[target(*ei, g)], safeg).first; + sg2gm[tmped] = *ei; + put(edge_weight, safeg, tmped, get(ew1m, *ei)); + put(edge_weight2, safeg, tmped, get(ew2m, *ei)); + } + } + + template + double maximum_cycle_ratio_good_graph(const TGraph& g, TVertexIndexMap vim, TWeight1EdgeMap ewm, TWeight2EdgeMap ew2m, + typename std::vector::edge_descriptor>* pcc = 0) + { + if (pcc == 0) + { + return detail::Cmcr_Howard(g, vim, ewm, ew2m)(); + } + else + { + detail::Cmcr_Howard1 obj(g, vim, ewm, ew2m); + double maxcr = obj(); + obj.get_critical_cycle(*pcc); + return maxcr; + } + } + + template + double minimum_cycle_ratio_good_graph(const TGraph& g, TVertexIndexMap vim, TWeight1EdgeMap ewm, + TWeight2EdgeMap ew2m, TEdgeIndexMap eim, + typename std::vector::edge_descriptor>* pcc = 0) + { + typedef typename boost::remove_const::value_type>::type weight_value_t; + BOOST_STATIC_ASSERT(!is_integral::value || is_signed::value); + typename std::vector ne_w(boost::num_edges(g)); + BGL_FORALL_EDGES_T(ed, g, TGraph) ne_w[boost::get(eim, ed)] = -ewm[ed]; + return -maximum_cycle_ratio_good_graph(g, vim, boost::make_iterator_property_map(ne_w.begin(), eim), ew2m, pcc); + } + + /*! + * \param g directed multigraph. + * \param pcc - pointer to the critical edges list. + * \param minus_infinity must be small enough to garanty that g has at least one cycle with greater ratio. + * \return minus_infinity if there're no cycles in the graph + */ + template + double maximum_cycle_ratio1(const TGraph& g, TWeight1EdgeMap ewm, TWeight2EdgeMap ew2m, + typename std::vector::edge_descriptor>* pcc = 0, + typename boost::property_traits::value_type minus_infinity = -(std::numeric_limits::max)()) + { + typedef typename boost::graph_traits::vertex_descriptor Vertex; + typedef typename boost::graph_traits::edge_descriptor Edge; + boost::function_requires< boost::ReadWritePropertyMapConcept >(); + boost::function_requires< boost::ReadWritePropertyMapConcept >(); + + TGraph& ncg = const_cast(g); + Vertex sink = detail::make_graph_good(ncg, ewm, ew2m, minus_infinity ); + + double res = maximum_cycle_ratio_good_graph(ncg, boost::get(boost::vertex_index, g), ewm, ew2m, pcc); + boost::clear_vertex(sink, ncg); boost::remove_vertex(sink, ncg); + return res; + } + + /*! + * Edge index MUST be in diapazon [0,..., num_edges(g)-1] + * \return plus_infinity if g has no cycles. + */ + template + double minimum_cycle_ratio1(const TGraph& g, TWeight1EdgeMap ewm, TWeight2EdgeMap ew2m, TEdgeIndexMap eim, + typename std::vector::edge_descriptor>* pcc = 0, + typename boost::property_traits::value_type plus_infinity = (std::numeric_limits::max)() + ) + { + typedef typename boost::property_traits::value_type ei_t; + typedef typename boost::graph_traits::vertex_descriptor Vertex; + typedef typename boost::graph_traits::edge_descriptor Edge; + + boost::function_requires< boost::ReadWritePropertyMapConcept >(); + boost::function_requires< boost::ReadWritePropertyMapConcept >(); + boost::function_requires< boost::ReadWritePropertyMapConcept >(); + + TGraph& ncg = const_cast(g); + + ei_t nei = ei_t(boost::num_edges(g)); + Vertex sink = detail::make_graph_good(ncg, ewm, ew2m, plus_infinity ); + ///Maintain edge index invariant + BGL_FORALL_VERTICES_T(vd, ncg, TGraph) + { + typename boost::graph_traits::edge_descriptor ed = boost::edge(vd, sink, ncg).first; + boost::put(eim, ed, nei++); + } + double res = minimum_cycle_ratio_good_graph(ncg, boost::get(boost::vertex_index, ncg), ewm, ew2m, eim, pcc); + boost::clear_vertex(sink, ncg); boost::remove_vertex(sink, ncg); + return res; + } + struct edge_less_than + { + template bool operator()(const TEdgeDescriptor& x, const TEdgeDescriptor& y) const + { + return x.get_property() < y.get_property(); + } + }; + }///namespace detail + namespace + { + template struct safe_graph + { + typedef typename boost::adjacency_list > > type; + }; + } + + /*! + * Calculate the maximum cycle ratio (mcr) of the directed multigraph g. + * \param g directed multigraph + * \param pcc - If provided then a critical cycle will be written to corresponding vector. + * \param minus_infinity small enough value to garanty that g has at least one cycle with greater ratio. + * \return mcr or minus_infinity if g has no cycles. + */ + template + double maximum_cycle_ratio(const TGraph& g, TVertexIndexMap vim, TW1EdgeMap ew1m, TW2EdgeMap ew2m, + typename std::vector::edge_descriptor>* pcc = 0, + typename boost::property_traits::value_type minus_infinity = + -(std::numeric_limits::max)()) + { + typedef typename remove_const::value_type>::type w1_t; + typedef typename remove_const::value_type>::type w2_t; + typedef typename safe_graph::type safe_graph_t; + typedef typename graph_traits::edge_descriptor tmp_edge_t; + typedef typename graph_traits::edge_descriptor edge_t; + typename std::map tmpg2g; + std::vector cc; + safe_graph_t sg(num_vertices(g)); + detail::construct_safe_graph(g, vim, ew1m, ew2m, sg, tmpg2g); + double mcr = maximum_cycle_ratio1(sg, get(edge_weight, sg), get(edge_weight2, sg), pcc ? &cc : 0, minus_infinity); + if (pcc && (mcr > minus_infinity)) + { + pcc->clear(); + for (typename std::vector::iterator it = cc.begin(); it != cc.end(); ++it) pcc->push_back(tmpg2g[*it]); + } + return mcr; + } + + template + double minimum_cycle_ratio(const TGraph& g, TVertexIndexMap vim, TW1EdgeMap ew1m, TW2EdgeMap ew2m, TIndEdgeMap eim, + typename std::vector::edge_descriptor>* pcc = 0, + typename boost::property_traits::value_type plus_infinity = + (std::numeric_limits::max)()) + { + typedef typename boost::remove_const::value_type>::type weight_value_t; + BOOST_STATIC_ASSERT(!is_integral::value || is_signed::value); + typename std::vector ne_w(boost::num_edges(g)); + BGL_FORALL_EDGES_T(ed, g, TGraph) ne_w[boost::get(eim, ed)] = -ew1m[ed]; + return -maximum_cycle_ratio(g, vim, boost::make_iterator_property_map(ne_w.begin(), eim), ew2m, pcc, -plus_infinity); + } + /*! + * Calculate maximum mean cycle of directed weighted multigraph. + * \param g directed multigraph + * \return maximum mean cycle of g or minus_infinity if g has no cycles. + */ + template + double maximum_mean_cycle(const TGraph& g, TVertexIndexMap vim, TWeightEdgeMap ewm, TIndEdgeMap eim, + typename std::vector::edge_descriptor>* pcc = 0, + typename boost::property_traits::value_type minus_infinity = + -(std::numeric_limits::max)()) + { + typedef typename boost::remove_const::value_type>::type weight_value_t; + typedef typename boost::graph_traits::edge_descriptor Edge; + typename std::vector ed_w2(boost::num_edges(g), 1); + return maximum_cycle_ratio(g, vim, ewm, boost::make_iterator_property_map(ed_w2.begin(), eim), pcc, minus_infinity); + } + + template + double minimum_mean_cycle(const TGraph& g, TVertexIndexMap vim, TWeightEdgeMap ewm, TIndEdgeMap eim, + typename std::vector::edge_descriptor>* pcc = 0, + typename boost::property_traits::value_type plus_infinity = + (std::numeric_limits::max)()) + { + typedef typename boost::remove_const::value_type>::type weight_value_t; + typedef typename boost::graph_traits::edge_descriptor Edge; + typename std::vector ed_w2(boost::num_edges(g), 1); + return minimum_cycle_ratio(g, vim, ewm, boost::make_iterator_property_map(ed_w2.begin(), eim), eim, pcc, plus_infinity); + } +} //namespace boost +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/incremental_components.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/incremental_components.hpp new file mode 100644 index 0000000000..4cb571bb0b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/incremental_components.hpp @@ -0,0 +1,170 @@ +// +//======================================================================= +// Copyright 1997-2001 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_INCREMENTAL_COMPONENTS_HPP +#define BOOST_INCREMENTAL_COMPONENTS_HPP + +#include +#include + +namespace boost { + + // A connected component algorithm for the case when dynamically + // adding (but not removing) edges is common. The + // incremental_components() function is a preparing operation. Call + // same_component to check whether two vertices are in the same + // component, or use disjoint_set::find_set to determine the + // representative for a vertex. + + // This version of connected components does not require a full + // Graph. Instead, it just needs an edge list, where the vertices of + // each edge need to be of integer type. The edges are assumed to + // be undirected. The other difference is that the result is stored in + // a container, instead of just a decorator. The container should be + // empty before the algorithm is called. It will grow during the + // course of the algorithm. The container must be a model of + // BackInsertionSequence and RandomAccessContainer + // (std::vector is a good choice). After running the algorithm the + // index container will map each vertex to the representative + // vertex of the component to which it belongs. + // + // Adapted from an implementation by Alex Stepanov. The disjoint + // sets data structure is from Tarjan's "Data Structures and Network + // Algorithms", and the application to connected components is + // similar to the algorithm described in Ch. 22 of "Intro to + // Algorithms" by Cormen, et. all. + // + // RankContainer is a random accessable container (operator[] is + // defined) with a value type that can represent an integer part of + // a binary log of the value type of the corresponding + // ParentContainer (char is always enough) its size_type is no less + // than the size_type of the corresponding ParentContainer + + // An implementation of disjoint sets can be found in + // boost/pending/disjoint_sets.hpp + + template + void incremental_components(EdgeListGraph& g, DisjointSets& ds) + { + typename graph_traits::edge_iterator e, end; + for (tie(e,end) = edges(g); e != end; ++e) + ds.union_set(source(*e,g),target(*e,g)); + } + + template + void compress_components(ParentIterator first, ParentIterator last) + { + for (ParentIterator current = first; current != last; ++current) + detail::find_representative_with_full_compression(first, current-first); + } + + template + typename boost::detail::iterator_traits::difference_type + component_count(ParentIterator first, ParentIterator last) + { + std::ptrdiff_t count = 0; + for (ParentIterator current = first; current != last; ++current) + if (*current == current - first) ++count; + return count; + } + + // This algorithm can be applied to the result container of the + // connected_components algorithm to normalize + // the components. + template + void normalize_components(ParentIterator first, ParentIterator last) + { + for (ParentIterator current = first; current != last; ++current) + detail::normalize_node(first, current - first); + } + + template + void initialize_incremental_components(VertexListGraph& G, DisjointSets& ds) + { + typename graph_traits + ::vertex_iterator v, vend; + for (tie(v, vend) = vertices(G); v != vend; ++v) + ds.make_set(*v); + } + + template + inline bool same_component(Vertex u, Vertex v, DisjointSet& ds) + { + return ds.find_set(u) == ds.find_set(v); + } + + // considering changing the so that it initializes with a pair of + // vertex iterators and a parent PA. + + template + class component_index + { + public://protected: (avoid friends for now) + typedef std::vector MyIndexContainer; + MyIndexContainer header; + MyIndexContainer index; + typedef typename MyIndexContainer::size_type SizeT; + typedef typename MyIndexContainer::const_iterator IndexIter; + public: + typedef detail::component_iterator + component_iterator; + class component { + friend class component_index; + protected: + IndexT number; + const component_index* comp_ind_ptr; + component(IndexT i, const component_index* p) + : number(i), comp_ind_ptr(p) {} + public: + typedef component_iterator iterator; + typedef component_iterator const_iterator; + typedef IndexT value_type; + iterator begin() const { + return iterator( comp_ind_ptr->index.begin(), + (comp_ind_ptr->header)[number] ); + } + iterator end() const { + return iterator( comp_ind_ptr->index.begin(), + comp_ind_ptr->index.size() ); + } + }; + typedef SizeT size_type; + typedef component value_type; + +#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) + template + component_index(Iterator first, Iterator last) + : index(std::distance(first, last)) + { + std::copy(first, last, index.begin()); + detail::construct_component_index(index, header); + } +#else + template + component_index(Iterator first, Iterator last) + : index(first, last) + { + detail::construct_component_index(index, header); + } +#endif + + component operator[](IndexT i) const { + return component(i, this); + } + SizeT size() const { + return header.size(); + } + + }; + +} // namespace boost + +#endif // BOOST_INCREMENTAL_COMPONENTS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/is_kuratowski_subgraph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/is_kuratowski_subgraph.hpp new file mode 100644 index 0000000000..c510c3ab7b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/is_kuratowski_subgraph.hpp @@ -0,0 +1,332 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= +#ifndef __IS_KURATOWSKI_SUBGRAPH_HPP__ +#define __IS_KURATOWSKI_SUBGRAPH_HPP__ + +#include +#include //for next/prior +#include //for tie +#include +#include +#include +#include + +#include +#include +#include + + + +namespace boost +{ + + namespace detail + { + + template + Graph make_K_5() + { + typename graph_traits::vertex_iterator vi, vi_end, inner_vi; + Graph K_5(5); + for(tie(vi,vi_end) = vertices(K_5); vi != vi_end; ++vi) + for(inner_vi = next(vi); inner_vi != vi_end; ++inner_vi) + add_edge(*vi, *inner_vi, K_5); + return K_5; + } + + + template + Graph make_K_3_3() + { + typename graph_traits::vertex_iterator + vi, vi_end, bipartition_start, inner_vi; + Graph K_3_3(6); + bipartition_start = next(next(next(vertices(K_3_3).first))); + for(tie(vi, vi_end) = vertices(K_3_3); vi != bipartition_start; ++vi) + for(inner_vi= bipartition_start; inner_vi != vi_end; ++inner_vi) + add_edge(*vi, *inner_vi, K_3_3); + return K_3_3; + } + + + template + void contract_edge(AdjacencyList& neighbors, Vertex u, Vertex v) + { + // Remove u from v's neighbor list + neighbors[v].erase(std::remove(neighbors[v].begin(), + neighbors[v].end(), u + ), + neighbors[v].end() + ); + + // Replace any references to u with references to v + typedef typename AdjacencyList::value_type::iterator + adjacency_iterator_t; + + adjacency_iterator_t u_neighbor_end = neighbors[u].end(); + for(adjacency_iterator_t u_neighbor_itr = neighbors[u].begin(); + u_neighbor_itr != u_neighbor_end; ++u_neighbor_itr + ) + { + Vertex u_neighbor(*u_neighbor_itr); + std::replace(neighbors[u_neighbor].begin(), + neighbors[u_neighbor].end(), u, v + ); + } + + // Remove v from u's neighbor list + neighbors[u].erase(std::remove(neighbors[u].begin(), + neighbors[u].end(), v + ), + neighbors[u].end() + ); + + // Add everything in u's neighbor list to v's neighbor list + std::copy(neighbors[u].begin(), + neighbors[u].end(), + std::back_inserter(neighbors[v]) + ); + + // Clear u's neighbor list + neighbors[u].clear(); + + } + + } // namespace detail + + + + + template + bool is_kuratowski_subgraph(const Graph& g, + ForwardIterator begin, + ForwardIterator end, + VertexIndexMap vm + ) + { + + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::edges_size_type e_size_t; + typedef typename graph_traits::vertices_size_type v_size_t; + typedef typename std::vector v_list_t; + typedef typename v_list_t::iterator v_list_iterator_t; + typedef iterator_property_map + ::iterator, VertexIndexMap> + vertex_to_v_list_map_t; + + typedef adjacency_list small_graph_t; + + enum target_graph_t { k_3_3, k_5}; + + target_graph_t target_graph = k_3_3; //unless we decide otherwise later + + static small_graph_t K_5(detail::make_K_5()); + + static small_graph_t K_3_3(detail::make_K_3_3()); + + v_size_t n_vertices(num_vertices(g)); + v_size_t max_num_edges(3*n_vertices - 5); + + std::vector neighbors_vector(n_vertices); + vertex_to_v_list_map_t neighbors(neighbors_vector.begin(), vm); + + e_size_t count = 0; + for(ForwardIterator itr = begin; itr != end; ++itr) + { + + if (count++ > max_num_edges) + return false; + + edge_t e(*itr); + vertex_t u(source(e,g)); + vertex_t v(target(e,g)); + + neighbors[u].push_back(v); + neighbors[v].push_back(u); + + } + + + for(v_size_t max_size = 2; max_size < 5; ++max_size) + { + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + + //a hack to make sure we don't contract the middle edge of a path + //of four degree-3 vertices + if (max_size == 4 && neighbors[v].size() == 3) + { + if (neighbors[neighbors[v][0]].size() + + neighbors[neighbors[v][1]].size() + + neighbors[neighbors[v][2]].size() + < 11 // so, it has two degree-3 neighbors + ) + continue; + } + + while (neighbors[v].size() > 0 && neighbors[v].size() < max_size) + { + // Find one of v's neighbors u such that that v and u + // have no neighbors in common. We'll look for such a + // neighbor with a naive cubic-time algorithm since the + // max size of any of the neighbor sets we'll consider + // merging is 3 + + bool neighbor_sets_intersect = false; + + vertex_t min_u = graph_traits::null_vertex(); + vertex_t u; + v_list_iterator_t v_neighbor_end = neighbors[v].end(); + for(v_list_iterator_t v_neighbor_itr = neighbors[v].begin(); + v_neighbor_itr != v_neighbor_end; + ++v_neighbor_itr + ) + { + neighbor_sets_intersect = false; + u = *v_neighbor_itr; + v_list_iterator_t u_neighbor_end = neighbors[u].end(); + for(v_list_iterator_t u_neighbor_itr = + neighbors[u].begin(); + u_neighbor_itr != u_neighbor_end && + !neighbor_sets_intersect; + ++u_neighbor_itr + ) + { + for(v_list_iterator_t inner_v_neighbor_itr = + neighbors[v].begin(); + inner_v_neighbor_itr != v_neighbor_end; + ++inner_v_neighbor_itr + ) + { + if (*u_neighbor_itr == *inner_v_neighbor_itr) + { + neighbor_sets_intersect = true; + break; + } + } + + } + if (!neighbor_sets_intersect && + (min_u == graph_traits::null_vertex() || + neighbors[u].size() < neighbors[min_u].size()) + ) + { + min_u = u; + } + + } + + if (min_u == graph_traits::null_vertex()) + // Exited the loop without finding an appropriate neighbor of + // v, so v must be a lost cause. Move on to other vertices. + break; + else + u = min_u; + + detail::contract_edge(neighbors, u, v); + + }//end iteration over v's neighbors + + }//end iteration through vertices v + + if (max_size == 3) + { + // check to see whether we should go on to find a K_5 + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + if (neighbors[*vi].size() == 4) + { + target_graph = k_5; + break; + } + + if (target_graph == k_3_3) + break; + } + + }//end iteration through max degree 2,3, and 4 + + + //Now, there should only be 5 or 6 vertices with any neighbors. Find them. + + v_list_t main_vertices; + vertex_iterator_t vi, vi_end; + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + if (!neighbors[*vi].empty()) + main_vertices.push_back(*vi); + } + + // create a graph isomorphic to the contracted graph to test + // against K_5 and K_3_3 + small_graph_t contracted_graph(main_vertices.size()); + std::map::vertex_descriptor> + contracted_vertex_map; + + typename v_list_t::iterator itr, itr_end; + itr_end = main_vertices.end(); + typename graph_traits::vertex_iterator + si = vertices(contracted_graph).first; + + for(itr = main_vertices.begin(); itr != itr_end; ++itr, ++si) + { + contracted_vertex_map[*itr] = *si; + } + + typename v_list_t::iterator jtr, jtr_end; + for(itr = main_vertices.begin(); itr != itr_end; ++itr) + { + jtr_end = neighbors[*itr].end(); + for(jtr = neighbors[*itr].begin(); jtr != jtr_end; ++jtr) + { + if (get(vm,*itr) < get(vm,*jtr)) + { + add_edge(contracted_vertex_map[*itr], + contracted_vertex_map[*jtr], + contracted_graph + ); + } + } + } + + if (target_graph == k_5) + { + return isomorphism(K_5,contracted_graph); + } + else //target_graph == k_3_3 + { + return isomorphism(K_3_3,contracted_graph); + } + + + } + + + + + + template + bool is_kuratowski_subgraph(const Graph& g, + ForwardIterator begin, + ForwardIterator end + ) + { + return is_kuratowski_subgraph(g, begin, end, get(vertex_index,g)); + } + + + + +} + +#endif //__IS_KURATOWSKI_SUBGRAPH_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/is_straight_line_drawing.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/is_straight_line_drawing.hpp new file mode 100644 index 0000000000..f533bce2df --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/is_straight_line_drawing.hpp @@ -0,0 +1,232 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +//======================================================================= +#ifndef __IS_STRAIGHT_LINE_DRAWING_HPP__ +#define __IS_STRAIGHT_LINE_DRAWING_HPP__ + +#include +#include //for next and prior +#include +#include +#include +#include +#include + +#include +#include +#include + + + +namespace boost +{ + + // Return true exactly when the line segments s1 = ((x1,y1), (x2,y2)) and + // s2 = ((a1,b1), (a2,b2)) intersect in a point other than the endpoints of + // the line segments. The one exception to this rule is when s1 = s2, in + // which case false is returned - this is to accomodate multiple edges + // between the same pair of vertices, which shouldn't invalidate the straight + // line embedding. A tolerance variable epsilon can also be used, which + // defines how far away from the endpoints of s1 and s2 we want to consider + // an intersection. + + bool intersects(double x1, double y1, + double x2, double y2, + double a1, double b1, + double a2, double b2, + double epsilon = 0.000001 + ) + { + + if (x1 - x2 == 0) + { + std::swap(x1,a1); + std::swap(y1,b1); + std::swap(x2,a2); + std::swap(y2,b2); + } + + if (x1 - x2 == 0) + { + BOOST_USING_STD_MAX(); + BOOST_USING_STD_MIN(); + + //two vertical line segments + double min_y = min BOOST_PREVENT_MACRO_SUBSTITUTION(y1,y2); + double max_y = max BOOST_PREVENT_MACRO_SUBSTITUTION(y1,y2); + double min_b = min BOOST_PREVENT_MACRO_SUBSTITUTION(b1,b2); + double max_b = max BOOST_PREVENT_MACRO_SUBSTITUTION(b1,b2); + if ((max_y > max_b && max_b > min_y) || + (max_b > max_y && max_y > min_b) + ) + return true; + else + return false; + } + + double x_diff = x1 - x2; + double y_diff = y1 - y2; + double a_diff = a2 - a1; + double b_diff = b2 - b1; + + double beta_denominator = b_diff - (y_diff/((double)x_diff)) * a_diff; + + if (beta_denominator == 0) + { + //parallel lines + return false; + } + + double beta = (b2 - y2 - (y_diff/((double)x_diff)) * (a2 - x2)) / + beta_denominator; + double alpha = (a2 - x2 - beta*(a_diff))/x_diff; + + double upper_bound = 1 - epsilon; + double lower_bound = 0 + epsilon; + + return (beta < upper_bound && beta > lower_bound && + alpha < upper_bound && alpha > lower_bound); + + } + + + template + bool is_straight_line_drawing(const Graph& g, + GridPositionMap drawing, + VertexIndexMap vm + ) + { + + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::edge_iterator edge_iterator_t; + typedef typename graph_traits::edges_size_type e_size_t; + typedef typename graph_traits::vertices_size_type v_size_t; + + typedef std::size_t x_coord_t; + typedef std::size_t y_coord_t; + typedef boost::tuple edge_event_t; + typedef typename std::vector< edge_event_t > edge_event_queue_t; + + typedef tuple active_map_key_t; + typedef edge_t active_map_value_t; + typedef std::map< active_map_key_t, active_map_value_t > active_map_t; + typedef typename active_map_t::iterator active_map_iterator_t; + + + edge_event_queue_t edge_event_queue; + active_map_t active_edges; + + edge_iterator_t ei, ei_end; + for(tie(ei,ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + vertex_t s(source(e,g)); + vertex_t t(target(e,g)); + edge_event_queue.push_back + (make_tuple(e, + static_cast(drawing[s].x), + static_cast(drawing[s].y) + ) + ); + edge_event_queue.push_back + (make_tuple(e, + static_cast(drawing[t].x), + static_cast(drawing[t].y) + ) + ); + } + + // Order by edge_event_queue by first, then second coordinate + // (bucket_sort is a stable sort.) + bucket_sort(edge_event_queue.begin(), edge_event_queue.end(), + property_map_tuple_adaptor() + ); + + bucket_sort(edge_event_queue.begin(), edge_event_queue.end(), + property_map_tuple_adaptor() + ); + + typedef typename edge_event_queue_t::iterator event_queue_iterator_t; + event_queue_iterator_t itr_end = edge_event_queue.end(); + for(event_queue_iterator_t itr = edge_event_queue.begin(); + itr != itr_end; ++itr + ) + { + edge_t e(get<0>(*itr)); + vertex_t source_v(source(e,g)); + vertex_t target_v(target(e,g)); + if (drawing[source_v].x > drawing[target_v].x) + std::swap(source_v, target_v); + + active_map_key_t key(get(drawing, source_v).y, + get(drawing, target_v).y, + get(drawing, source_v).x, + get(drawing, target_v).x + ); + + active_map_iterator_t a_itr = active_edges.find(key); + if (a_itr == active_edges.end()) + { + active_edges[key] = e; + } + else + { + active_map_iterator_t before, after; + if (a_itr == active_edges.begin()) + before = active_edges.end(); + else + before = prior(a_itr); + after = next(a_itr); + + if (after != active_edges.end() || before != active_edges.end()) + { + + edge_t f = after != active_edges.end() ? + after->second : before->second; + + vertex_t e_source(source(e,g)); + vertex_t e_target(target(e,g)); + vertex_t f_source(source(f,g)); + vertex_t f_target(target(f,g)); + + if (intersects(drawing[e_source].x, + drawing[e_source].y, + drawing[e_target].x, + drawing[e_target].y, + drawing[f_source].x, + drawing[f_source].y, + drawing[f_target].x, + drawing[f_target].y + ) + ) + return false; + } + + active_edges.erase(a_itr); + + } + } + + return true; + + } + + + template + bool is_straight_line_drawing(const Graph& g, GridPositionMap drawing) + { + return is_straight_line_drawing(g, drawing, get(vertex_index,g)); + } + +} + +#endif // __IS_STRAIGHT_LINE_DRAWING_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/isomorphism.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/isomorphism.hpp new file mode 100644 index 0000000000..842f914356 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/isomorphism.hpp @@ -0,0 +1,467 @@ +// Copyright (C) 2001 Jeremy Siek, Douglas Gregor, Brian Osman +// +// 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_GRAPH_ISOMORPHISM_HPP +#define BOOST_GRAPH_ISOMORPHISM_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include // for make_indirect_pmap + +#ifndef BOOST_GRAPH_ITERATION_MACROS_HPP +#define BOOST_ISO_INCLUDED_ITER_MACROS // local macro, see bottom of file +#include +#endif + +namespace boost { + + namespace detail { + + template + class isomorphism_algo + { + typedef typename graph_traits::vertex_descriptor vertex1_t; + typedef typename graph_traits::vertex_descriptor vertex2_t; + typedef typename graph_traits::edge_descriptor edge1_t; + typedef typename graph_traits::vertices_size_type size_type; + typedef typename Invariant1::result_type invar1_value; + typedef typename Invariant2::result_type invar2_value; + + const Graph1& G1; + const Graph2& G2; + IsoMapping f; + Invariant1 invariant1; + Invariant2 invariant2; + std::size_t max_invariant; + IndexMap1 index_map1; + IndexMap2 index_map2; + + std::vector dfs_vertices; + typedef typename std::vector::iterator vertex_iter; + std::vector dfs_num_vec; + typedef safe_iterator_property_map::iterator, + IndexMap1 +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + , int, int& +#endif /* BOOST_NO_STD_ITERATOR_TRAITS */ + > DFSNumMap; + DFSNumMap dfs_num; + std::vector ordered_edges; + typedef typename std::vector::iterator edge_iter; + + std::vector in_S_vec; + typedef safe_iterator_property_map::iterator, + IndexMap2 +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + , char, char& +#endif /* BOOST_NO_STD_ITERATOR_TRAITS */ + > InSMap; + InSMap in_S; + + int num_edges_on_k; + + friend struct compare_multiplicity; + struct compare_multiplicity + { + compare_multiplicity(Invariant1 invariant1, size_type* multiplicity) + : invariant1(invariant1), multiplicity(multiplicity) { } + bool operator()(const vertex1_t& x, const vertex1_t& y) const { + return multiplicity[invariant1(x)] < multiplicity[invariant1(y)]; + } + Invariant1 invariant1; + size_type* multiplicity; + }; + + struct record_dfs_order : default_dfs_visitor + { + record_dfs_order(std::vector& v, std::vector& e) + : vertices(v), edges(e) { } + + void discover_vertex(vertex1_t v, const Graph1&) const { + vertices.push_back(v); + } + void examine_edge(edge1_t e, const Graph1& G1) const { + edges.push_back(e); + } + std::vector& vertices; + std::vector& edges; + }; + + struct edge_cmp { + edge_cmp(const Graph1& G1, DFSNumMap dfs_num) + : G1(G1), dfs_num(dfs_num) { } + bool operator()(const edge1_t& e1, const edge1_t& e2) const { + using namespace std; + int u1 = dfs_num[source(e1,G1)], v1 = dfs_num[target(e1,G1)]; + int u2 = dfs_num[source(e2,G1)], v2 = dfs_num[target(e2,G1)]; + int m1 = (max)(u1, v1); + int m2 = (max)(u2, v2); + // lexicographical comparison + return std::make_pair(m1, std::make_pair(u1, v1)) + < std::make_pair(m2, std::make_pair(u2, v2)); + } + const Graph1& G1; + DFSNumMap dfs_num; + }; + + public: + isomorphism_algo(const Graph1& G1, const Graph2& G2, IsoMapping f, + Invariant1 invariant1, Invariant2 invariant2, std::size_t max_invariant, + IndexMap1 index_map1, IndexMap2 index_map2) + : G1(G1), G2(G2), f(f), invariant1(invariant1), invariant2(invariant2), + max_invariant(max_invariant), + index_map1(index_map1), index_map2(index_map2) + { + in_S_vec.resize(num_vertices(G1)); + in_S = make_safe_iterator_property_map + (in_S_vec.begin(), in_S_vec.size(), index_map2 +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + , in_S_vec.front() +#endif /* BOOST_NO_STD_ITERATOR_TRAITS */ + ); + } + + bool test_isomorphism() + { + { + std::vector invar1_array; + BGL_FORALL_VERTICES_T(v, G1, Graph1) + invar1_array.push_back(invariant1(v)); + sort(invar1_array); + + std::vector invar2_array; + BGL_FORALL_VERTICES_T(v, G2, Graph2) + invar2_array.push_back(invariant2(v)); + sort(invar2_array); + if (! equal(invar1_array, invar2_array)) + return false; + } + + std::vector V_mult; + BGL_FORALL_VERTICES_T(v, G1, Graph1) + V_mult.push_back(v); + { + std::vector multiplicity(max_invariant, 0); + BGL_FORALL_VERTICES_T(v, G1, Graph1) + ++multiplicity[invariant1(v)]; + sort(V_mult, compare_multiplicity(invariant1, &multiplicity[0])); + } + + std::vector color_vec(num_vertices(G1)); + safe_iterator_property_map::iterator, + IndexMap1 +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + , default_color_type, default_color_type& +#endif /* BOOST_NO_STD_ITERATOR_TRAITS */ + > + color_map(color_vec.begin(), color_vec.size(), index_map1); + record_dfs_order dfs_visitor(dfs_vertices, ordered_edges); + typedef color_traits Color; + for (vertex_iter u = V_mult.begin(); u != V_mult.end(); ++u) { + if (color_map[*u] == Color::white()) { + dfs_visitor.start_vertex(*u, G1); + depth_first_visit(G1, *u, dfs_visitor, color_map); + } + } + // Create the dfs_num array and dfs_num_map + dfs_num_vec.resize(num_vertices(G1)); + dfs_num = make_safe_iterator_property_map(dfs_num_vec.begin(), + dfs_num_vec.size(), + index_map1 +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + , dfs_num_vec.front() +#endif /* BOOST_NO_STD_ITERATOR_TRAITS */ + ); + size_type n = 0; + for (vertex_iter v = dfs_vertices.begin(); v != dfs_vertices.end(); ++v) + dfs_num[*v] = n++; + + sort(ordered_edges, edge_cmp(G1, dfs_num)); + + + int dfs_num_k = -1; + return this->match(ordered_edges.begin(), dfs_num_k); + } + + private: + bool match(edge_iter iter, int dfs_num_k) + { + if (iter != ordered_edges.end()) { + vertex1_t i = source(*iter, G1), j = target(*iter, G2); + if (dfs_num[i] > dfs_num_k) { + vertex1_t kp1 = dfs_vertices[dfs_num_k + 1]; + BGL_FORALL_VERTICES_T(u, G2, Graph2) { + if (invariant1(kp1) == invariant2(u) && in_S[u] == false) { + f[kp1] = u; + in_S[u] = true; + num_edges_on_k = 0; + + if (match(iter, dfs_num_k + 1)) +#if 0 + // dwa 2003/7/11 -- this *HAS* to be a bug! + ; +#endif + return true; + + in_S[u] = false; + } + } + + } + else if (dfs_num[j] > dfs_num_k) { + vertex1_t k = dfs_vertices[dfs_num_k]; + num_edges_on_k -= + count_if(adjacent_vertices(f[k], G2), make_indirect_pmap(in_S)); + + for (int jj = 0; jj < dfs_num_k; ++jj) { + vertex1_t j = dfs_vertices[jj]; + num_edges_on_k -= count(adjacent_vertices(f[j], G2), f[k]); + } + + if (num_edges_on_k != 0) + return false; + BGL_FORALL_ADJ_T(f[i], v, G2, Graph2) + if (invariant2(v) == invariant1(j) && in_S[v] == false) { + f[j] = v; + in_S[v] = true; + num_edges_on_k = 1; + BOOST_USING_STD_MAX(); + int next_k = max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num_k, max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num[i], dfs_num[j])); + if (match(next(iter), next_k)) + return true; + in_S[v] = false; + } + + + } + else { + if (container_contains(adjacent_vertices(f[i], G2), f[j])) { + ++num_edges_on_k; + if (match(next(iter), dfs_num_k)) + return true; + } + + } + } else + return true; + return false; + } + + }; + + + template + void compute_in_degree(const Graph& g, InDegreeMap in_degree_map) + { + BGL_FORALL_VERTICES_T(v, g, Graph) + put(in_degree_map, v, 0); + + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_ADJ_T(u, v, g, Graph) + put(in_degree_map, v, get(in_degree_map, v) + 1); + } + + } // namespace detail + + + template + class degree_vertex_invariant + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::degree_size_type size_type; + public: + typedef vertex_t argument_type; + typedef size_type result_type; + + degree_vertex_invariant(const InDegreeMap& in_degree_map, const Graph& g) + : m_in_degree_map(in_degree_map), m_g(g) { } + + size_type operator()(vertex_t v) const { + return (num_vertices(m_g) + 1) * out_degree(v, m_g) + + get(m_in_degree_map, v); + } + // The largest possible vertex invariant number + size_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { + return num_vertices(m_g) * num_vertices(m_g) + num_vertices(m_g); + } + private: + InDegreeMap m_in_degree_map; + const Graph& m_g; + }; + + + template + bool isomorphism(const Graph1& G1, const Graph2& G2, IsoMapping f, + Invariant1 invariant1, Invariant2 invariant2, + std::size_t max_invariant, + IndexMap1 index_map1, IndexMap2 index_map2) + + { + // Graph requirements + function_requires< VertexListGraphConcept >(); + function_requires< EdgeListGraphConcept >(); + function_requires< VertexListGraphConcept >(); + function_requires< BidirectionalGraphConcept >(); + + typedef typename graph_traits::vertex_descriptor vertex1_t; + typedef typename graph_traits::vertex_descriptor vertex2_t; + typedef typename graph_traits::vertices_size_type size_type; + + // Vertex invariant requirement + function_requires< AdaptableUnaryFunctionConcept >(); + function_requires< AdaptableUnaryFunctionConcept >(); + + // Property map requirements + function_requires< ReadWritePropertyMapConcept >(); + typedef typename property_traits::value_type IsoMappingValue; + BOOST_STATIC_ASSERT((is_same::value)); + + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type IndexMap1Value; + BOOST_STATIC_ASSERT((is_convertible::value)); + + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type IndexMap2Value; + BOOST_STATIC_ASSERT((is_convertible::value)); + + if (num_vertices(G1) != num_vertices(G2)) + return false; + if (num_vertices(G1) == 0 && num_vertices(G2) == 0) + return true; + + detail::isomorphism_algo + algo(G1, G2, f, invariant1, invariant2, max_invariant, + index_map1, index_map2); + return algo.test_isomorphism(); + } + + + namespace detail { + + template + bool isomorphism_impl(const Graph1& G1, const Graph2& G2, + IsoMapping f, IndexMap1 index_map1, IndexMap2 index_map2, + const bgl_named_params& params) + { + std::vector in_degree1_vec(num_vertices(G1)); + typedef safe_iterator_property_map::iterator, + IndexMap1 +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + , std::size_t, std::size_t& +#endif /* BOOST_NO_STD_ITERATOR_TRAITS */ + > InDeg1; + InDeg1 in_degree1(in_degree1_vec.begin(), in_degree1_vec.size(), index_map1); + compute_in_degree(G1, in_degree1); + + std::vector in_degree2_vec(num_vertices(G2)); + typedef safe_iterator_property_map::iterator, + IndexMap2 +#ifdef BOOST_NO_STD_ITERATOR_TRAITS + , std::size_t, std::size_t& +#endif /* BOOST_NO_STD_ITERATOR_TRAITS */ + > InDeg2; + InDeg2 in_degree2(in_degree2_vec.begin(), in_degree2_vec.size(), index_map2); + compute_in_degree(G2, in_degree2); + + degree_vertex_invariant invariant1(in_degree1, G1); + degree_vertex_invariant invariant2(in_degree2, G2); + + return isomorphism(G1, G2, f, + choose_param(get_param(params, vertex_invariant1_t()), invariant1), + choose_param(get_param(params, vertex_invariant2_t()), invariant2), + choose_param(get_param(params, vertex_max_invariant_t()), (invariant2.max)()), + index_map1, index_map2 + ); + } + + } // namespace detail + + + // Named parameter interface + template + bool isomorphism(const Graph1& g1, + const Graph2& g2, + const bgl_named_params& params) + { + typedef typename graph_traits::vertex_descriptor vertex2_t; + typename std::vector::size_type n = num_vertices(g1); + std::vector f(n); + return detail::isomorphism_impl + (g1, g2, + choose_param(get_param(params, vertex_isomorphism_t()), + make_safe_iterator_property_map(f.begin(), f.size(), + choose_const_pmap(get_param(params, vertex_index1), + g1, vertex_index), vertex2_t())), + choose_const_pmap(get_param(params, vertex_index1), g1, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), g2, vertex_index), + params + ); + } + + // All defaults interface + template + bool isomorphism(const Graph1& g1, const Graph2& g2) + { + return isomorphism(g1, g2, + bgl_named_params(0));// bogus named param + } + + + // Verify that the given mapping iso_map from the vertices of g1 to the + // vertices of g2 describes an isomorphism. + // Note: this could be made much faster by specializing based on the graph + // concepts modeled, but since we're verifying an O(n^(lg n)) algorithm, + // O(n^4) won't hurt us. + template + inline bool verify_isomorphism(const Graph1& g1, const Graph2& g2, IsoMap iso_map) + { +#if 0 + // problematic for filtered_graph! + if (num_vertices(g1) != num_vertices(g2) || num_edges(g1) != num_edges(g2)) + return false; +#endif + + for (typename graph_traits::edge_iterator e1 = edges(g1).first; + e1 != edges(g1).second; ++e1) { + bool found_edge = false; + for (typename graph_traits::edge_iterator e2 = edges(g2).first; + e2 != edges(g2).second && !found_edge; ++e2) { + if (source(*e2, g2) == get(iso_map, source(*e1, g1)) && + target(*e2, g2) == get(iso_map, target(*e1, g1))) { + found_edge = true; + } + } + + if (!found_edge) + return false; + } + + return true; + } + +} // namespace boost + +#ifdef BOOST_ISO_INCLUDED_ITER_MACROS +#undef BOOST_ISO_INCLUDED_ITER_MACROS +#include +#endif + +#endif // BOOST_GRAPH_ISOMORPHISM_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/iteration_macros.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/iteration_macros.hpp new file mode 100644 index 0000000000..850e887518 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/iteration_macros.hpp @@ -0,0 +1,129 @@ +//======================================================================= +// Copyright 2001 Indiana University +// Author: Jeremy G. Siek +// +// 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_GRAPH_ITERATION_MACROS_HPP +#define BOOST_GRAPH_ITERATION_MACROS_HPP + +#define BGL_CAT(x,y) x ## y +#define BGL_FIRST(linenum) BGL_CAT(bgl_first_,linenum) +#define BGL_LAST(linenum) BGL_CAT(bgl_last_,linenum) + +/* + BGL_FORALL_VERTICES_T(v, g, graph_t) // This is on line 9 + expands to the following, but all on the same line + + for (typename boost::graph_traits::vertex_iterator + bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second; + bgl_first_9 != bgl_last_9; bgl_first_9 = bgl_last_9) + for (typename boost::graph_traits::vertex_descriptor v; + bgl_first_9 != bgl_last ? (v = *bgl_first_9, true) : false; + ++bgl_first_9) + + The purpose of having two for-loops is just to provide a place to + declare both the iterator and value variables. There is really only + one loop. The stopping condition gets executed two more times than it + usually would be, oh well. The reason for the bgl_first_9 = bgl_last_9 + in the outer for-loop is in case the user puts a break statement + in the inner for-loop. + + The other macros work in a similar fashion. + + Use the _T versions when the graph type is a template parameter or + dependent on a template parameter. Otherwise use the non _T versions. + + */ + + +#define BGL_FORALL_VERTICES_T(VNAME, GNAME, GraphType) \ +for (typename boost::graph_traits::vertex_iterator \ + BGL_FIRST(__LINE__) = vertices(GNAME).first, BGL_LAST(__LINE__) = vertices(GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ + for (typename boost::graph_traits::vertex_descriptor VNAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true):false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_VERTICES(VNAME, GNAME, GraphType) \ +for (boost::graph_traits::vertex_iterator \ + BGL_FIRST(__LINE__) = vertices(GNAME).first, BGL_LAST(__LINE__) = vertices(GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ + for (boost::graph_traits::vertex_descriptor VNAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true):false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_EDGES_T(ENAME, GNAME, GraphType) \ +for (typename boost::graph_traits::edge_iterator \ + BGL_FIRST(__LINE__) = edges(GNAME).first, BGL_LAST(__LINE__) = edges(GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ + for (typename boost::graph_traits::edge_descriptor ENAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true):false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_EDGES(ENAME, GNAME, GraphType) \ +for (boost::graph_traits::edge_iterator \ + BGL_FIRST(__LINE__) = edges(GNAME).first, BGL_LAST(__LINE__) = edges(GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ + for (boost::graph_traits::edge_descriptor ENAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true):false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_ADJ_T(UNAME, VNAME, GNAME, GraphType) \ +for (typename boost::graph_traits::adjacency_iterator \ + BGL_FIRST(__LINE__) = adjacent_vertices(UNAME, GNAME).first,\ + BGL_LAST(__LINE__) = adjacent_vertices(UNAME, GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ +for (typename boost::graph_traits::vertex_descriptor VNAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true) : false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_ADJ(UNAME, VNAME, GNAME, GraphType) \ +for (boost::graph_traits::adjacency_iterator \ + BGL_FIRST(__LINE__) = adjacent_vertices(UNAME, GNAME).first,\ + BGL_LAST(__LINE__) = adjacent_vertices(UNAME, GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ +for (boost::graph_traits::vertex_descriptor VNAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true) : false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_OUTEDGES_T(UNAME, ENAME, GNAME, GraphType) \ +for (typename boost::graph_traits::out_edge_iterator \ + BGL_FIRST(__LINE__) = out_edges(UNAME, GNAME).first,\ + BGL_LAST(__LINE__) = out_edges(UNAME, GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ +for (typename boost::graph_traits::edge_descriptor ENAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_OUTEDGES(UNAME, ENAME, GNAME, GraphType) \ +for (boost::graph_traits::out_edge_iterator \ + BGL_FIRST(__LINE__) = out_edges(UNAME, GNAME).first,\ + BGL_LAST(__LINE__) = out_edges(UNAME, GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ +for (boost::graph_traits::edge_descriptor ENAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_INEDGES_T(UNAME, ENAME, GNAME, GraphType) \ +for (typename boost::graph_traits::in_edge_iterator \ + BGL_FIRST(__LINE__) = in_edges(UNAME, GNAME).first,\ + BGL_LAST(__LINE__) = in_edges(UNAME, GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ +for (typename boost::graph_traits::edge_descriptor ENAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ + ++BGL_FIRST(__LINE__)) + +#define BGL_FORALL_INEDGES(UNAME, ENAME, GNAME, GraphType) \ +for (boost::graph_traits::in_edge_iterator \ + BGL_FIRST(__LINE__) = in_edges(UNAME, GNAME).first,\ + BGL_LAST(__LINE__) = in_edges(UNAME, GNAME).second; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ +for (boost::graph_traits::edge_descriptor ENAME; \ + BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ + ++BGL_FIRST(__LINE__)) + +#endif // BOOST_GRAPH_ITERATION_MACROS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/iteration_macros_undef.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/iteration_macros_undef.hpp new file mode 100644 index 0000000000..0b3f4174df --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/iteration_macros_undef.hpp @@ -0,0 +1,22 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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) +//======================================================================= + +#ifdef BOOST_GRAPH_ITERATION_MACROS_HPP + +#undef BOOST_GRAPH_ITERATION_MACROS_HPP +#undef BGL_CAT +#undef BGL_FIRST +#undef BGL_LAST +#undef BGL_FORALL_VERTICES +#undef BGL_FORALL_EDGES +#undef BGL_FORALL_ADJACENT +#undef BGL_FORALL_OUTEDGES +#undef BGL_FORALL_INEDGES + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/johnson_all_pairs_shortest.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/johnson_all_pairs_shortest.hpp new file mode 100644 index 0000000000..45a8cf2c95 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/johnson_all_pairs_shortest.hpp @@ -0,0 +1,205 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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 file implements the function + + template + bool + johnson_all_pairs_shortest_paths + (VertexAndEdgeListGraph& g, + DistanceMatrix& D, + const bgl_named_params& params) + */ + +#ifndef BOOST_GRAPH_JOHNSON_HPP +#define BOOST_GRAPH_JOHNSON_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + bool + johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1, + DistanceMatrix& D, + VertexID id1, Weight w1, const BinaryPredicate& compare, + const BinaryFunction& combine, const Infinity& inf, + DistanceZero zero) + { + typedef graph_traits Traits1; + typedef typename property_traits::value_type DT; + function_requires< BasicMatrixConcept >(); + + typedef typename Traits1::directed_category DirCat; + bool is_undirected = is_same::value; + + typedef adjacency_list, + property< edge_weight_t, DT, + property< edge_weight2_t, DT > > > Graph2; + typedef graph_traits Traits2; + + Graph2 g2(num_vertices(g1) + 1); + typename property_map::type + w = get(edge_weight, g2); + typename property_map::type + w_hat = get(edge_weight2, g2); + typename property_map::type + d = get(vertex_distance, g2); + typedef typename property_map::type VertexID2; + VertexID2 id2 = get(vertex_index, g2); + + // Construct g2 where V[g2] = V[g1] U {s} + // and E[g2] = E[g1] U {(s,v)| v in V[g1]} + std::vector + verts1(num_vertices(g1) + 1); + typename Traits2::vertex_descriptor s = *vertices(g2).first; + { + typename Traits1::vertex_iterator v, v_end; + int i = 1; + for (tie(v, v_end) = vertices(g1); v != v_end; ++v, ++i) { + typename Traits2::edge_descriptor e; bool z; + tie(e, z) = add_edge(s, get(id1, *v) + 1, g2); + put(w, e, zero); + verts1[i] = *v; + } + typename Traits1::edge_iterator e, e_end; + for (tie(e, e_end) = edges(g1); e != e_end; ++e) { + typename Traits2::edge_descriptor e2; bool z; + tie(e2, z) = add_edge(get(id1, source(*e, g1)) + 1, + get(id1, target(*e, g1)) + 1, g2); + put(w, e2, get(w1, *e)); + if (is_undirected) { + tie(e2, z) = add_edge(get(id1, target(*e, g1)) + 1, + get(id1, source(*e, g1)) + 1, g2); + put(w, e2, get(w1, *e)); + } + } + } + typename Traits2::vertex_iterator v, v_end, u, u_end; + typename Traits2::edge_iterator e, e_end; + std::vector

h_vec(num_vertices(g2)); + typedef typename std::vector
::iterator iter_t; + iterator_property_map h(h_vec.begin(), id2); + + for (tie(v, v_end) = vertices(g2); v != v_end; ++v) + d[*v] = inf; + + put(d, s, zero); + // Using the non-named parameter versions of bellman_ford and + // dijkstra for portability reasons. + dummy_property_map pred; bellman_visitor<> bvis; + if (bellman_ford_shortest_paths + (g2, num_vertices(g2), w, pred, d, combine, compare, bvis)) { + for (tie(v, v_end) = vertices(g2); v != v_end; ++v) + put(h, *v, get(d, *v)); + // Reweight the edges to remove negatives + for (tie(e, e_end) = edges(g2); e != e_end; ++e) { + typename Traits2::vertex_descriptor a = source(*e, g2), + b = target(*e, g2); + put(w_hat, *e, get(w, *e) + get(h, a) - get(h, b)); + } + for (tie(u, u_end) = vertices(g2); u != u_end; ++u) { + dijkstra_visitor<> dvis; + dijkstra_shortest_paths + (g2, *u, pred, d, w_hat, id2, compare, combine, inf, zero,dvis); + for (tie(v, v_end) = vertices(g2); v != v_end; ++v) { + if (*u != s && *v != s) { + typename Traits1::vertex_descriptor u1, v1; + u1 = verts1[id2[*u]]; v1 = verts1[id2[*v]]; + D[id2[*u]-1][id2[*v]-1] = get(d, *v) + get(h, *v) - get(h, *u); + } + } + } + return true; + } else + return false; + } + + template + bool + johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1, + DistanceMatrix& D, + VertexID id1, Weight w1, DistanceZero zero) + { + typedef typename property_traits::value_type WT; + return johnson_all_pairs_shortest_paths(g1, D, id1, w1, + std::less(), + closed_plus(), + (std::numeric_limits::max)(), + zero); + } + + namespace detail { + + template + bool + johnson_dispatch(VertexAndEdgeListGraph& g, + DistanceMatrix& D, + const bgl_named_params& params, + Weight w, VertexID id) + { + typedef typename property_traits::value_type WT; + + return johnson_all_pairs_shortest_paths + (g, D, id, w, + choose_param(get_param(params, distance_compare_t()), + std::less()), + choose_param(get_param(params, distance_combine_t()), + closed_plus()), + choose_param(get_param(params, distance_inf_t()), + std::numeric_limits::max BOOST_PREVENT_MACRO_SUBSTITUTION()), + choose_param(get_param(params, distance_zero_t()), WT()) ); + } + + } // namespace detail + + template + bool + johnson_all_pairs_shortest_paths + (VertexAndEdgeListGraph& g, + DistanceMatrix& D, + const bgl_named_params& params) + { + return detail::johnson_dispatch + (g, D, params, + choose_const_pmap(get_param(params, edge_weight), g, edge_weight), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index) + ); + } + + template + bool + johnson_all_pairs_shortest_paths + (VertexAndEdgeListGraph& g, DistanceMatrix& D) + { + bgl_named_params params(1); + return detail::johnson_dispatch + (g, D, params, get(edge_weight, g), get(vertex_index, g)); + } + +} // namespace boost + +#endif // BOOST_GRAPH_JOHNSON_HPP + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/kamada_kawai_spring_layout.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/kamada_kawai_spring_layout.hpp new file mode 100644 index 0000000000..00dbcb76ea --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/kamada_kawai_spring_layout.hpp @@ -0,0 +1,542 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_KAMADA_KAWAI_SPRING_LAYOUT_HPP +#define BOOST_GRAPH_KAMADA_KAWAI_SPRING_LAYOUT_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + namespace detail { namespace graph { + /** + * Denotes an edge or display area side length used to scale a + * Kamada-Kawai drawing. + */ + template + struct edge_or_side + { + explicit edge_or_side(T value) : value(value) {} + + T value; + }; + + /** + * Compute the edge length from an edge length. This is trivial. + */ + template + T compute_edge_length(const Graph&, DistanceMap, IndexMap, + edge_or_side length) + { return length.value; } + + /** + * Compute the edge length based on the display area side + length. We do this by dividing the side length by the largest + shortest distance between any two vertices in the graph. + */ + template + T + compute_edge_length(const Graph& g, DistanceMap distance, IndexMap index, + edge_or_side length) + { + T result(0); + + typedef typename graph_traits::vertex_iterator vertex_iterator; + + for (vertex_iterator ui = vertices(g).first, end = vertices(g).second; + ui != end; ++ui) { + vertex_iterator vi = ui; + for (++vi; vi != end; ++vi) { + T dij = distance[get(index, *ui)][get(index, *vi)]; + if (dij > result) result = dij; + } + } + return length.value / result; + } + + /** + * Implementation of the Kamada-Kawai spring layout algorithm. + */ + template + struct kamada_kawai_spring_layout_impl + { + typedef typename property_traits::value_type weight_type; + typedef std::pair deriv_type; + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + + kamada_kawai_spring_layout_impl( + const Graph& g, + PositionMap position, + WeightMap weight, + EdgeOrSideLength edge_or_side_length, + Done done, + weight_type spring_constant, + VertexIndexMap index, + DistanceMatrix distance, + SpringStrengthMatrix spring_strength, + PartialDerivativeMap partial_derivatives) + : g(g), position(position), weight(weight), + edge_or_side_length(edge_or_side_length), done(done), + spring_constant(spring_constant), index(index), distance(distance), + spring_strength(spring_strength), + partial_derivatives(partial_derivatives) {} + + // Compute contribution of vertex i to the first partial + // derivatives (dE/dx_m, dE/dy_m) (for vertex m) + deriv_type + compute_partial_derivative(vertex_descriptor m, vertex_descriptor i) + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + + deriv_type result(0, 0); + if (i != m) { + weight_type x_diff = position[m].x - position[i].x; + weight_type y_diff = position[m].y - position[i].y; + weight_type dist = sqrt(x_diff * x_diff + y_diff * y_diff); + result.first = spring_strength[get(index, m)][get(index, i)] + * (x_diff - distance[get(index, m)][get(index, i)]*x_diff/dist); + result.second = spring_strength[get(index, m)][get(index, i)] + * (y_diff - distance[get(index, m)][get(index, i)]*y_diff/dist); + } + + return result; + } + + // Compute partial derivatives dE/dx_m and dE/dy_m + deriv_type + compute_partial_derivatives(vertex_descriptor m) + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + + deriv_type result(0, 0); + + // TBD: looks like an accumulate to me + std::pair verts = vertices(g); + for (/* no init */; verts.first != verts.second; ++verts.first) { + vertex_descriptor i = *verts.first; + deriv_type deriv = compute_partial_derivative(m, i); + result.first += deriv.first; + result.second += deriv.second; + } + + return result; + } + + // The actual Kamada-Kawai spring layout algorithm implementation + bool run() + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + + // Compute d_{ij} and place it in the distance matrix + if (!johnson_all_pairs_shortest_paths(g, distance, index, weight, + weight_type(0))) + return false; + + // Compute L based on side length (if needed), or retrieve L + weight_type edge_length = + detail::graph::compute_edge_length(g, distance, index, + edge_or_side_length); + + // Compute l_{ij} and k_{ij} + const weight_type K = spring_constant; + vertex_iterator ui, end = vertices(g).second; + for (ui = vertices(g).first; ui != end; ++ui) { + vertex_iterator vi = ui; + for (++vi; vi != end; ++vi) { + weight_type dij = distance[get(index, *ui)][get(index, *vi)]; + if (dij == (std::numeric_limits::max)()) + return false; + distance[get(index, *ui)][get(index, *vi)] = edge_length * dij; + distance[get(index, *vi)][get(index, *ui)] = edge_length * dij; + spring_strength[get(index, *ui)][get(index, *vi)] = K/(dij*dij); + spring_strength[get(index, *vi)][get(index, *ui)] = K/(dij*dij); + } + } + + // Compute Delta_i and find max + vertex_descriptor p = *vertices(g).first; + weight_type delta_p(0); + + for (ui = vertices(g).first; ui != end; ++ui) { + deriv_type deriv = compute_partial_derivatives(*ui); + put(partial_derivatives, *ui, deriv); + + weight_type delta = + sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + + if (delta > delta_p) { + p = *ui; + delta_p = delta; + } + } + + while (!done(delta_p, p, g, true)) { + // The contribution p makes to the partial derivatives of + // each vertex. Computing this (at O(n) cost) allows us to + // update the delta_i values in O(n) time instead of O(n^2) + // time. + std::vector p_partials(num_vertices(g)); + for (ui = vertices(g).first; ui != end; ++ui) { + vertex_descriptor i = *ui; + p_partials[get(index, i)] = compute_partial_derivative(i, p); + } + + do { + // Compute the 4 elements of the Jacobian + weight_type dE_dx_dx = 0, dE_dx_dy = 0, dE_dy_dx = 0, dE_dy_dy = 0; + for (ui = vertices(g).first; ui != end; ++ui) { + vertex_descriptor i = *ui; + if (i != p) { + weight_type x_diff = position[p].x - position[i].x; + weight_type y_diff = position[p].y - position[i].y; + weight_type dist = sqrt(x_diff * x_diff + y_diff * y_diff); + weight_type dist_cubed = dist * dist * dist; + weight_type k_mi = spring_strength[get(index,p)][get(index,i)]; + weight_type l_mi = distance[get(index, p)][get(index, i)]; + dE_dx_dx += k_mi * (1 - (l_mi * y_diff * y_diff)/dist_cubed); + dE_dx_dy += k_mi * l_mi * x_diff * y_diff / dist_cubed; + dE_dy_dx += k_mi * l_mi * x_diff * y_diff / dist_cubed; + dE_dy_dy += k_mi * (1 - (l_mi * x_diff * x_diff)/dist_cubed); + } + } + + // Solve for delta_x and delta_y + weight_type dE_dx = get(partial_derivatives, p).first; + weight_type dE_dy = get(partial_derivatives, p).second; + + weight_type delta_x = + (dE_dx_dy * dE_dy - dE_dy_dy * dE_dx) + / (dE_dx_dx * dE_dy_dy - dE_dx_dy * dE_dy_dx); + + weight_type delta_y = + (dE_dx_dx * dE_dy - dE_dy_dx * dE_dx) + / (dE_dy_dx * dE_dx_dy - dE_dx_dx * dE_dy_dy); + + + // Move p by (delta_x, delta_y) + position[p].x += delta_x; + position[p].y += delta_y; + + // Recompute partial derivatives and delta_p + deriv_type deriv = compute_partial_derivatives(p); + put(partial_derivatives, p, deriv); + + delta_p = + sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + } while (!done(delta_p, p, g, false)); + + // Select new p by updating each partial derivative and delta + vertex_descriptor old_p = p; + for (ui = vertices(g).first; ui != end; ++ui) { + deriv_type old_deriv_p = p_partials[get(index, *ui)]; + deriv_type old_p_partial = + compute_partial_derivative(*ui, old_p); + deriv_type deriv = get(partial_derivatives, *ui); + + deriv.first += old_p_partial.first - old_deriv_p.first; + deriv.second += old_p_partial.second - old_deriv_p.second; + + put(partial_derivatives, *ui, deriv); + weight_type delta = + sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + + if (delta > delta_p) { + p = *ui; + delta_p = delta; + } + } + } + + return true; + } + + const Graph& g; + PositionMap position; + WeightMap weight; + EdgeOrSideLength edge_or_side_length; + Done done; + weight_type spring_constant; + VertexIndexMap index; + DistanceMatrix distance; + SpringStrengthMatrix spring_strength; + PartialDerivativeMap partial_derivatives; + }; + } } // end namespace detail::graph + + /// States that the given quantity is an edge length. + template + inline detail::graph::edge_or_side + edge_length(T x) + { return detail::graph::edge_or_side(x); } + + /// States that the given quantity is a display area side length. + template + inline detail::graph::edge_or_side + side_length(T x) + { return detail::graph::edge_or_side(x); } + + /** + * \brief Determines when to terminate layout of a particular graph based + * on a given relative tolerance. + */ + template + struct layout_tolerance + { + layout_tolerance(const T& tolerance = T(0.001)) + : tolerance(tolerance), last_energy((std::numeric_limits::max)()), + last_local_energy((std::numeric_limits::max)()) { } + + template + bool + operator()(T delta_p, + typename boost::graph_traits::vertex_descriptor p, + const Graph& g, + bool global) + { + if (global) { + if (last_energy == (std::numeric_limits::max)()) { + last_energy = delta_p; + return false; + } + + T diff = last_energy - delta_p; + if (diff < T(0)) diff = -diff; + bool done = (delta_p == T(0) || diff / last_energy < tolerance); + last_energy = delta_p; + return done; + } else { + if (last_local_energy == (std::numeric_limits::max)()) { + last_local_energy = delta_p; + return delta_p == T(0); + } + + T diff = last_local_energy - delta_p; + bool done = (delta_p == T(0) || (diff / last_local_energy) < tolerance); + last_local_energy = delta_p; + return done; + } + } + + private: + T tolerance; + T last_energy; + T last_local_energy; + }; + + /** \brief Kamada-Kawai spring layout for undirected graphs. + * + * This algorithm performs graph layout (in two dimensions) for + * connected, undirected graphs. It operates by relating the layout + * of graphs to a dynamic spring system and minimizing the energy + * within that system. The strength of a spring between two vertices + * is inversely proportional to the square of the shortest distance + * (in graph terms) between those two vertices. Essentially, + * vertices that are closer in the graph-theoretic sense (i.e., by + * following edges) will have stronger springs and will therefore be + * placed closer together. + * + * Prior to invoking this algorithm, it is recommended that the + * vertices be placed along the vertices of a regular n-sided + * polygon. + * + * \param g (IN) must be a model of Vertex List Graph, Edge List + * Graph, and Incidence Graph and must be undirected. + * + * \param position (OUT) must be a model of Lvalue Property Map, + * where the value type is a class containing fields @c x and @c y + * that will be set to the @c x and @c y coordinates of each vertex. + * + * \param weight (IN) must be a model of Readable Property Map, + * which provides the weight of each edge in the graph @p g. + * + * \param edge_or_side_length (IN) provides either the unit length + * @c e of an edge in the layout or the length of a side @c s of the + * display area, and must be either @c boost::edge_length(e) or @c + * boost::side_length(s), respectively. + * + * \param done (IN) is a 4-argument function object that is passed + * the current value of delta_p (i.e., the energy of vertex @p p), + * the vertex @p p, the graph @p g, and a boolean flag indicating + * whether @p delta_p is the maximum energy in the system (when @c + * true) or the energy of the vertex being moved. Defaults to @c + * layout_tolerance instantiated over the value type of the weight + * map. + * + * \param spring_constant (IN) is the constant multiplied by each + * spring's strength. Larger values create systems with more energy + * that can take longer to stabilize; smaller values create systems + * with less energy that stabilize quickly but do not necessarily + * result in pleasing layouts. The default value is 1. + * + * \param index (IN) is a mapping from vertices to index values + * between 0 and @c num_vertices(g). The default is @c + * get(vertex_index,g). + * + * \param distance (UTIL/OUT) will be used to store the distance + * from every vertex to every other vertex, which is computed in the + * first stages of the algorithm. This value's type must be a model + * of BasicMatrix with value type equal to the value type of the + * weight map. The default is a a vector of vectors. + * + * \param spring_strength (UTIL/OUT) will be used to store the + * strength of the spring between every pair of vertices. This + * value's type must be a model of BasicMatrix with value type equal + * to the value type of the weight map. The default is a a vector of + * vectors. + * + * \param partial_derivatives (UTIL) will be used to store the + * partial derivates of each vertex with respect to the @c x and @c + * y coordinates. This must be a Read/Write Property Map whose value + * type is a pair with both types equivalent to the value type of + * the weight map. The default is an iterator property map. + * + * \returns @c true if layout was successful or @c false if a + * negative weight cycle was detected. + */ + template + bool + kamada_kawai_spring_layout( + const Graph& g, + PositionMap position, + WeightMap weight, + detail::graph::edge_or_side edge_or_side_length, + Done done, + typename property_traits::value_type spring_constant, + VertexIndexMap index, + DistanceMatrix distance, + SpringStrengthMatrix spring_strength, + PartialDerivativeMap partial_derivatives) + { + BOOST_STATIC_ASSERT((is_convertible< + typename graph_traits::directed_category*, + undirected_tag* + >::value)); + + detail::graph::kamada_kawai_spring_layout_impl< + Graph, PositionMap, WeightMap, + detail::graph::edge_or_side, Done, VertexIndexMap, + DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap> + alg(g, position, weight, edge_or_side_length, done, spring_constant, + index, distance, spring_strength, partial_derivatives); + return alg.run(); + } + + /** + * \overload + */ + template + bool + kamada_kawai_spring_layout( + const Graph& g, + PositionMap position, + WeightMap weight, + detail::graph::edge_or_side edge_or_side_length, + Done done, + typename property_traits::value_type spring_constant, + VertexIndexMap index) + { + typedef typename property_traits::value_type weight_type; + + typename graph_traits::vertices_size_type n = num_vertices(g); + typedef std::vector weight_vec; + + std::vector distance(n, weight_vec(n)); + std::vector spring_strength(n, weight_vec(n)); + std::vector > partial_derivatives(n); + + return + kamada_kawai_spring_layout( + g, position, weight, edge_or_side_length, done, spring_constant, index, + distance.begin(), + spring_strength.begin(), + make_iterator_property_map(partial_derivatives.begin(), index, + std::pair())); + } + + /** + * \overload + */ + template + bool + kamada_kawai_spring_layout( + const Graph& g, + PositionMap position, + WeightMap weight, + detail::graph::edge_or_side edge_or_side_length, + Done done, + typename property_traits::value_type spring_constant) + { + return kamada_kawai_spring_layout(g, position, weight, edge_or_side_length, + done, spring_constant, + get(vertex_index, g)); + } + + /** + * \overload + */ + template + bool + kamada_kawai_spring_layout( + const Graph& g, + PositionMap position, + WeightMap weight, + detail::graph::edge_or_side edge_or_side_length, + Done done) + { + typedef typename property_traits::value_type weight_type; + return kamada_kawai_spring_layout(g, position, weight, edge_or_side_length, + done, weight_type(1)); + } + + /** + * \overload + */ + template + bool + kamada_kawai_spring_layout( + const Graph& g, + PositionMap position, + WeightMap weight, + detail::graph::edge_or_side edge_or_side_length) + { + typedef typename property_traits::value_type weight_type; + return kamada_kawai_spring_layout(g, position, weight, edge_or_side_length, + layout_tolerance(), + weight_type(1.0), + get(vertex_index, g)); + } +} // end namespace boost + +#endif // BOOST_GRAPH_KAMADA_KAWAI_SPRING_LAYOUT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/king_ordering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/king_ordering.hpp new file mode 100644 index 0000000000..dadd963f86 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/king_ordering.hpp @@ -0,0 +1,320 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2004, 2005 Trustees of Indiana University +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, +// Doug Gregor, D. Kevin McGrath +// +// 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_GRAPH_KING_HPP +#define BOOST_GRAPH_KING_HPP + +#include +#include + +/* + King Algorithm for matrix reordering +*/ + +namespace boost { + namespace detail { + template + class bfs_king_visitor:public default_bfs_visitor + { + public: + bfs_king_visitor(OutputIterator *iter, Buffer *b, Compare compare, + PseudoDegreeMap deg, std::vector loc, VecMap color, + VertexIndexMap vertices): + permutation(iter), Qptr(b), degree(deg), comp(compare), + Qlocation(loc), colors(color), vertex_map(vertices) { } + + template + void finish_vertex(Vertex, Graph& g) { + typename graph_traits::out_edge_iterator ei, ei_end; + Vertex v, w; + + typedef typename std::deque::iterator iterator; + typedef typename std::deque::reverse_iterator reverse_iterator; + + reverse_iterator rend = Qptr->rend()-index_begin; + reverse_iterator rbegin = Qptr->rbegin(); + + + //heap the vertices already there + std::make_heap(rbegin, rend, boost::bind(comp, _2, _1)); + + unsigned i = 0; + + for(i = index_begin; i != Qptr->size(); ++i){ + colors[get(vertex_map, (*Qptr)[i])] = 1; + Qlocation[get(vertex_map, (*Qptr)[i])] = i; + } + + i = 0; + + for( ; rbegin != rend; rend--){ + percolate_down(i); + w = (*Qptr)[index_begin+i]; + for (tie(ei, ei_end) = out_edges(w, g); ei != ei_end; ++ei) { + v = target(*ei, g); + put(degree, v, get(degree, v) - 1); + + if (colors[get(vertex_map, v)] == 1) { + percolate_up(get(vertex_map, v), i); + } + } + + colors[get(vertex_map, w)] = 0; + i++; + } + } + + template + void examine_vertex(Vertex u, const Graph&) { + + *(*permutation)++ = u; + index_begin = Qptr->size(); + + } + protected: + + + //this function replaces pop_heap, and tracks state information + template + void percolate_down(int offset){ + typedef typename std::deque::reverse_iterator reverse_iterator; + + int heap_last = index_begin + offset; + int heap_first = Qptr->size() - 1; + + //pop_heap functionality: + //swap first, last + std::swap((*Qptr)[heap_last], (*Qptr)[heap_first]); + + //swap in the location queue + std::swap(Qlocation[heap_first], Qlocation[heap_last]); + + //set drifter, children + int drifter = heap_first; + int drifter_heap = Qptr->size() - drifter; + + int right_child_heap = drifter_heap * 2 + 1; + int right_child = Qptr->size() - right_child_heap; + + int left_child_heap = drifter_heap * 2; + int left_child = Qptr->size() - left_child_heap; + + //check that we are staying in the heap + bool valid = (right_child < heap_last) ? false : true; + + //pick smallest child of drifter, and keep in mind there might only be left child + int smallest_child = (valid && get(degree, (*Qptr)[left_child]) > get(degree,(*Qptr)[right_child])) ? + right_child : left_child; + + while(valid && smallest_child < heap_last && comp((*Qptr)[drifter], (*Qptr)[smallest_child])){ + + //if smallest child smaller than drifter, swap them + std::swap((*Qptr)[smallest_child], (*Qptr)[drifter]); + std::swap(Qlocation[drifter], Qlocation[smallest_child]); + + //update the values, run again, as necessary + drifter = smallest_child; + drifter_heap = Qptr->size() - drifter; + + right_child_heap = drifter_heap * 2 + 1; + right_child = Qptr->size() - right_child_heap; + + left_child_heap = drifter_heap * 2; + left_child = Qptr->size() - left_child_heap; + + valid = (right_child < heap_last) ? false : true; + + smallest_child = (valid && get(degree, (*Qptr)[left_child]) > get(degree,(*Qptr)[right_child])) ? + right_child : left_child; + } + + } + + + + // this is like percolate down, but we always compare against the + // parent, as there is only a single choice + template + void percolate_up(int vertex, int offset){ + + int child_location = Qlocation[vertex]; + int heap_child_location = Qptr->size() - child_location; + int heap_parent_location = (int)(heap_child_location/2); + unsigned parent_location = Qptr->size() - heap_parent_location; + + bool valid = (heap_parent_location != 0 && child_location > index_begin + offset && + parent_location < Qptr->size()); + + while(valid && comp((*Qptr)[child_location], (*Qptr)[parent_location])){ + + //swap in the heap + std::swap((*Qptr)[child_location], (*Qptr)[parent_location]); + + //swap in the location queue + std::swap(Qlocation[child_location], Qlocation[parent_location]); + + child_location = parent_location; + heap_child_location = heap_parent_location; + heap_parent_location = (int)(heap_child_location/2); + parent_location = Qptr->size() - heap_parent_location; + valid = (heap_parent_location != 0 && child_location > index_begin + offset); + } + } + + OutputIterator *permutation; + int index_begin; + Buffer *Qptr; + PseudoDegreeMap degree; + Compare comp; + std::vector Qlocation; + VecMap colors; + VertexIndexMap vertex_map; + }; + + + } // namespace detail + + + template + OutputIterator + king_ordering(const Graph& g, + std::deque< typename graph_traits::vertex_descriptor > + vertex_queue, + OutputIterator permutation, + ColorMap color, DegreeMap degree, + VertexIndexMap index_map) + { + typedef typename property_traits::value_type ds_type; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef iterator_property_map::iterator, VertexIndexMap, ds_type, ds_type&> PseudoDegreeMap; + typedef indirect_cmp > Compare; + typedef typename boost::sparse::sparse_ordering_queue queue; + typedef typename detail::bfs_king_visitor, VertexIndexMap > Visitor; + typedef typename graph_traits::vertices_size_type + vertices_size_type; + std::vector pseudo_degree_vec(num_vertices(g)); + PseudoDegreeMap pseudo_degree(pseudo_degree_vec.begin(), index_map); + + typename graph_traits::vertex_iterator ui, ui_end; + queue Q; + // Copy degree to pseudo_degree + // initialize the color map + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui){ + put(pseudo_degree, *ui, get(degree, *ui)); + put(color, *ui, Color::white()); + } + + Compare comp(pseudo_degree); + std::vector colors(num_vertices(g)); + + for(vertices_size_type i = 0; i < num_vertices(g); i++) + colors[i] = 0; + + std::vector loc(num_vertices(g)); + + //create the visitor + Visitor vis(&permutation, &Q, comp, pseudo_degree, loc, colors, index_map); + + while( !vertex_queue.empty() ) { + Vertex s = vertex_queue.front(); + vertex_queue.pop_front(); + + //call BFS with visitor + breadth_first_visit(g, s, Q, vis, color); + } + + return permutation; + } + + + // This is the case where only a single starting vertex is supplied. + template + OutputIterator + king_ordering(const Graph& g, + typename graph_traits::vertex_descriptor s, + OutputIterator permutation, + ColorMap color, DegreeMap degree, VertexIndexMap index_map) + { + + std::deque< typename graph_traits::vertex_descriptor > vertex_queue; + vertex_queue.push_front( s ); + return king_ordering(g, vertex_queue, permutation, color, degree, + index_map); + } + + + template < class Graph, class OutputIterator, + class ColorMap, class DegreeMap, class VertexIndexMap> + OutputIterator + king_ordering(const Graph& G, OutputIterator permutation, + ColorMap color, DegreeMap degree, VertexIndexMap index_map) + { + if (vertices(G).first == vertices(G).second) + return permutation; + + typedef typename boost::graph_traits::vertex_descriptor Vertex; + typedef typename boost::graph_traits::vertex_iterator VerIter; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + std::deque vertex_queue; + + // Mark everything white + BGL_FORALL_VERTICES_T(v, G, Graph) put(color, v, Color::white()); + + // Find one vertex from each connected component + BGL_FORALL_VERTICES_T(v, G, Graph) { + if (get(color, v) == Color::white()) { + depth_first_visit(G, v, dfs_visitor<>(), color); + vertex_queue.push_back(v); + } + } + + // Find starting nodes for all vertices + // TBD: How to do this with a directed graph? + for (typename std::deque::iterator i = vertex_queue.begin(); + i != vertex_queue.end(); ++i) + *i = find_starting_node(G, *i, color, degree); + + return king_ordering(G, vertex_queue, permutation, color, degree, + index_map); + } + + template + OutputIterator + king_ordering(const Graph& G, OutputIterator permutation, + VertexIndexMap index_map) + { + if (vertices(G).first == vertices(G).second) + return permutation; + + typedef out_degree_property_map DegreeMap; + std::vector colors(num_vertices(G)); + return king_ordering(G, permutation, + make_iterator_property_map(&colors[0], index_map, + colors[0]), + make_out_degree_map(G), index_map); + } + + template + inline OutputIterator + king_ordering(const Graph& G, OutputIterator permutation) + { return king_ordering(G, permutation, get(vertex_index, G)); } + +} // namespace boost + + +#endif // BOOST_GRAPH_KING_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/kolmogorov_max_flow.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/kolmogorov_max_flow.hpp new file mode 100644 index 0000000000..e74796d34e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/kolmogorov_max_flow.hpp @@ -0,0 +1,807 @@ +// Copyright (c) 2006, Stephan Diederich +// +// This code may be used under either of the following two licences: +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. OF SUCH DAMAGE. +// +// Or: +// +// 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_KOLMOGOROV_MAX_FLOW_HPP +#define BOOST_KOLMOGOROV_MAX_FLOW_HPP + +#include +#include +#include +#include +#include +#include +#include // for std::min and std::max + +#include +#include +#include +#include +#include +#include + +namespace boost { + namespace detail { + + template + class kolmogorov{ + typedef typename property_traits::value_type tEdgeVal; + typedef graph_traits tGraphTraits; + typedef typename tGraphTraits::vertex_iterator vertex_iterator; + typedef typename tGraphTraits::vertex_descriptor vertex_descriptor; + typedef typename tGraphTraits::edge_descriptor edge_descriptor; + typedef typename tGraphTraits::edge_iterator edge_iterator; + typedef typename tGraphTraits::out_edge_iterator out_edge_iterator; + typedef boost::queue tQueue; //queue of vertices, used in adoption-stage + typedef typename property_traits::value_type tColorValue; + typedef color_traits tColorTraits; + typedef typename property_traits::value_type tDistanceVal; + + public: + kolmogorov(Graph& g, + EdgeCapacityMap cap, + ResidualCapacityEdgeMap res, + ReverseEdgeMap rev, + PredecessorMap pre, + ColorMap color, + DistanceMap dist, + IndexMap idx, + vertex_descriptor src, + vertex_descriptor sink): + m_g(g), + m_index_map(idx), + m_cap_map(cap), + m_res_cap_map(res), + m_rev_edge_map(rev), + m_pre_map(pre), + m_tree_map(color), + m_dist_map(dist), + m_source(src), + m_sink(sink), + m_active_nodes(), + m_in_active_list_vec(num_vertices(g), false), + m_in_active_list_map(make_iterator_property_map(m_in_active_list_vec.begin(), m_index_map)), + m_has_parent_vec(num_vertices(g), false), + m_has_parent_map(make_iterator_property_map(m_has_parent_vec.begin(), m_index_map)), + m_time_vec(num_vertices(g), 0), + m_time_map(make_iterator_property_map(m_time_vec.begin(), m_index_map)), + m_flow(0), + m_time(1), + m_last_grow_vertex(graph_traits::null_vertex()){ + // initialize the color-map with gray-values + vertex_iterator vi, v_end; + for(tie(vi, v_end) = vertices(m_g); vi != v_end; ++vi){ + set_tree(*vi, tColorTraits::gray()); + } + // Initialize flow to zero which means initializing + // the residual capacity equal to the capacity + edge_iterator ei, e_end; + for(tie(ei, e_end) = edges(m_g); ei != e_end; ++ei) { + m_res_cap_map[*ei] = m_cap_map[*ei]; + assert(m_rev_edge_map[m_rev_edge_map[*ei]] == *ei); //check if the reverse edge map is build up properly + } + //init the search trees with the two terminals + set_tree(m_source, tColorTraits::black()); + set_tree(m_sink, tColorTraits::white()); + m_time_map[m_source] = 1; + m_time_map[m_sink] = 1; + } + + ~kolmogorov(){} + + tEdgeVal max_flow(){ + //augment direct paths from SOURCE->SINK and SOURCE->VERTEX->SINK + augment_direct_paths(); + //start the main-loop + while(true){ + bool path_found; + edge_descriptor connecting_edge; + tie(connecting_edge, path_found) = grow(); //find a path from source to sink + if(!path_found){ + //we're finished, no more paths were found + break; + } + ++m_time; + augment(connecting_edge); //augment that path + adopt(); //rebuild search tree structure + } + return m_flow; + } + + //the complete class is protected, as we want access to members in derived test-class (see $(BOOST_ROOT)/libs/graph/test/kolmogorov_max_flow_test.cpp) + protected: + void augment_direct_paths(){ + //in a first step, we augment all direct paths from source->NODE->sink + //and additionally paths from source->sink + //this improves especially graphcuts for segmentation, as most of the nodes have source/sink connects + //but shouldn't have an impact on other maxflow problems (this is done in grow() anyway) + out_edge_iterator ei, e_end; + for(tie(ei, e_end) = out_edges(m_source, m_g); ei != e_end; ++ei){ + edge_descriptor from_source = *ei; + vertex_descriptor current_node = target(from_source, m_g); + if(current_node == m_sink){ + tEdgeVal cap = m_res_cap_map[from_source]; + m_res_cap_map[from_source] = 0; + m_flow += cap; + continue; + } + edge_descriptor to_sink; + bool is_there; + tie(to_sink, is_there) = edge(current_node, m_sink, m_g); + if(is_there){ + tEdgeVal cap_from_source = m_res_cap_map[from_source]; + tEdgeVal cap_to_sink = m_res_cap_map[to_sink]; + if(cap_from_source > cap_to_sink){ + set_tree(current_node, tColorTraits::black()); + add_active_node(current_node); + set_edge_to_parent(current_node, from_source); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + //add stuff to flow and update residuals + //we dont need to update reverse_edges, as incoming/outgoing edges to/from source/sink don't count for max-flow + m_res_cap_map[from_source] -= cap_to_sink; + m_res_cap_map[to_sink] = 0; + m_flow += cap_to_sink; + } else if(cap_to_sink > 0){ + set_tree(current_node, tColorTraits::white()); + add_active_node(current_node); + set_edge_to_parent(current_node, to_sink); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + //add stuff to flow and update residuals + //we dont need to update reverse_edges, as incoming/outgoing edges to/from source/sink don't count for max-flow + m_res_cap_map[to_sink] -= cap_from_source; + m_res_cap_map[from_source] = 0; + m_flow += cap_from_source; + } + } else if(m_res_cap_map[from_source]){ + //there is no sink connect, so we can't augment this path + //but to avoid adding m_source to the active nodes, we just activate this node and set the approciate things + set_tree(current_node, tColorTraits::black()); + set_edge_to_parent(current_node, from_source); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + add_active_node(current_node); + } + } + for(tie(ei, e_end) = out_edges(m_sink, m_g); ei != e_end; ++ei){ + edge_descriptor to_sink = m_rev_edge_map[*ei]; + vertex_descriptor current_node = source(to_sink, m_g); + if(m_res_cap_map[to_sink]){ + set_tree(current_node, tColorTraits::white()); + set_edge_to_parent(current_node, to_sink); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + add_active_node(current_node); + } + } + } + + /** + * returns a pair of an edge and a boolean. if the bool is true, the edge is a connection of a found path from s->t , read "the link" and + * source(returnVal, m_g) is the end of the path found in the source-tree + * target(returnVal, m_g) is the beginning of the path found in the sink-tree + */ + std::pair grow(){ + assert(m_orphans.empty()); + vertex_descriptor current_node; + while((current_node = get_next_active_node()) != graph_traits::null_vertex()){ //if there is one + assert(get_tree(current_node) != tColorTraits::gray() && (has_parent(current_node) || current_node==m_source || current_node==m_sink)); + if(get_tree(current_node) == tColorTraits::black()){ + //source tree growing + out_edge_iterator ei, e_end; + if(current_node != m_last_grow_vertex){ + m_last_grow_vertex = current_node; + tie(m_last_grow_edge_it, m_last_grow_edge_end) = out_edges(current_node, m_g); + } + for(; m_last_grow_edge_it != m_last_grow_edge_end; ++m_last_grow_edge_it){ + edge_descriptor out_edge = *m_last_grow_edge_it; + if(m_res_cap_map[out_edge] > 0){ //check if we have capacity left on this edge + vertex_descriptor other_node = target(out_edge, m_g); + if(get_tree(other_node) == tColorTraits::gray()){ //it's a free node + set_tree(other_node, tColorTraits::black()); //aquire other node to our search tree + set_edge_to_parent(other_node, out_edge); //set us as parent + m_dist_map[other_node] = m_dist_map[current_node] + 1; //and update the distance-heuristic + m_time_map[other_node] = m_time_map[current_node]; + add_active_node(other_node); + } else if(get_tree(other_node) == tColorTraits::black()){ + if(is_closer_to_terminal(current_node, other_node)){ //we do this to get shorter paths. check if we are nearer to the source as its parent is + set_edge_to_parent(other_node, out_edge); + m_dist_map[other_node] = m_dist_map[current_node] + 1; + m_time_map[other_node] = m_time_map[current_node]; + } + } else{ + assert(get_tree(other_node)==tColorTraits::white()); + //kewl, found a path from one to the other search tree, return the connecting edge in src->sink dir + return std::make_pair(out_edge, true); + } + } + } //for all out-edges + } //source-tree-growing + else{ + assert(get_tree(current_node) == tColorTraits::white()); + out_edge_iterator ei, e_end; + if(current_node != m_last_grow_vertex){ + m_last_grow_vertex = current_node; + tie(m_last_grow_edge_it, m_last_grow_edge_end) = out_edges(current_node, m_g); + } + for(; m_last_grow_edge_it != m_last_grow_edge_end; ++m_last_grow_edge_it){ + edge_descriptor in_edge = m_rev_edge_map[*m_last_grow_edge_it]; + if(m_res_cap_map[in_edge] > 0){ //check if there is capacity left + vertex_descriptor other_node = source(in_edge, m_g); + if(get_tree(other_node) == tColorTraits::gray()){ //it's a free node + set_tree(other_node, tColorTraits::white()); //aquire that node to our search tree + set_edge_to_parent(other_node, in_edge); //set us as parent + add_active_node(other_node); //activate that node + m_dist_map[other_node] = m_dist_map[current_node] + 1; //set its distance + m_time_map[other_node] = m_time_map[current_node]; //and time + } else if(get_tree(other_node) == tColorTraits::white()){ + if(is_closer_to_terminal(current_node, other_node)){ + //we are closer to the sink than its parent is, so we "adopt" him + set_edge_to_parent(other_node, in_edge); + m_dist_map[other_node] = m_dist_map[current_node] + 1; + m_time_map[other_node] = m_time_map[current_node]; + } + } else{ + assert(get_tree(other_node)==tColorTraits::black()); + //kewl, found a path from one to the other search tree, return the connecting edge in src->sink dir + return std::make_pair(in_edge, true); + } + } + } //for all out-edges + } //sink-tree growing + //all edges of that node are processed, and no more paths were found. so remove if from the front of the active queue + finish_node(current_node); + } //while active_nodes not empty + return std::make_pair(edge_descriptor(), false); //no active nodes anymore and no path found, we're done + } + + /** + * augments path from s->t and updates residual graph + * source(e, m_g) is the end of the path found in the source-tree + * target(e, m_g) is the beginning of the path found in the sink-tree + * this phase generates orphans on satured edges, if the attached verts are from different search-trees + * orphans are ordered in distance to sink/source. first the farest from the source are front_inserted into the orphans list, + * and after that the sink-tree-orphans are front_inserted. when going to adoption stage the orphans are popped_front, and so we process the nearest + * verts to the terminals first + */ + void augment(edge_descriptor e){ + assert(get_tree(target(e, m_g)) == tColorTraits::white()); + assert(get_tree(source(e, m_g)) == tColorTraits::black()); + assert(m_orphans.empty()); + + const tEdgeVal bottleneck = find_bottleneck(e); + //now we push the found flow through the path + //for each edge we saturate we have to look for the verts that belong to that edge, one of them becomes an orphans + //now process the connecting edge + m_res_cap_map[e] -= bottleneck; + assert(m_res_cap_map[e] >= 0); + m_res_cap_map[m_rev_edge_map[e]] += bottleneck; + + //now we follow the path back to the source + vertex_descriptor current_node = source(e, m_g); + while(current_node != m_source){ + edge_descriptor pred = get_edge_to_parent(current_node); + m_res_cap_map[pred] -= bottleneck; + assert(m_res_cap_map[pred] >= 0); + m_res_cap_map[m_rev_edge_map[pred]] += bottleneck; + if(m_res_cap_map[pred] == 0){ + set_no_parent(current_node); + m_orphans.push_front(current_node); + } + current_node = source(pred, m_g); + } + //then go forward in the sink-tree + current_node = target(e, m_g); + while(current_node != m_sink){ + edge_descriptor pred = get_edge_to_parent(current_node); + m_res_cap_map[pred] -= bottleneck; + assert(m_res_cap_map[pred] >= 0); + m_res_cap_map[m_rev_edge_map[pred]] += bottleneck; + if(m_res_cap_map[pred] == 0){ + set_no_parent(current_node); + m_orphans.push_front(current_node); + } + current_node = target(pred, m_g); + } + //and add it to the max-flow + m_flow += bottleneck; + } + + /** + * returns the bottleneck of a s->t path (end_of_path is last vertex in source-tree, begin_of_path is first vertex in sink-tree) + */ + inline tEdgeVal find_bottleneck(edge_descriptor e){ + BOOST_USING_STD_MIN(); + tEdgeVal minimum_cap = m_res_cap_map[e]; + vertex_descriptor current_node = source(e, m_g); + //first go back in the source tree + while(current_node != m_source){ + edge_descriptor pred = get_edge_to_parent(current_node); + minimum_cap = min BOOST_PREVENT_MACRO_SUBSTITUTION(minimum_cap, m_res_cap_map[pred]); + current_node = source(pred, m_g); + } + //then go forward in the sink-tree + current_node = target(e, m_g); + while(current_node != m_sink){ + edge_descriptor pred = get_edge_to_parent(current_node); + minimum_cap = min BOOST_PREVENT_MACRO_SUBSTITUTION(minimum_cap, m_res_cap_map[pred]); + current_node = target(pred, m_g); + } + return minimum_cap; + } + + /** + * rebuild search trees + * empty the queue of orphans, and find new parents for them or just drop them from the search trees + */ + void adopt(){ + while(!m_orphans.empty() || !m_child_orphans.empty()){ + vertex_descriptor current_node; + if(m_child_orphans.empty()){ + //get the next orphan from the main-queue and remove it + current_node = m_orphans.front(); + m_orphans.pop_front(); + } else{ + current_node = m_child_orphans.front(); + m_child_orphans.pop(); + } + if(get_tree(current_node) == tColorTraits::black()){ + //we're in the source-tree + tDistanceVal min_distance = (std::numeric_limits::max)(); + edge_descriptor new_parent_edge; + out_edge_iterator ei, e_end; + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + const edge_descriptor in_edge = m_rev_edge_map[*ei]; + assert(target(in_edge, m_g) == current_node); //we should be the target of this edge + if(m_res_cap_map[in_edge] > 0){ + vertex_descriptor other_node = source(in_edge, m_g); + if(get_tree(other_node) == tColorTraits::black() && has_source_connect(other_node)){ + if(m_dist_map[other_node] < min_distance){ + min_distance = m_dist_map[other_node]; + new_parent_edge = in_edge; + } + } + } + } + if(min_distance != (std::numeric_limits::max)()){ + set_edge_to_parent(current_node, new_parent_edge); + m_dist_map[current_node] = min_distance + 1; + m_time_map[current_node] = m_time; + } else{ + m_time_map[current_node] = 0; + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + edge_descriptor in_edge = m_rev_edge_map[*ei]; + vertex_descriptor other_node = source(in_edge, m_g); + if(get_tree(other_node) == tColorTraits::black() && has_parent(other_node)){ + if(m_res_cap_map[in_edge] > 0){ + add_active_node(other_node); + } + if(source(get_edge_to_parent(other_node), m_g) == current_node){ + //we are the parent of that node + //it has to find a new parent, too + set_no_parent(other_node); + m_child_orphans.push(other_node); + } + } + } + set_tree(current_node, tColorTraits::gray()); + } //no parent found + } //source-tree-adoption + else{ + //now we should be in the sink-tree, check that... + assert(get_tree(current_node) == tColorTraits::white()); + out_edge_iterator ei, e_end; + edge_descriptor new_parent_edge; + tDistanceVal min_distance = (std::numeric_limits::max)(); + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + const edge_descriptor out_edge = *ei; + if(m_res_cap_map[out_edge] > 0){ + const vertex_descriptor other_node = target(out_edge, m_g); + if(get_tree(other_node) == tColorTraits::white() && has_sink_connect(other_node)) + if(m_dist_map[other_node] < min_distance){ + min_distance = m_dist_map[other_node]; + new_parent_edge = out_edge; + } + } + } + if(min_distance != (std::numeric_limits::max)()){ + set_edge_to_parent(current_node, new_parent_edge); + m_dist_map[current_node] = min_distance + 1; + m_time_map[current_node] = m_time; + } else{ + m_time_map[current_node] = 0; + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + const edge_descriptor out_edge = *ei; + const vertex_descriptor other_node = target(out_edge, m_g); + if(get_tree(other_node) == tColorTraits::white() && has_parent(other_node)){ + if(m_res_cap_map[out_edge] > 0){ + add_active_node(other_node); + } + if(target(get_edge_to_parent(other_node), m_g) == current_node){ + //we were it's parent, so it has to find a new one, too + set_no_parent(other_node); + m_child_orphans.push(other_node); + } + } + } + set_tree(current_node, tColorTraits::gray()); + } //no parent found + } //sink-tree adoption + } //while !orphans.empty() + } //adopt + + /** + * return next active vertex if there is one, otherwise a null_vertex + */ + inline vertex_descriptor get_next_active_node(){ + while(true){ + if(m_active_nodes.empty()) + return graph_traits::null_vertex(); + vertex_descriptor v = m_active_nodes.front(); + + if(!has_parent(v) && v != m_source && v != m_sink){ //if it has no parent, this node can't be active(if its not source or sink) + m_active_nodes.pop(); + m_in_active_list_map[v] = false; + } else{ + assert(get_tree(v) == tColorTraits::black() || get_tree(v) == tColorTraits::white()); + return v; + } + } + } + + /** + * adds v as an active vertex, but only if its not in the list already + */ + inline void add_active_node(vertex_descriptor v){ + assert(get_tree(v) != tColorTraits::gray()); + if(m_in_active_list_map[v]){ + return; + } else{ + m_in_active_list_map[v] = true; + m_active_nodes.push(v); + } + } + + /** + * finish_node removes a node from the front of the active queue (its called in grow phase, if no more paths can be found using this node) + */ + inline void finish_node(vertex_descriptor v){ + assert(m_active_nodes.front() == v); + m_active_nodes.pop(); + m_in_active_list_map[v] = false; + m_last_grow_vertex = graph_traits::null_vertex(); + } + + /** + * removes a vertex from the queue of active nodes (actually this does nothing, + * but checks if this node has no parent edge, as this is the criteria for beeing no more active) + */ + inline void remove_active_node(vertex_descriptor v){ + assert(!has_parent(v)); + } + + /** + * returns the search tree of v; tColorValue::black() for source tree, white() for sink tree, gray() for no tree + */ + inline tColorValue get_tree(vertex_descriptor v) const { + return m_tree_map[v]; + } + + /** + * sets search tree of v; tColorValue::black() for source tree, white() for sink tree, gray() for no tree + */ + inline void set_tree(vertex_descriptor v, tColorValue t){ + m_tree_map[v] = t; + } + + /** + * returns edge to parent vertex of v; + */ + inline edge_descriptor get_edge_to_parent(vertex_descriptor v) const{ + return m_pre_map[v]; + } + + /** + * returns true if the edge stored in m_pre_map[v] is a valid entry + */ + inline bool has_parent(vertex_descriptor v) const{ + return m_has_parent_map[v]; + } + + /** + * sets edge to parent vertex of v; + */ + inline void set_edge_to_parent(vertex_descriptor v, edge_descriptor f_edge_to_parent){ + assert(m_res_cap_map[f_edge_to_parent] > 0); + m_pre_map[v] = f_edge_to_parent; + m_has_parent_map[v] = true; + } + + /** + * removes the edge to parent of v (this is done by invalidating the entry an additional map) + */ + inline void set_no_parent(vertex_descriptor v){ + m_has_parent_map[v] = false; + } + + /** + * checks if vertex v has a connect to the sink-vertex (@var m_sink) + * @param v the vertex which is checked + * @return true if a path to the sink was found, false if not + */ + inline bool has_sink_connect(vertex_descriptor v){ + tDistanceVal current_distance = 0; + vertex_descriptor current_vertex = v; + while(true){ + if(m_time_map[current_vertex] == m_time){ + //we found a node which was already checked this round. use it for distance calculations + current_distance += m_dist_map[current_vertex]; + break; + } + if(current_vertex == m_sink){ + m_time_map[m_sink] = m_time; + break; + } + if(has_parent(current_vertex)){ + //it has a parent, so get it + current_vertex = target(get_edge_to_parent(current_vertex), m_g); + ++current_distance; + } else{ + //no path found + return false; + } + } + current_vertex=v; + while(m_time_map[current_vertex] != m_time){ + m_dist_map[current_vertex] = current_distance--; + m_time_map[current_vertex] = m_time; + current_vertex = target(get_edge_to_parent(current_vertex), m_g); + } + return true; + } + + /** + * checks if vertex v has a connect to the source-vertex (@var m_source) + * @param v the vertex which is checked + * @return true if a path to the source was found, false if not + */ + inline bool has_source_connect(vertex_descriptor v){ + tDistanceVal current_distance = 0; + vertex_descriptor current_vertex = v; + while(true){ + if(m_time_map[current_vertex] == m_time){ + //we found a node which was already checked this round. use it for distance calculations + current_distance += m_dist_map[current_vertex]; + break; + } + if(current_vertex == m_source){ + m_time_map[m_source] = m_time; + break; + } + if(has_parent(current_vertex)){ + //it has a parent, so get it + current_vertex = source(get_edge_to_parent(current_vertex), m_g); + ++current_distance; + } else{ + //no path found + return false; + } + } + current_vertex=v; + while(m_time_map[current_vertex] != m_time){ + m_dist_map[current_vertex] = current_distance-- ; + m_time_map[current_vertex] = m_time; + current_vertex = source(get_edge_to_parent(current_vertex), m_g); + } + return true; + } + + /** + * returns true, if p is closer to a terminal than q + */ + inline bool is_closer_to_terminal(vertex_descriptor p, vertex_descriptor q){ + //checks the timestamps first, to build no cycles, and after that the real distance + return (m_time_map[q] <= m_time_map[p] && m_dist_map[q] > m_dist_map[p]+1); + } + + //////// + // member vars + //////// + Graph& m_g; + IndexMap m_index_map; + EdgeCapacityMap m_cap_map; + ResidualCapacityEdgeMap m_res_cap_map; + ReverseEdgeMap m_rev_edge_map; + PredecessorMap m_pre_map; //stores paths found in the growth stage + ColorMap m_tree_map; //maps each vertex into one of the two search tree or none (gray()) + DistanceMap m_dist_map; //stores distance to source/sink nodes + vertex_descriptor m_source; + vertex_descriptor m_sink; + + tQueue m_active_nodes; + std::vector m_in_active_list_vec; + iterator_property_map::iterator, IndexMap> m_in_active_list_map; + + std::list m_orphans; + tQueue m_child_orphans; // we use a second queuqe for child orphans, as they are FIFO processed + + std::vector m_has_parent_vec; + iterator_property_map::iterator, IndexMap> m_has_parent_map; + + std::vector m_time_vec; //timestamp of each node, used for sink/source-path calculations + iterator_property_map::iterator, IndexMap> m_time_map; + tEdgeVal m_flow; + long m_time; + vertex_descriptor m_last_grow_vertex; + out_edge_iterator m_last_grow_edge_it; + out_edge_iterator m_last_grow_edge_end; + }; + } //namespace detail + + /** + * non-named-parameter version, given everything + * this is the catch all version + */ + template + typename property_traits::value_type + kolmogorov_max_flow + (Graph& g, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res_cap, + ReverseEdgeMap rev_map, + PredecessorMap pre_map, + ColorMap color, + DistanceMap dist, + IndexMap idx, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink + ) + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + //as this method is the last one before we instantiate the solver, we do the concept checks here + function_requires >(); //to have vertices(), num_vertices(), + function_requires >(); //to have edges() + function_requires >(); //to have source(), target() and out_edges() + function_requires >(); //read flow-values from edges + function_requires >(); //write flow-values to residuals + function_requires >(); //read out reverse edges + function_requires >(); //store predecessor there + function_requires >(); //write corresponding tree + function_requires >(); //write distance to source/sink + function_requires >(); //get index 0...|V|-1 + assert(num_vertices(g) >= 2 && src != sink); + detail::kolmogorov + algo(g, cap, res_cap, rev_map, pre_map, color, dist, idx, src, sink); + return algo.max_flow(); + } + + /** + * non-named-parameter version, given: capacity, residucal_capacity, reverse_edges, and an index map. + */ + template + typename property_traits::value_type + kolmogorov_max_flow + (Graph& g, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res_cap, + ReverseEdgeMap rev, + IndexMap idx, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink) + { + typename graph_traits::vertices_size_type n_verts = num_vertices(g); + std::vector::edge_descriptor> predecessor_vec(n_verts); + std::vector color_vec(n_verts); + std::vector::vertices_size_type> distance_vec(n_verts); + return kolmogorov_max_flow + (g, cap, res_cap, rev, + make_iterator_property_map(predecessor_vec.begin(), idx), + make_iterator_property_map(color_vec.begin(), idx), + make_iterator_property_map(distance_vec.begin(), idx), + idx, src, sink); + } + + /** + * non-named-parameter version, some given: capacity, residual_capacity, reverse_edges, color_map and an index map. + * Use this if you are interested in the minimum cut, as the color map provides that info + */ + template + typename property_traits::value_type + kolmogorov_max_flow + (Graph& g, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res_cap, + ReverseEdgeMap rev, + ColorMap color, + IndexMap idx, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink) + { + typename graph_traits::vertices_size_type n_verts = num_vertices(g); + std::vector::edge_descriptor> predecessor_vec(n_verts); + std::vector::vertices_size_type> distance_vec(n_verts); + + return kolmogorov_max_flow + (g, cap, res_cap, rev, + make_iterator_property_map(predecessor_vec.begin(), idx), + color, + make_iterator_property_map(distance_vec.begin(), idx), + idx, src, sink); + } + + /** + * named-parameter version, some given + */ + template + typename property_traits::const_type>::value_type + kolmogorov_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + const bgl_named_params& params) + { + return kolmogorov_max_flow(g, + choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), + choose_pmap(get_param(params, edge_residual_capacity), g, edge_residual_capacity), + choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), + choose_pmap(get_param(params, vertex_predecessor), g, vertex_predecessor), + choose_pmap(get_param(params, vertex_color), g, vertex_color), + choose_pmap(get_param(params, vertex_distance), g, vertex_distance), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + src, sink); + } + + /** + * named-parameter version, none given + */ + template + typename property_traits::const_type>::value_type + kolmogorov_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink) + { + bgl_named_params params(0); // bogus empty param + return kolmogorov_max_flow(g, src, sink, params); + } +} // namespace boost + +#endif // BOOST_KOLMOGOROV_MAX_FLOW_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/kruskal_min_spanning_tree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/kruskal_min_spanning_tree.hpp new file mode 100644 index 0000000000..50fc8049f8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/kruskal_min_spanning_tree.hpp @@ -0,0 +1,155 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_MST_KRUSKAL_HPP +#define BOOST_GRAPH_MST_KRUSKAL_HPP + +/* + *Minimum Spanning Tree + * Kruskal Algorithm + * + *Requirement: + * undirected graph + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + + +namespace boost { + + // Kruskal's algorithm for Minimum Spanning Tree + // + // This is a greedy algorithm to calculate the Minimum Spanning Tree + // for an undirected graph with weighted edges. The output will be a + // set of edges. + // + + namespace detail { + + template + void + kruskal_mst_impl(const Graph& G, + OutputIterator spanning_tree_edges, + Rank rank, Parent parent, Weight weight) + { + if (num_vertices(G) == 0) return; // Nothing to do in this case + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + function_requires >(); + function_requires >(); + function_requires >(); + function_requires >(); + function_requires >(); + function_requires >(); + typedef typename property_traits::value_type W_value; + typedef typename property_traits::value_type R_value; + typedef typename property_traits::value_type P_value; + function_requires >(); + function_requires >(); + function_requires >(); + + disjoint_sets dset(rank, parent); + + typename graph_traits::vertex_iterator ui, uiend; + for (boost::tie(ui, uiend) = vertices(G); ui != uiend; ++ui) + dset.make_set(*ui); + + typedef indirect_cmp > weight_greater; + weight_greater wl(weight); + std::priority_queue, weight_greater> Q(wl); + /*push all edge into Q*/ + typename graph_traits::edge_iterator ei, eiend; + for (boost::tie(ei, eiend) = edges(G); ei != eiend; ++ei) + Q.push(*ei); + + while (! Q.empty()) { + Edge e = Q.top(); + Q.pop(); + Vertex u = dset.find_set(source(e, G)); + Vertex v = dset.find_set(target(e, G)); + if ( u != v ) { + *spanning_tree_edges++ = e; + dset.link(u, v); + } + } + } + + } // namespace detail + + // Named Parameters Variants + + template + inline void + kruskal_minimum_spanning_tree(const Graph& g, + OutputIterator spanning_tree_edges) + { + typedef typename graph_traits::vertices_size_type size_type; + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename property_map::type index_map_t; + if (num_vertices(g) == 0) return; // Nothing to do in this case + typename graph_traits::vertices_size_type + n = num_vertices(g); + std::vector rank_map(n); + std::vector pred_map(n); + + detail::kruskal_mst_impl + (g, spanning_tree_edges, + make_iterator_property_map(rank_map.begin(), get(vertex_index, g), rank_map[0]), + make_iterator_property_map(pred_map.begin(), get(vertex_index, g), pred_map[0]), + get(edge_weight, g)); + } + + template + inline void + kruskal_minimum_spanning_tree(const Graph& g, + OutputIterator spanning_tree_edges, + const bgl_named_params& params) + { + typedef typename graph_traits::vertices_size_type size_type; + typedef typename graph_traits::vertex_descriptor vertex_t; + if (num_vertices(g) == 0) return; // Nothing to do in this case + typename graph_traits::vertices_size_type n; + n = is_default_param(get_param(params, vertex_rank)) + ? num_vertices(g) : 1; + std::vector rank_map(n); + n = is_default_param(get_param(params, vertex_predecessor)) + ? num_vertices(g) : 1; + std::vector pred_map(n); + + detail::kruskal_mst_impl + (g, spanning_tree_edges, + choose_param + (get_param(params, vertex_rank), + make_iterator_property_map + (rank_map.begin(), + choose_pmap(get_param(params, vertex_index), g, vertex_index), rank_map[0])), + choose_param + (get_param(params, vertex_predecessor), + make_iterator_property_map + (pred_map.begin(), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + pred_map[0])), + choose_const_pmap(get_param(params, edge_weight), g, edge_weight)); + } + +} // namespace boost + + +#endif // BOOST_GRAPH_MST_KRUSKAL_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/leda_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/leda_graph.hpp new file mode 100644 index 0000000000..770874c5d8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/leda_graph.hpp @@ -0,0 +1,952 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2004 The Trustees of Indiana University. +// Copyright 2007 University of Karlsruhe +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Douglas Gregor, +// Jens Mueller +// +// 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_GRAPH_LEDA_HPP +#define BOOST_GRAPH_LEDA_HPP + +#include +#include +#include +#include + +#include +#include +#include + +// The functions and classes in this file allows the user to +// treat a LEDA GRAPH object as a boost graph "as is". No +// wrapper is needed for the GRAPH object. + +// Warning: this implementation relies on partial specialization +// for the graph_traits class (so it won't compile with Visual C++) + +// Warning: this implementation is in alpha and has not been tested + +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace boost { + + struct leda_graph_traversal_category : + public virtual bidirectional_graph_tag, + public virtual adjacency_graph_tag, + public virtual vertex_list_graph_tag { }; + + template + struct graph_traits< leda::GRAPH > { + typedef leda::node vertex_descriptor; + typedef leda::edge edge_descriptor; + + class adjacency_iterator + : public iterator_facade + { + public: + adjacency_iterator(leda::node node = 0, + const leda::GRAPH* g = 0) + : base(node), g(g) {} + private: + leda::node dereference() const { return leda::target(base); } + + bool equal(const adjacency_iterator& other) const + { return base == other.base; } + + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } + + leda::edge base; + const leda::GRAPH* g; + + friend class iterator_core_access; + }; + + class out_edge_iterator + : public iterator_facade + { + public: + out_edge_iterator(leda::node node = 0, + const leda::GRAPH* g = 0) + : base(node), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const out_edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } + + leda::edge base; + const leda::GRAPH* g; + + friend class iterator_core_access; + }; + + class in_edge_iterator + : public iterator_facade + { + public: + in_edge_iterator(leda::node node = 0, + const leda::GRAPH* g = 0) + : base(node), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const in_edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->in_succ(base); } + void decrement() { base = g->in_pred(base); } + + leda::edge base; + const leda::GRAPH* g; + + friend class iterator_core_access; + }; + + class vertex_iterator + : public iterator_facade + { + public: + vertex_iterator(leda::node node = 0, + const leda::GRAPH* g = 0) + : base(node), g(g) {} + + private: + const leda::node& dereference() const { return base; } + + bool equal(const vertex_iterator& other) const + { return base == other.base; } + + void increment() { base = g->succ_node(base); } + void decrement() { base = g->pred_node(base); } + + leda::node base; + const leda::GRAPH* g; + + friend class iterator_core_access; + }; + + class edge_iterator + : public iterator_facade + { + public: + edge_iterator(leda::edge edge = 0, + const leda::GRAPH* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->succ_edge(base); } + void decrement() { base = g->pred_edge(base); } + + leda::node base; + const leda::GRAPH* g; + + friend class iterator_core_access; + }; + + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; // not sure here + typedef leda_graph_traversal_category traversal_category; + typedef int vertices_size_type; + typedef int edges_size_type; + typedef int degree_size_type; + }; + + + + template<> + struct graph_traits { + typedef leda::node vertex_descriptor; + typedef leda::edge edge_descriptor; + + class adjacency_iterator + : public iterator_facade + { + public: + adjacency_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + leda::node dereference() const { return leda::target(base); } + + bool equal(const adjacency_iterator& other) const + { return base == other.base; } + + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class out_edge_iterator + : public iterator_facade + { + public: + out_edge_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const out_edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class in_edge_iterator + : public iterator_facade + { + public: + in_edge_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const in_edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->in_succ(base); } + void decrement() { base = g->in_pred(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class vertex_iterator + : public iterator_facade + { + public: + vertex_iterator(leda::node node = 0, + const leda::graph* g = 0) + : base(node), g(g) {} + + private: + const leda::node& dereference() const { return base; } + + bool equal(const vertex_iterator& other) const + { return base == other.base; } + + void increment() { base = g->succ_node(base); } + void decrement() { base = g->pred_node(base); } + + leda::node base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class edge_iterator + : public iterator_facade + { + public: + edge_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->succ_edge(base); } + void decrement() { base = g->pred_edge(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; // not sure here + typedef leda_graph_traversal_category traversal_category; + typedef int vertices_size_type; + typedef int edges_size_type; + typedef int degree_size_type; + }; + +} // namespace boost +#endif + +namespace boost { + + //=========================================================================== + // functions for GRAPH + + template + typename graph_traits< leda::GRAPH >::vertex_descriptor + source(typename graph_traits< leda::GRAPH >::edge_descriptor e, + const leda::GRAPH& g) + { + return source(e); + } + + template + typename graph_traits< leda::GRAPH >::vertex_descriptor + target(typename graph_traits< leda::GRAPH >::edge_descriptor e, + const leda::GRAPH& g) + { + return target(e); + } + + template + inline std::pair< + typename graph_traits< leda::GRAPH >::vertex_iterator, + typename graph_traits< leda::GRAPH >::vertex_iterator > + vertices(const leda::GRAPH& g) + { + typedef typename graph_traits< leda::GRAPH >::vertex_iterator + Iter; + return std::make_pair( Iter(g.first_node(),&g), Iter(0,&g) ); + } + + template + inline std::pair< + typename graph_traits< leda::GRAPH >::edge_iterator, + typename graph_traits< leda::GRAPH >::edge_iterator > + edges(const leda::GRAPH& g) + { + typedef typename graph_traits< leda::GRAPH >::edge_iterator + Iter; + return std::make_pair( Iter(g.first_edge(),&g), Iter(0,&g) ); + } + + template + inline std::pair< + typename graph_traits< leda::GRAPH >::out_edge_iterator, + typename graph_traits< leda::GRAPH >::out_edge_iterator > + out_edges( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + const leda::GRAPH& g) + { + typedef typename graph_traits< leda::GRAPH > + ::out_edge_iterator Iter; + return std::make_pair( Iter(g.first_adj_edge(u,0),&g), Iter(0,&g) ); + } + + template + inline std::pair< + typename graph_traits< leda::GRAPH >::in_edge_iterator, + typename graph_traits< leda::GRAPH >::in_edge_iterator > + in_edges( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + const leda::GRAPH& g) + { + typedef typename graph_traits< leda::GRAPH > + ::in_edge_iterator Iter; + return std::make_pair( Iter(g.first_adj_edge(u,1),&g), Iter(0,&g) ); + } + + template + inline std::pair< + typename graph_traits< leda::GRAPH >::adjacency_iterator, + typename graph_traits< leda::GRAPH >::adjacency_iterator > + adjacent_vertices( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + const leda::GRAPH& g) + { + typedef typename graph_traits< leda::GRAPH > + ::adjacency_iterator Iter; + return std::make_pair( Iter(g.first_adj_edge(u,0),&g), Iter(0,&g) ); + } + + template + typename graph_traits< leda::GRAPH >::vertices_size_type + num_vertices(const leda::GRAPH& g) + { + return g.number_of_nodes(); + } + + template + typename graph_traits< leda::GRAPH >::edges_size_type + num_edges(const leda::GRAPH& g) + { + return g.number_of_edges(); + } + + template + typename graph_traits< leda::GRAPH >::degree_size_type + out_degree( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + const leda::GRAPH& g) + { + return g.outdeg(u); + } + + template + typename graph_traits< leda::GRAPH >::degree_size_type + in_degree( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + const leda::GRAPH& g) + { + return g.indeg(u); + } + + template + typename graph_traits< leda::GRAPH >::degree_size_type + degree( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + const leda::GRAPH& g) + { + return g.outdeg(u) + g.indeg(u); + } + + template + typename graph_traits< leda::GRAPH >::vertex_descriptor + add_vertex(leda::GRAPH& g) + { + return g.new_node(); + } + + template + typename graph_traits< leda::GRAPH >::vertex_descriptor + add_vertex(const vtype& vp, leda::GRAPH& g) + { + return g.new_node(vp); + } + + template + void clear_vertex( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + leda::GRAPH& g) + { + typename graph_traits< leda::GRAPH >::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end)=out_edges(u,g); ei!=ei_end; ei++) + remove_edge(*ei); + + typename graph_traits< leda::GRAPH >::in_edge_iterator iei, iei_end; + for (tie(iei, iei_end)=in_edges(u,g); iei!=iei_end; iei++) + remove_edge(*iei); + } + + template + void remove_vertex( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + leda::GRAPH& g) + { + g.del_node(u); + } + + template + std::pair< + typename graph_traits< leda::GRAPH >::edge_descriptor, + bool> + add_edge( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + typename graph_traits< leda::GRAPH >::vertex_descriptor v, + leda::GRAPH& g) + { + return std::make_pair(g.new_edge(u, v), true); + } + + template + std::pair< + typename graph_traits< leda::GRAPH >::edge_descriptor, + bool> + add_edge( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + typename graph_traits< leda::GRAPH >::vertex_descriptor v, + const etype& et, + leda::GRAPH& g) + { + return std::make_pair(g.new_edge(u, v, et), true); + } + + template + void + remove_edge( + typename graph_traits< leda::GRAPH >::vertex_descriptor u, + typename graph_traits< leda::GRAPH >::vertex_descriptor v, + leda::GRAPH& g) + { + typename graph_traits< leda::GRAPH >::out_edge_iterator + i,iend; + for (boost::tie(i,iend) = out_edges(u,g); i != iend; ++i) + if (target(*i,g) == v) + g.del_edge(*i); + } + + template + void + remove_edge( + typename graph_traits< leda::GRAPH >::edge_descriptor e, + leda::GRAPH& g) + { + g.del_edge(e); + } + + //=========================================================================== + // functions for graph (non-templated version) + + graph_traits::vertex_descriptor + source(graph_traits::edge_descriptor e, + const leda::graph& g) + { + return source(e); + } + + graph_traits::vertex_descriptor + target(graph_traits::edge_descriptor e, + const leda::graph& g) + { + return target(e); + } + + inline std::pair< + graph_traits::vertex_iterator, + graph_traits::vertex_iterator > + vertices(const leda::graph& g) + { + typedef graph_traits::vertex_iterator + Iter; + return std::make_pair( Iter(g.first_node(),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits::edge_iterator, + graph_traits::edge_iterator > + edges(const leda::graph& g) + { + typedef graph_traits::edge_iterator + Iter; + return std::make_pair( Iter(g.first_edge(),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits::out_edge_iterator, + graph_traits::out_edge_iterator > + out_edges( + graph_traits::vertex_descriptor u, const leda::graph& g) + { + typedef graph_traits::out_edge_iterator Iter; + return std::make_pair( Iter(g.first_adj_edge(u),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits::in_edge_iterator, + graph_traits::in_edge_iterator > + in_edges( + graph_traits::vertex_descriptor u, + const leda::graph& g) + { + typedef graph_traits + ::in_edge_iterator Iter; + return std::make_pair( Iter(g.first_in_edge(u),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits::adjacency_iterator, + graph_traits::adjacency_iterator > + adjacent_vertices( + graph_traits::vertex_descriptor u, + const leda::graph& g) + { + typedef graph_traits + ::adjacency_iterator Iter; + return std::make_pair( Iter(g.first_adj_edge(u),&g), Iter(0,&g) ); + } + + graph_traits::vertices_size_type + num_vertices(const leda::graph& g) + { + return g.number_of_nodes(); + } + + graph_traits::edges_size_type + num_edges(const leda::graph& g) + { + return g.number_of_edges(); + } + + graph_traits::degree_size_type + out_degree( + graph_traits::vertex_descriptor u, + const leda::graph& g) + { + return g.outdeg(u); + } + + graph_traits::degree_size_type + in_degree( + graph_traits::vertex_descriptor u, + const leda::graph& g) + { + return g.indeg(u); + } + + graph_traits::degree_size_type + degree( + graph_traits::vertex_descriptor u, + const leda::graph& g) + { + return g.outdeg(u) + g.indeg(u); + } + + graph_traits::vertex_descriptor + add_vertex(leda::graph& g) + { + return g.new_node(); + } + + void + remove_edge( + graph_traits::vertex_descriptor u, + graph_traits::vertex_descriptor v, + leda::graph& g) + { + graph_traits::out_edge_iterator + i,iend; + for (boost::tie(i,iend) = out_edges(u,g); i != iend; ++i) + if (target(*i,g) == v) + g.del_edge(*i); + } + + void + remove_edge( + graph_traits::edge_descriptor e, + leda::graph& g) + { + g.del_edge(e); + } + + void clear_vertex( + graph_traits::vertex_descriptor u, + leda::graph& g) + { + graph_traits::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end)=out_edges(u,g); ei!=ei_end; ei++) + remove_edge(*ei, g); + + graph_traits::in_edge_iterator iei, iei_end; + for (tie(iei, iei_end)=in_edges(u,g); iei!=iei_end; iei++) + remove_edge(*iei, g); + } + + void remove_vertex( + graph_traits::vertex_descriptor u, + leda::graph& g) + { + g.del_node(u); + } + + std::pair< + graph_traits::edge_descriptor, + bool> + add_edge( + graph_traits::vertex_descriptor u, + graph_traits::vertex_descriptor v, + leda::graph& g) + { + return std::make_pair(g.new_edge(u, v), true); + } + + + //=========================================================================== + // property maps for GRAPH + + class leda_graph_id_map + : public put_get_helper + { + public: + typedef readable_property_map_tag category; + typedef int value_type; + typedef int reference; + typedef leda::node key_type; + leda_graph_id_map() { } + template + long operator[](T x) const { return x->id(); } + }; + template + inline leda_graph_id_map + get(vertex_index_t, const leda::GRAPH& g) { + return leda_graph_id_map(); + } + template + inline leda_graph_id_map + get(edge_index_t, const leda::GRAPH& g) { + return leda_graph_id_map(); + } + + template + struct leda_property_map { }; + + template <> + struct leda_property_map { + template + struct bind_ { + typedef leda_graph_id_map type; + typedef leda_graph_id_map const_type; + }; + }; + template <> + struct leda_property_map { + template + struct bind_ { + typedef leda_graph_id_map type; + typedef leda_graph_id_map const_type; + }; + }; + + + template + class leda_graph_data_map + : public put_get_helper > + { + public: + typedef Data value_type; + typedef DataRef reference; + typedef void key_type; + typedef lvalue_property_map_tag category; + leda_graph_data_map(GraphPtr g) : m_g(g) { } + template + DataRef operator[](NodeOrEdge x) const { return (*m_g)[x]; } + protected: + GraphPtr m_g; + }; + + template <> + struct leda_property_map { + template + struct bind_ { + typedef leda_graph_data_map*> type; + typedef leda_graph_data_map*> const_type; + }; + }; + template + inline typename property_map< leda::GRAPH, vertex_all_t>::type + get(vertex_all_t, leda::GRAPH& g) { + typedef typename property_map< leda::GRAPH, vertex_all_t>::type + pmap_type; + return pmap_type(&g); + } + template + inline typename property_map< leda::GRAPH, vertex_all_t>::const_type + get(vertex_all_t, const leda::GRAPH& g) { + typedef typename property_map< leda::GRAPH, + vertex_all_t>::const_type pmap_type; + return pmap_type(&g); + } + + template <> + struct leda_property_map { + template + struct bind_ { + typedef leda_graph_data_map*> type; + typedef leda_graph_data_map*> const_type; + }; + }; + template + inline typename property_map< leda::GRAPH, edge_all_t>::type + get(edge_all_t, leda::GRAPH& g) { + typedef typename property_map< leda::GRAPH, edge_all_t>::type + pmap_type; + return pmap_type(&g); + } + template + inline typename property_map< leda::GRAPH, edge_all_t>::const_type + get(edge_all_t, const leda::GRAPH& g) { + typedef typename property_map< leda::GRAPH, + edge_all_t>::const_type pmap_type; + return pmap_type(&g); + } + + // property map interface to the LEDA node_array class + + template + class leda_node_property_map + : public put_get_helper > + { + public: + typedef E value_type; + typedef ERef reference; + typedef leda::node key_type; + typedef lvalue_property_map_tag category; + leda_node_property_map(NodeMapPtr a) : m_array(a) { } + ERef operator[](leda::node n) const { return (*m_array)[n]; } + protected: + NodeMapPtr m_array; + }; + template + leda_node_property_map*> + make_leda_node_property_map(const leda::node_array& a) + { + typedef leda_node_property_map*> + pmap_type; + return pmap_type(&a); + } + template + leda_node_property_map*> + make_leda_node_property_map(leda::node_array& a) + { + typedef leda_node_property_map*> pmap_type; + return pmap_type(&a); + } + + template + leda_node_property_map*> + make_leda_node_property_map(const leda::node_map& a) + { + typedef leda_node_property_map*> + pmap_type; + return pmap_type(&a); + } + template + leda_node_property_map*> + make_leda_node_property_map(leda::node_map& a) + { + typedef leda_node_property_map*> pmap_type; + return pmap_type(&a); + } + + // g++ 'enumeral_type' in template unification not implemented workaround + template + struct property_map, Tag> { + typedef typename + leda_property_map::template bind_ map_gen; + typedef typename map_gen::type type; + typedef typename map_gen::const_type const_type; + }; + + template + inline + typename boost::property_traits< + typename boost::property_map,PropertyTag>::const_type +::value_type + get(PropertyTag p, const leda::GRAPH& g, const Key& key) { + return get(get(p, g), key); + } + + template + inline void + put(PropertyTag p, leda::GRAPH& g, + const Key& key, const Value& value) + { + typedef typename property_map, PropertyTag>::type Map; + Map pmap = get(p, g); + put(pmap, key, value); + } + + // property map interface to the LEDA edge_array class + + template + class leda_edge_property_map + : public put_get_helper > + { + public: + typedef E value_type; + typedef ERef reference; + typedef leda::edge key_type; + typedef lvalue_property_map_tag category; + leda_edge_property_map(EdgeMapPtr a) : m_array(a) { } + ERef operator[](leda::edge n) const { return (*m_array)[n]; } + protected: + EdgeMapPtr m_array; + }; + template + leda_edge_property_map*> + make_leda_node_property_map(const leda::node_array& a) + { + typedef leda_edge_property_map*> + pmap_type; + return pmap_type(&a); + } + template + leda_edge_property_map*> + make_leda_edge_property_map(leda::edge_array& a) + { + typedef leda_edge_property_map*> pmap_type; + return pmap_type(&a); + } + + template + leda_edge_property_map*> + make_leda_edge_property_map(const leda::edge_map& a) + { + typedef leda_edge_property_map*> + pmap_type; + return pmap_type(&a); + } + template + leda_edge_property_map*> + make_leda_edge_property_map(leda::edge_map& a) + { + typedef leda_edge_property_map*> pmap_type; + return pmap_type(&a); + } + +} // namespace boost + +#endif // BOOST_GRAPH_LEDA_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/make_biconnected_planar.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/make_biconnected_planar.hpp new file mode 100644 index 0000000000..b7daef5a20 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/make_biconnected_planar.hpp @@ -0,0 +1,121 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __MAKE_BICONNECTED_PLANAR_HPP__ +#define __MAKE_BICONNECTED_PLANAR_HPP__ + +#include +#include //for tie +#include +#include +#include +#include +#include + +#include + + +namespace boost +{ + + + + template + void make_biconnected_planar(Graph& g, + PlanarEmbedding embedding, + EdgeIndexMap em, + AddEdgeVisitor& vis + ) + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::edges_size_type edge_size_t; + typedef typename + property_traits::value_type embedding_value_t; + typedef typename embedding_value_t::const_iterator embedding_iterator_t; + typedef iterator_property_map + ::iterator, EdgeIndexMap> component_map_t; + + edge_size_t n_edges(num_edges(g)); + std::vector articulation_points; + std::vector component_vector(n_edges); + component_map_t component_map(component_vector.begin(), em); + + biconnected_components(g, component_map, + std::back_inserter(articulation_points)); + + typename std::vector::iterator ap, ap_end; + ap_end = articulation_points.end(); + for(ap = articulation_points.begin(); ap != ap_end; ++ap) + { + vertex_t v(*ap); + embedding_iterator_t pi = embedding[v].begin(); + embedding_iterator_t pi_end = embedding[v].end(); + edge_size_t previous_component(n_edges + 1); + vertex_t previous_vertex = graph_traits::null_vertex(); + + for(; pi != pi_end; ++pi) + { + edge_t e(*pi); + vertex_t e_source(source(e,g)); + vertex_t e_target(target(e,g)); + + //Skip self-loops and parallel edges + if (e_source == e_target || previous_vertex == e_target) + continue; + + vertex_t current_vertex = e_source == v ? e_target : e_source; + edge_size_t current_component = component_map[e]; + if (previous_vertex != graph_traits::null_vertex() && + current_component != previous_component) + { + vis.visit_vertex_pair(current_vertex, previous_vertex, g); + } + previous_vertex = current_vertex; + previous_component = current_component; + } + } + + } + + + + + template + inline void make_biconnected_planar(Graph& g, + PlanarEmbedding embedding, + EdgeIndexMap em + ) + { + default_add_edge_visitor vis; + make_biconnected_planar(g, embedding, em, vis); + } + + + + + template + inline void make_biconnected_planar(Graph& g, PlanarEmbedding embedding) + { + make_biconnected_planar(g, embedding, get(edge_index,g)); + } + + +} // namespace boost + + + +#endif //__MAKE_BICONNECTED_PLANAR_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/make_connected.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/make_connected.hpp new file mode 100644 index 0000000000..94e572954c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/make_connected.hpp @@ -0,0 +1,99 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __MAKE_CONNECTED_HPP__ +#define __MAKE_CONNECTED_HPP__ + +#include +#include //for next +#include //for tie +#include +#include +#include + +#include +#include + + +namespace boost +{ + + + template + void make_connected(Graph& g, VertexIndexMap vm, AddEdgeVisitor& vis) + { + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::vertices_size_type v_size_t; + typedef iterator_property_map< typename std::vector::iterator, + VertexIndexMap + > vertex_to_v_size_map_t; + + std::vector component_vector(num_vertices(g)); + vertex_to_v_size_map_t component(component_vector.begin(), vm); + std::vector vertices_by_component(num_vertices(g)); + + v_size_t num_components = connected_components(g, component); + + if (num_components < 2) + return; + + vertex_iterator_t vi, vi_end; + tie(vi,vi_end) = vertices(g); + std::copy(vi, vi_end, vertices_by_component.begin()); + + bucket_sort(vertices_by_component.begin(), + vertices_by_component.end(), + component, + num_components + ); + + typedef typename std::vector::iterator vec_of_vertices_itr_t; + + vec_of_vertices_itr_t ci_end = vertices_by_component.end(); + vec_of_vertices_itr_t ci_prev = vertices_by_component.begin(); + if (ci_prev == ci_end) + return; + + for(vec_of_vertices_itr_t ci = next(ci_prev); + ci != ci_end; ci_prev = ci, ++ci + ) + { + if (component[*ci_prev] != component[*ci]) + vis.visit_vertex_pair(*ci_prev, *ci, g); + } + + } + + + + + template + inline void make_connected(Graph& g, VertexIndexMap vm) + { + default_add_edge_visitor vis; + make_connected(g, vm, vis); + } + + + + + template + inline void make_connected(Graph& g) + { + make_connected(g, get(vertex_index,g)); + } + + + + +} // namespace boost + +#endif //__MAKE_CONNECTED_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/make_maximal_planar.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/make_maximal_planar.hpp new file mode 100644 index 0000000000..458de0a7a5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/make_maximal_planar.hpp @@ -0,0 +1,275 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __MAKE_MAXIMAL_PLANAR_HPP__ +#define __MAKE_MAXIMAL_PLANAR_HPP__ + +#include +#include //for tie +#include +#include +#include +#include +#include + +#include +#include + + +namespace boost +{ + + + template + struct triangulation_visitor : public planar_face_traversal_visitor + { + + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::vertices_size_type v_size_t; + typedef typename graph_traits::degree_size_type degree_size_t; + typedef typename graph_traits::edge_iterator edge_iterator_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::adjacency_iterator + adjacency_iterator_t; + typedef typename std::vector vertex_vector_t; + typedef typename std::vector v_size_vector_t; + typedef typename std::vector degree_size_vector_t; + typedef iterator_property_map + < typename v_size_vector_t::iterator, VertexIndexMap > + vertex_to_v_size_map_t; + typedef iterator_property_map + < typename degree_size_vector_t::iterator, VertexIndexMap > + vertex_to_degree_size_map_t; + typedef typename vertex_vector_t::iterator face_iterator; + + + triangulation_visitor(Graph& arg_g, + VertexIndexMap arg_vm, + AddEdgeVisitor arg_add_edge_visitor + ) : + g(arg_g), + vm(arg_vm), + add_edge_visitor(arg_add_edge_visitor), + timestamp(0), + marked_vector(num_vertices(g), timestamp), + degree_vector(num_vertices(g), 0), + marked(marked_vector.begin(), vm), + degree(degree_vector.begin(), vm) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(degree, *vi, out_degree(*vi, g)); + } + + template + void next_vertex(Vertex v) + { + // Self-loops will appear as consecutive vertices in the list of + // vertices on a face. We want to skip these. + if (!vertices_on_face.empty() && + (vertices_on_face.back() == v || vertices_on_face.front() == v) + ) + return; + + vertices_on_face.push_back(v); + } + + void end_face() + { + ++timestamp; + + if (vertices_on_face.size() <= 3) + { + // At most three vertices on this face - don't need to triangulate + vertices_on_face.clear(); + return; + } + + // Find vertex on face of minimum degree + degree_size_t min_degree = num_vertices(g); + typename vertex_vector_t::iterator min_degree_vertex_itr; + face_iterator fi_end = vertices_on_face.end(); + for(face_iterator fi = vertices_on_face.begin(); fi != fi_end; ++fi) + { + degree_size_t deg = get(degree,*fi); + if (deg < min_degree) + { + min_degree_vertex_itr = fi; + min_degree = deg; + } + } + + // To simplify some of the manipulations, we'll re-arrange + // vertices_on_face so that it still contains the same + // (counter-clockwise) order of the vertices on this face, but now the + // min_degree_vertex is the first element in vertices_on_face. + vertex_vector_t temp_vector; + std::copy(min_degree_vertex_itr, vertices_on_face.end(), + std::back_inserter(temp_vector)); + std::copy(vertices_on_face.begin(), min_degree_vertex_itr, + std::back_inserter(temp_vector)); + vertices_on_face.swap(temp_vector); + + // Mark all of the min degree vertex's neighbors + adjacency_iterator_t ai, ai_end; + for(tie(ai,ai_end) = adjacent_vertices(vertices_on_face.front(),g); + ai != ai_end; ++ai + ) + { + put(marked, *ai, timestamp); + } + + typename vertex_vector_t::iterator marked_neighbor + = vertices_on_face.end(); + + // The iterator manipulations on the next two lines are safe because + // vertices_on_face.size() > 3 (from the first test in this function) + fi_end = prior(vertices_on_face.end()); + for(face_iterator fi = next(next(vertices_on_face.begin())); + fi != fi_end; ++fi + ) + { + if (get(marked, *fi) == timestamp) + { + marked_neighbor = fi; + break; + } + } + + if (marked_neighbor == vertices_on_face.end()) + { + add_edge_range( + vertices_on_face[0], + next(next(vertices_on_face.begin())), + prior(vertices_on_face.end()) + ); + } + else + { + add_edge_range( + vertices_on_face[1], + next(marked_neighbor), + vertices_on_face.end() + ); + + add_edge_range( + *next(marked_neighbor), + next(next(vertices_on_face.begin())), + marked_neighbor + ); + } + + //reset for the next face + vertices_on_face.clear(); + + } + + private: + + + void add_edge_range(vertex_t anchor, + face_iterator fi, + face_iterator fi_end + ) + { + for (; fi != fi_end; ++fi) + { + vertex_t v(*fi); + add_edge_visitor.visit_vertex_pair(anchor, v, g); + put(degree, anchor, get(degree, anchor) + 1); + put(degree, v, get(degree, v) + 1); + } + } + + + Graph& g; + VertexIndexMap vm; + AddEdgeVisitor add_edge_visitor; + v_size_t timestamp; + vertex_vector_t vertices_on_face; + v_size_vector_t marked_vector; + degree_size_vector_t degree_vector; + vertex_to_v_size_map_t marked; + vertex_to_degree_size_map_t degree; + + }; + + + + + template + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding, + VertexIndexMap vm, + EdgeIndexMap em, + AddEdgeVisitor& vis) + { + triangulation_visitor + visitor(g, vm, vis); + planar_face_traversal(g, embedding, visitor, em); + } + + + + + template + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding, + VertexIndexMap vm, + EdgeIndexMap em + ) + { + default_add_edge_visitor vis; + make_maximal_planar(g, embedding, vm, em, vis); + } + + + + + template + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding, + VertexIndexMap vm + ) + { + make_maximal_planar(g, embedding, vm, get(edge_index,g)); + } + + + + + template + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding + ) + { + make_maximal_planar(g, embedding, get(vertex_index,g)); + } + + + + +} // namespace boost + + + +#endif //__MAKE_MAXIMAL_PLANAR_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/matrix_as_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/matrix_as_graph.hpp new file mode 100644 index 0000000000..b39d126a23 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/matrix_as_graph.hpp @@ -0,0 +1,127 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_MATRIX2GRAPH_HPP +#define BOOST_GRAPH_MATRIX2GRAPH_HPP + +#include +#include +#include +#include +#include + +namespace boost { + + template + class matrix_adj_iterator; + + template + class matrix_incidence_iterator; + +} + +#define BOOST_GRAPH_ADAPT_MATRIX_TO_GRAPH(Matrix) \ +namespace boost { \ + template <> \ + struct graph_traits< Matrix > { \ + typedef Matrix::OneD::const_iterator Iter; \ + typedef Matrix::size_type V; \ + typedef V vertex_descriptor; \ + typedef Iter E; \ + typedef E edge_descriptor; \ + typedef boost::matrix_incidence_iterator out_edge_iterator; \ + typedef boost::matrix_adj_iterator adjacency_iterator; \ + typedef Matrix::size_type size_type; \ + typedef boost::int_iterator vertex_iterator; \ + \ + friend std::pair \ + vertices(const Matrix& g) { \ + typedef vertex_iterator VIter; \ + return std::make_pair(VIter(0), VIter(g.nrows())); \ + } \ + \ + friend std::pair \ + out_edges(V v, const Matrix& g) { \ + typedef out_edge_iterator IncIter; \ + return std::make_pair(IncIter(g[v].begin()), \ + IncIter(g[v].end())); \ + } \ + friend std::pair \ + adjacent_vertices(V v, const Matrix& g) { \ + typedef adjacency_iterator AdjIter; \ + return std::make_pair(AdjIter(g[v].begin()), \ + AdjIter(g[v].end())); \ + } \ + friend vertex_descriptor \ + source(E e, const Matrix& g) { \ + return e.row(); \ + } \ + friend vertex_descriptor \ + target(E e, const Matrix& g) { \ + return e.column(); \ + } \ + friend size_type \ + num_vertices(const Matrix& g) { \ + return g.nrows(); \ + } \ + friend size_type \ + num_edges(const Matrix& g) { \ + return g.nnz(); \ + } \ + friend size_type \ + out_degree(V i, const Matrix& g) { \ + return g[i].nnz(); \ + } \ + }; \ +} + +namespace boost { + + template + class matrix_adj_iterator + : public std::iterator + { + typedef matrix_adj_iterator self; + public: + matrix_adj_iterator() { } + matrix_adj_iterator(Iter i) : _iter(i) { } + matrix_adj_iterator(const self& x) : _iter(x._iter) { } + self& operator=(const self& x) { _iter = x._iter; return *this; } + Vertex operator*() { return _iter.column(); } + self& operator++() { ++_iter; return *this; } + self operator++(int) { self t = *this; ++_iter; return t; } + bool operator==(const self& x) const { return _iter == x._iter; } + bool operator!=(const self& x) const { return _iter != x._iter; } + protected: + Iter _iter; + }; + + template + class matrix_incidence_iterator + : public std::iterator + { + typedef matrix_incidence_iterator self; + public: + matrix_incidence_iterator() { } + matrix_incidence_iterator(Iter i) : _iter(i) { } + matrix_incidence_iterator(const self& x) : _iter(x._iter) { } + self& operator=(const self& x) { _iter = x._iter; return *this; } + Iter operator*() { return _iter; } + self& operator++() { ++_iter; return *this; } + self operator++(int) { self t = *this; ++_iter; return t; } + bool operator==(const self& x) const { return _iter == x._iter; } + bool operator!=(const self& x) const { return _iter != x._iter; } + protected: + Iter _iter; + }; + +} /* namespace boost */ + +#endif /* BOOST_GRAPH_MATRIX2GRAPH_HPP*/ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/max_cardinality_matching.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/max_cardinality_matching.hpp new file mode 100644 index 0000000000..34edc763c7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/max_cardinality_matching.hpp @@ -0,0 +1,883 @@ +//======================================================================= +// Copyright (c) 2005 Aaron Windsor +// +// 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_GRAPH_MAXIMUM_CARDINALITY_MATCHING_HPP +#define BOOST_GRAPH_MAXIMUM_CARDINALITY_MATCHING_HPP + +#include +#include +#include +#include // for std::sort and std::stable_sort +#include // for std::pair +#include +#include // for boost::tie +#include +#include +#include +#include +#include +#include + + +namespace boost +{ + namespace graph { namespace detail { + enum { V_EVEN, V_ODD, V_UNREACHED }; + } } // end namespace graph::detail + + template + typename graph_traits::vertices_size_type + matching_size(const Graph& g, MateMap mate, VertexIndexMap vm) + { + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits::vertices_size_type v_size_t; + + v_size_t size_of_matching = 0; + vertex_iterator_t vi, vi_end; + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_descriptor_t v = *vi; + if (get(mate,v) != graph_traits::null_vertex() + && get(vm,v) < get(vm,get(mate,v))) + ++size_of_matching; + } + return size_of_matching; + } + + + + + template + inline typename graph_traits::vertices_size_type + matching_size(const Graph& g, MateMap mate) + { + return matching_size(g, mate, get(vertex_index,g)); + } + + + + + template + bool is_a_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + + vertex_iterator_t vi, vi_end; + for( tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_descriptor_t v = *vi; + if (get(mate,v) != graph_traits::null_vertex() + && v != get(mate,get(mate,v))) + return false; + } + return true; + } + + + + + template + inline bool is_a_matching(const Graph& g, MateMap mate) + { + return is_a_matching(g, mate, get(vertex_index,g)); + } + + + + + //*************************************************************************** + //*************************************************************************** + // Maximum Cardinality Matching Functors + //*************************************************************************** + //*************************************************************************** + + template + struct no_augmenting_path_finder + { + no_augmenting_path_finder(const Graph& g, MateMap mate, VertexIndexMap vm) + { } + + inline bool augment_matching() { return false; } + + template + void get_current_matching(PropertyMap p) {} + }; + + + + + template + class edmonds_augmenting_path_finder + { + // This implementation of Edmonds' matching algorithm closely + // follows Tarjan's description of the algorithm in "Data + // Structures and Network Algorithms." + + public: + + //generates the type of an iterator property map from vertices to type X + template + struct map_vertex_to_ + { + typedef boost::iterator_property_map::iterator, + VertexIndexMap> type; + }; + + typedef typename graph_traits::vertex_descriptor + vertex_descriptor_t; + typedef typename std::pair< vertex_descriptor_t, vertex_descriptor_t > + vertex_pair_t; + typedef typename graph_traits::edge_descriptor edge_descriptor_t; + typedef typename graph_traits::vertices_size_type v_size_t; + typedef typename graph_traits::edges_size_type e_size_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::out_edge_iterator + out_edge_iterator_t; + typedef typename std::deque vertex_list_t; + typedef typename std::vector edge_list_t; + typedef typename map_vertex_to_::type + vertex_to_vertex_map_t; + typedef typename map_vertex_to_::type vertex_to_int_map_t; + typedef typename map_vertex_to_::type + vertex_to_vertex_pair_map_t; + typedef typename map_vertex_to_::type vertex_to_vsize_map_t; + typedef typename map_vertex_to_::type vertex_to_esize_map_t; + + + + + edmonds_augmenting_path_finder(const Graph& arg_g, MateMap arg_mate, + VertexIndexMap arg_vm) : + g(arg_g), + vm(arg_vm), + n_vertices(num_vertices(arg_g)), + + mate_vector(n_vertices), + ancestor_of_v_vector(n_vertices), + ancestor_of_w_vector(n_vertices), + vertex_state_vector(n_vertices), + origin_vector(n_vertices), + pred_vector(n_vertices), + bridge_vector(n_vertices), + ds_parent_vector(n_vertices), + ds_rank_vector(n_vertices), + + mate(mate_vector.begin(), vm), + ancestor_of_v(ancestor_of_v_vector.begin(), vm), + ancestor_of_w(ancestor_of_w_vector.begin(), vm), + vertex_state(vertex_state_vector.begin(), vm), + origin(origin_vector.begin(), vm), + pred(pred_vector.begin(), vm), + bridge(bridge_vector.begin(), vm), + ds_parent_map(ds_parent_vector.begin(), vm), + ds_rank_map(ds_rank_vector.begin(), vm), + + ds(ds_rank_map, ds_parent_map) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + mate[*vi] = get(arg_mate, *vi); + } + + + + + bool augment_matching() + { + //As an optimization, some of these values can be saved from one + //iteration to the next instead of being re-initialized each + //iteration, allowing for "lazy blossom expansion." This is not + //currently implemented. + + e_size_t timestamp = 0; + even_edges.clear(); + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_descriptor_t u = *vi; + + origin[u] = u; + pred[u] = u; + ancestor_of_v[u] = 0; + ancestor_of_w[u] = 0; + ds.make_set(u); + + if (mate[u] == graph_traits::null_vertex()) + { + vertex_state[u] = graph::detail::V_EVEN; + out_edge_iterator_t ei, ei_end; + for(tie(ei,ei_end) = out_edges(u,g); ei != ei_end; ++ei) + even_edges.push_back( *ei ); + } + else + vertex_state[u] = graph::detail::V_UNREACHED; + } + + //end initializations + + vertex_descriptor_t v,w,w_free_ancestor,v_free_ancestor; + w_free_ancestor = graph_traits::null_vertex(); + v_free_ancestor = graph_traits::null_vertex(); + bool found_alternating_path = false; + + while(!even_edges.empty() && !found_alternating_path) + { + // since we push even edges onto the back of the list as + // they're discovered, taking them off the back will search + // for augmenting paths depth-first. + edge_descriptor_t current_edge = even_edges.back(); + even_edges.pop_back(); + + v = source(current_edge,g); + w = target(current_edge,g); + + vertex_descriptor_t v_prime = origin[ds.find_set(v)]; + vertex_descriptor_t w_prime = origin[ds.find_set(w)]; + + // because of the way we put all of the edges on the queue, + // v_prime should be labeled V_EVEN; the following is a + // little paranoid but it could happen... + if (vertex_state[v_prime] != graph::detail::V_EVEN) + { + std::swap(v_prime,w_prime); + std::swap(v,w); + } + + if (vertex_state[w_prime] == graph::detail::V_UNREACHED) + { + vertex_state[w_prime] = graph::detail::V_ODD; + vertex_state[mate[w_prime]] = graph::detail::V_EVEN; + out_edge_iterator_t ei, ei_end; + for( tie(ei,ei_end) = out_edges(mate[w_prime], g); ei != ei_end; ++ei) + even_edges.push_back(*ei); + pred[w_prime] = v; + } + + //w_prime == v_prime can happen below if we get an edge that has been + //shrunk into a blossom + else if (vertex_state[w_prime] == graph::detail::V_EVEN && w_prime != v_prime) + { + vertex_descriptor_t w_up = w_prime; + vertex_descriptor_t v_up = v_prime; + vertex_descriptor_t nearest_common_ancestor + = graph_traits::null_vertex(); + w_free_ancestor = graph_traits::null_vertex(); + v_free_ancestor = graph_traits::null_vertex(); + + // We now need to distinguish between the case that + // w_prime and v_prime share an ancestor under the + // "parent" relation, in which case we've found a + // blossom and should shrink it, or the case that + // w_prime and v_prime both have distinct ancestors that + // are free, in which case we've found an alternating + // path between those two ancestors. + + ++timestamp; + + while (nearest_common_ancestor == graph_traits::null_vertex() && + (v_free_ancestor == graph_traits::null_vertex() || + w_free_ancestor == graph_traits::null_vertex() + ) + ) + { + ancestor_of_w[w_up] = timestamp; + ancestor_of_v[v_up] = timestamp; + + if (w_free_ancestor == graph_traits::null_vertex()) + w_up = parent(w_up); + if (v_free_ancestor == graph_traits::null_vertex()) + v_up = parent(v_up); + + if (mate[v_up] == graph_traits::null_vertex()) + v_free_ancestor = v_up; + if (mate[w_up] == graph_traits::null_vertex()) + w_free_ancestor = w_up; + + if (ancestor_of_w[v_up] == timestamp) + nearest_common_ancestor = v_up; + else if (ancestor_of_v[w_up] == timestamp) + nearest_common_ancestor = w_up; + else if (v_free_ancestor == w_free_ancestor && + v_free_ancestor != graph_traits::null_vertex()) + nearest_common_ancestor = v_up; + } + + if (nearest_common_ancestor == graph_traits::null_vertex()) + found_alternating_path = true; //to break out of the loop + else + { + //shrink the blossom + link_and_set_bridges(w_prime, nearest_common_ancestor, std::make_pair(w,v)); + link_and_set_bridges(v_prime, nearest_common_ancestor, std::make_pair(v,w)); + } + } + } + + if (!found_alternating_path) + return false; + + // retrieve the augmenting path and put it in aug_path + reversed_retrieve_augmenting_path(v, v_free_ancestor); + retrieve_augmenting_path(w, w_free_ancestor); + + // augment the matching along aug_path + vertex_descriptor_t a,b; + while (!aug_path.empty()) + { + a = aug_path.front(); + aug_path.pop_front(); + b = aug_path.front(); + aug_path.pop_front(); + mate[a] = b; + mate[b] = a; + } + + return true; + + } + + + + + template + void get_current_matching(PropertyMap pm) + { + vertex_iterator_t vi,vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(pm, *vi, mate[*vi]); + } + + + + + template + void get_vertex_state_map(PropertyMap pm) + { + vertex_iterator_t vi,vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(pm, *vi, vertex_state[origin[ds.find_set(*vi)]]); + } + + + + + private: + + vertex_descriptor_t parent(vertex_descriptor_t x) + { + if (vertex_state[x] == graph::detail::V_EVEN + && mate[x] != graph_traits::null_vertex()) + return mate[x]; + else if (vertex_state[x] == graph::detail::V_ODD) + return origin[ds.find_set(pred[x])]; + else + return x; + } + + + + + void link_and_set_bridges(vertex_descriptor_t x, + vertex_descriptor_t stop_vertex, + vertex_pair_t the_bridge) + { + for(vertex_descriptor_t v = x; v != stop_vertex; v = parent(v)) + { + ds.union_set(v, stop_vertex); + origin[ds.find_set(stop_vertex)] = stop_vertex; + + if (vertex_state[v] == graph::detail::V_ODD) + { + bridge[v] = the_bridge; + out_edge_iterator_t oei, oei_end; + for(tie(oei, oei_end) = out_edges(v,g); oei != oei_end; ++oei) + even_edges.push_back(*oei); + } + } + } + + + // Since none of the STL containers support both constant-time + // concatenation and reversal, the process of expanding an + // augmenting path once we know one exists is a little more + // complicated than it has to be. If we know the path is from v to + // w, then the augmenting path is recursively defined as: + // + // path(v,w) = [v], if v = w + // = concat([v, mate[v]], path(pred[mate[v]], w), + // if v != w and vertex_state[v] == graph::detail::V_EVEN + // = concat([v], reverse(path(x,mate[v])), path(y,w)), + // if v != w, vertex_state[v] == graph::detail::V_ODD, and bridge[v] = (x,y) + // + // These next two mutually recursive functions implement this definition. + + void retrieve_augmenting_path(vertex_descriptor_t v, vertex_descriptor_t w) + { + if (v == w) + aug_path.push_back(v); + else if (vertex_state[v] == graph::detail::V_EVEN) + { + aug_path.push_back(v); + aug_path.push_back(mate[v]); + retrieve_augmenting_path(pred[mate[v]], w); + } + else //vertex_state[v] == graph::detail::V_ODD + { + aug_path.push_back(v); + reversed_retrieve_augmenting_path(bridge[v].first, mate[v]); + retrieve_augmenting_path(bridge[v].second, w); + } + } + + + void reversed_retrieve_augmenting_path(vertex_descriptor_t v, + vertex_descriptor_t w) + { + + if (v == w) + aug_path.push_back(v); + else if (vertex_state[v] == graph::detail::V_EVEN) + { + reversed_retrieve_augmenting_path(pred[mate[v]], w); + aug_path.push_back(mate[v]); + aug_path.push_back(v); + } + else //vertex_state[v] == graph::detail::V_ODD + { + reversed_retrieve_augmenting_path(bridge[v].second, w); + retrieve_augmenting_path(bridge[v].first, mate[v]); + aug_path.push_back(v); + } + } + + + + + //private data members + + const Graph& g; + VertexIndexMap vm; + v_size_t n_vertices; + + //storage for the property maps below + std::vector mate_vector; + std::vector ancestor_of_v_vector; + std::vector ancestor_of_w_vector; + std::vector vertex_state_vector; + std::vector origin_vector; + std::vector pred_vector; + std::vector bridge_vector; + std::vector ds_parent_vector; + std::vector ds_rank_vector; + + //iterator property maps + vertex_to_vertex_map_t mate; + vertex_to_esize_map_t ancestor_of_v; + vertex_to_esize_map_t ancestor_of_w; + vertex_to_int_map_t vertex_state; + vertex_to_vertex_map_t origin; + vertex_to_vertex_map_t pred; + vertex_to_vertex_pair_map_t bridge; + vertex_to_vertex_map_t ds_parent_map; + vertex_to_vsize_map_t ds_rank_map; + + vertex_list_t aug_path; + edge_list_t even_edges; + disjoint_sets< vertex_to_vsize_map_t, vertex_to_vertex_map_t > ds; + + }; + + + + + //*************************************************************************** + //*************************************************************************** + // Initial Matching Functors + //*************************************************************************** + //*************************************************************************** + + template + struct greedy_matching + { + typedef typename graph_traits< Graph >::vertex_descriptor vertex_descriptor_t; + typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator_t; + typedef typename graph_traits< Graph >::edge_descriptor edge_descriptor_t; + typedef typename graph_traits< Graph >::edge_iterator edge_iterator_t; + + static void find_matching(const Graph& g, MateMap mate) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(mate, *vi, graph_traits::null_vertex()); + + edge_iterator_t ei, ei_end; + for( tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_descriptor_t e = *ei; + vertex_descriptor_t u = source(e,g); + vertex_descriptor_t v = target(e,g); + + if (get(mate,u) == get(mate,v)) + //only way equality can hold is if + // mate[u] == mate[v] == null_vertex + { + put(mate,u,v); + put(mate,v,u); + } + } + } + }; + + + + + template + struct extra_greedy_matching + { + // The "extra greedy matching" is formed by repeating the + // following procedure as many times as possible: Choose the + // unmatched vertex v of minimum non-zero degree. Choose the + // neighbor w of v which is unmatched and has minimum degree over + // all of v's neighbors. Add (u,v) to the matching. Ties for + // either choice are broken arbitrarily. This procedure takes time + // O(m log n), where m is the number of edges in the graph and n + // is the number of vertices. + + typedef typename graph_traits< Graph >::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator_t; + typedef typename graph_traits< Graph >::edge_descriptor edge_descriptor_t; + typedef typename graph_traits< Graph >::edge_iterator edge_iterator_t; + typedef std::pair vertex_pair_t; + + struct select_first + { + inline static vertex_descriptor_t select_vertex(const vertex_pair_t p) + {return p.first;} + }; + + struct select_second + { + inline static vertex_descriptor_t select_vertex(const vertex_pair_t p) + {return p.second;} + }; + + template + class less_than_by_degree + { + public: + less_than_by_degree(const Graph& g): m_g(g) {} + bool operator() (const vertex_pair_t x, const vertex_pair_t y) + { + return + out_degree(PairSelector::select_vertex(x), m_g) + < out_degree(PairSelector::select_vertex(y), m_g); + } + private: + const Graph& m_g; + }; + + + static void find_matching(const Graph& g, MateMap mate) + { + typedef std::vector > + directed_edges_vector_t; + + directed_edges_vector_t edge_list; + vertex_iterator_t vi, vi_end; + for(tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + put(mate, *vi, graph_traits::null_vertex()); + + edge_iterator_t ei, ei_end; + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_descriptor_t e = *ei; + vertex_descriptor_t u = source(e,g); + vertex_descriptor_t v = target(e,g); + edge_list.push_back(std::make_pair(u,v)); + edge_list.push_back(std::make_pair(v,u)); + } + + //sort the edges by the degree of the target, then (using a + //stable sort) by degree of the source + std::sort(edge_list.begin(), edge_list.end(), + less_than_by_degree(g)); + std::stable_sort(edge_list.begin(), edge_list.end(), + less_than_by_degree(g)); + + //construct the extra greedy matching + for(typename directed_edges_vector_t::const_iterator itr = edge_list.begin(); itr != edge_list.end(); ++itr) + { + if (get(mate,itr->first) == get(mate,itr->second)) + //only way equality can hold is if mate[itr->first] == mate[itr->second] == null_vertex + { + put(mate, itr->first, itr->second); + put(mate, itr->second, itr->first); + } + } + } + }; + + + + + template + struct empty_matching + { + typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator_t; + + static void find_matching(const Graph& g, MateMap mate) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(mate, *vi, graph_traits::null_vertex()); + } + }; + + + + + //*************************************************************************** + //*************************************************************************** + // Matching Verifiers + //*************************************************************************** + //*************************************************************************** + + namespace detail + { + + template + class odd_components_counter : public dfs_visitor<> + // This depth-first search visitor will count the number of connected + // components with an odd number of vertices. It's used by + // maximum_matching_verifier. + { + public: + odd_components_counter(SizeType& c_count): + m_count(c_count) + { + m_count = 0; + } + + template + void start_vertex(Vertex v, Graph&) + { + m_parity = false; + } + + template + void discover_vertex(Vertex u, Graph&) + { + m_parity = !m_parity; + m_parity ? ++m_count : --m_count; + } + + protected: + SizeType& m_count; + + private: + bool m_parity; + + }; + + }//namespace detail + + + + + template + struct no_matching_verifier + { + inline static bool + verify_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { return true;} + }; + + + + + template + struct maximum_cardinality_matching_verifier + { + + template + struct map_vertex_to_ + { + typedef boost::iterator_property_map::iterator, + VertexIndexMap> type; + }; + + typedef typename graph_traits::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits::vertices_size_type v_size_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename map_vertex_to_::type vertex_to_int_map_t; + typedef typename map_vertex_to_::type + vertex_to_vertex_map_t; + + + template + struct non_odd_vertex { + //this predicate is used to create a filtered graph that + //excludes vertices labeled "graph::detail::V_ODD" + non_odd_vertex() : vertex_state(0) { } + + non_odd_vertex(VertexStateMap* arg_vertex_state) + : vertex_state(arg_vertex_state) { } + + template + bool operator()(const Vertex& v) const + { + BOOST_ASSERT(vertex_state); + return get(*vertex_state, v) != graph::detail::V_ODD; + } + + VertexStateMap* vertex_state; + }; + + + static bool verify_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + //For any graph G, let o(G) be the number of connected + //components in G of odd size. For a subset S of G's vertex set + //V(G), let (G - S) represent the subgraph of G induced by + //removing all vertices in S from G. Let M(G) be the size of the + //maximum cardinality matching in G. Then the Tutte-Berge + //formula guarantees that + // + // 2 * M(G) = min ( |V(G)| + |U| + o(G - U) ) + // + //where the minimum is taken over all subsets U of + //V(G). Edmonds' algorithm finds a set U that achieves the + //minimum in the above formula, namely the vertices labeled + //"ODD." This function runs one iteration of Edmonds' algorithm + //to find U, then verifies that the size of the matching given + //by mate satisfies the Tutte-Berge formula. + + //first, make sure it's a valid matching + if (!is_a_matching(g,mate,vm)) + return false; + + //We'll try to augment the matching once. This serves two + //purposes: first, if we find some augmenting path, the matching + //is obviously non-maximum. Second, running edmonds' algorithm + //on a graph with no augmenting path will create the + //Edmonds-Gallai decomposition that we need as a certificate of + //maximality - we can get it by looking at the vertex_state map + //that results. + edmonds_augmenting_path_finder + augmentor(g,mate,vm); + if (augmentor.augment_matching()) + return false; + + std::vector vertex_state_vector(num_vertices(g)); + vertex_to_int_map_t vertex_state(vertex_state_vector.begin(), vm); + augmentor.get_vertex_state_map(vertex_state); + + //count the number of graph::detail::V_ODD vertices + v_size_t num_odd_vertices = 0; + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + if (vertex_state[*vi] == graph::detail::V_ODD) + ++num_odd_vertices; + + //count the number of connected components with odd cardinality + //in the graph without graph::detail::V_ODD vertices + non_odd_vertex filter(&vertex_state); + filtered_graph > fg(g, keep_all(), filter); + + v_size_t num_odd_components; + detail::odd_components_counter occ(num_odd_components); + depth_first_search(fg, visitor(occ).vertex_index_map(vm)); + + if (2 * matching_size(g,mate,vm) == num_vertices(g) + num_odd_vertices - num_odd_components) + return true; + else + return false; + } + }; + + + + + template class AugmentingPathFinder, + template class InitialMatchingFinder, + template class MatchingVerifier> + bool matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + + InitialMatchingFinder::find_matching(g,mate); + + AugmentingPathFinder augmentor(g,mate,vm); + bool not_maximum_yet = true; + while(not_maximum_yet) + { + not_maximum_yet = augmentor.augment_matching(); + } + augmentor.get_current_matching(mate); + + return MatchingVerifier::verify_matching(g,mate,vm); + + } + + + + + template + inline bool checked_edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + return matching + < Graph, MateMap, VertexIndexMap, + edmonds_augmenting_path_finder, extra_greedy_matching, maximum_cardinality_matching_verifier> + (g, mate, vm); + } + + + + + template + inline bool checked_edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate) + { + return checked_edmonds_maximum_cardinality_matching(g, mate, get(vertex_index,g)); + } + + + + + template + inline void edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + matching < Graph, MateMap, VertexIndexMap, + edmonds_augmenting_path_finder, extra_greedy_matching, no_matching_verifier> + (g, mate, vm); + } + + + + + template + inline void edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate) + { + edmonds_maximum_cardinality_matching(g, mate, get(vertex_index,g)); + } + +}//namespace boost + +#endif //BOOST_GRAPH_MAXIMUM_CARDINALITY_MATCHING_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/minimum_degree_ordering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/minimum_degree_ordering.hpp new file mode 100644 index 0000000000..6aa242dcc5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/minimum_degree_ordering.hpp @@ -0,0 +1,655 @@ +//-*-c++-*- +//======================================================================= +// Copyright 1997-2001 University of Notre Dame. +// Authors: Lie-Quan Lee, Jeremy Siek +// +// 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 MINIMUM_DEGREE_ORDERING_HPP +#define MINIMUM_DEGREE_ORDERING_HPP + +#include +#include +#include +#include +#include // for integer_traits +#include +#include + +namespace boost { + + namespace detail { + + // + // Given a set of n integers (where the integer values range from + // zero to n-1), we want to keep track of a collection of stacks + // of integers. It so happens that an integer will appear in at + // most one stack at a time, so the stacks form disjoint sets. + // Because of these restrictions, we can use one big array to + // store all the stacks, intertwined with one another. + // No allocation/deallocation happens in the push()/pop() methods + // so this is faster than using std::stack's. + // + template + class Stacks { + typedef SignedInteger value_type; + typedef typename std::vector::size_type size_type; + public: + Stacks(size_type n) : data(n) {} + + //: stack + class stack { + typedef typename std::vector::iterator Iterator; + public: + stack(Iterator _data, const value_type& head) + : data(_data), current(head) {} + + // did not use default argument here to avoid internal compiler error + // in g++. + stack(Iterator _data) + : data(_data), current(-(std::numeric_limits::max)()) {} + + void pop() { + assert(! empty()); + current = data[current]; + } + void push(value_type v) { + data[v] = current; + current = v; + } + bool empty() { + return current == -(std::numeric_limits::max)(); + } + value_type& top() { return current; } + private: + Iterator data; + value_type current; + }; + + // To return a stack object + stack make_stack() + { return stack(data.begin()); } + protected: + std::vector data; + }; + + + // marker class, a generalization of coloring. + // + // This class is to provide a generalization of coloring which has + // complexity of amortized constant time to set all vertices' color + // back to be untagged. It implemented by increasing a tag. + // + // The colors are: + // not tagged + // tagged + // multiple_tagged + // done + // + template + class Marker { + typedef SignedInteger value_type; + typedef typename std::vector::size_type size_type; + + static value_type done() + { return (std::numeric_limits::max)()/2; } + public: + Marker(size_type _num, VertexIndexMap index_map) + : tag(1 - (std::numeric_limits::max)()), + data(_num, - (std::numeric_limits::max)()), + id(index_map) {} + + void mark_done(Vertex node) { data[get(id, node)] = done(); } + + bool is_done(Vertex node) { return data[get(id, node)] == done(); } + + void mark_tagged(Vertex node) { data[get(id, node)] = tag; } + + void mark_multiple_tagged(Vertex node) { data[get(id, node)] = multiple_tag; } + + bool is_tagged(Vertex node) const { return data[get(id, node)] >= tag; } + + bool is_not_tagged(Vertex node) const { return data[get(id, node)] < tag; } + + bool is_multiple_tagged(Vertex node) const + { return data[get(id, node)] >= multiple_tag; } + + void increment_tag() { + const size_type num = data.size(); + ++tag; + if ( tag >= done() ) { + tag = 1 - (std::numeric_limits::max)(); + for (size_type i = 0; i < num; ++i) + if ( data[i] < done() ) + data[i] = - (std::numeric_limits::max)(); + } + } + + void set_multiple_tag(value_type mdeg0) + { + const size_type num = data.size(); + multiple_tag = tag + mdeg0; + + if ( multiple_tag >= done() ) { + tag = 1-(std::numeric_limits::max)(); + + for (size_type i=0; i::max)(); + + multiple_tag = tag + mdeg0; + } + } + + void set_tag_as_multiple_tag() { tag = multiple_tag; } + + protected: + value_type tag; + value_type multiple_tag; + std::vector data; + VertexIndexMap id; + }; + + template< class Iterator, class SignedInteger, + class Vertex, class VertexIndexMap, int offset = 1 > + class Numbering { + typedef SignedInteger number_type; + number_type num; //start from 1 instead of zero + Iterator data; + number_type max_num; + VertexIndexMap id; + public: + Numbering(Iterator _data, number_type _max_num, VertexIndexMap id) + : num(1), data(_data), max_num(_max_num), id(id) {} + void operator()(Vertex node) { data[get(id, node)] = -num; } + bool all_done(number_type i = 0) const { return num + i > max_num; } + void increment(number_type i = 1) { num += i; } + bool is_numbered(Vertex node) const { + return data[get(id, node)] < 0; + } + void indistinguishable(Vertex i, Vertex j) { + data[get(id, i)] = - (get(id, j) + offset); + } + }; + + template + class degreelists_marker { + public: + typedef SignedInteger value_type; + typedef typename std::vector::size_type size_type; + degreelists_marker(size_type n, VertexIndexMap id) + : marks(n, 0), id(id) {} + void mark_need_update(Vertex i) { marks[get(id, i)] = 1; } + bool need_update(Vertex i) { return marks[get(id, i)] == 1; } + bool outmatched_or_done (Vertex i) { return marks[get(id, i)] == -1; } + void mark(Vertex i) { marks[get(id, i)] = -1; } + void unmark(Vertex i) { marks[get(id, i)] = 0; } + private: + std::vector marks; + VertexIndexMap id; + }; + + // Helper function object for edge removal + template + class predicateRemoveEdge1 { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + public: + predicateRemoveEdge1(Graph& _g, MarkerP& _marker, + NumberD _numbering, Stack& n_e, VertexIndexMap id) + : g(&_g), marker(&_marker), numbering(_numbering), + neighbor_elements(&n_e), id(id) {} + + bool operator()(edge_t e) { + vertex_t dist = target(e, *g); + if ( marker->is_tagged(dist) ) + return true; + marker->mark_tagged(dist); + if (numbering.is_numbered(dist)) { + neighbor_elements->push(get(id, dist)); + return true; + } + return false; + } + private: + Graph* g; + MarkerP* marker; + NumberD numbering; + Stack* neighbor_elements; + VertexIndexMap id; + }; + + // Helper function object for edge removal + template + class predicate_remove_tagged_edges + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + public: + predicate_remove_tagged_edges(Graph& _g, MarkerP& _marker) + : g(&_g), marker(&_marker) {} + + bool operator()(edge_t e) { + vertex_t dist = target(e, *g); + if ( marker->is_tagged(dist) ) + return true; + return false; + } + private: + Graph* g; + MarkerP* marker; + }; + + template + class mmd_impl + { + // Typedefs + typedef graph_traits Traits; + typedef typename Traits::vertices_size_type size_type; + typedef typename detail::integer_traits::difference_type + diff_t; + typedef typename Traits::vertex_descriptor vertex_t; + typedef typename Traits::adjacency_iterator adj_iter; + typedef iterator_property_map IndexVertexMap; + typedef detail::Stacks Workspace; + typedef bucket_sorter + DegreeLists; + typedef Numbering + NumberingD; + typedef degreelists_marker + DegreeListsMarker; + typedef Marker MarkerP; + + // Data Members + + // input parameters + Graph& G; + int delta; + DegreeMap degree; + InversePermutationMap inverse_perm; + PermutationMap perm; + SuperNodeMap supernode_size; + VertexIndexMap vertex_index_map; + + // internal data-structures + std::vector index_vertex_vec; + size_type n; + IndexVertexMap index_vertex_map; + DegreeLists degreelists; + NumberingD numbering; + DegreeListsMarker degree_lists_marker; + MarkerP marker; + Workspace work_space; + public: + mmd_impl(Graph& g, size_type n_, int delta, DegreeMap degree, + InversePermutationMap inverse_perm, + PermutationMap perm, + SuperNodeMap supernode_size, + VertexIndexMap id) + : G(g), delta(delta), degree(degree), + inverse_perm(inverse_perm), + perm(perm), + supernode_size(supernode_size), + vertex_index_map(id), + index_vertex_vec(n_), + n(n_), + degreelists(n_ + 1, n_, degree, id), + numbering(inverse_perm, n_, vertex_index_map), + degree_lists_marker(n_, vertex_index_map), + marker(n_, vertex_index_map), + work_space(n_) + { + typename graph_traits::vertex_iterator v, vend; + size_type vid = 0; + for (tie(v, vend) = vertices(G); v != vend; ++v, ++vid) + index_vertex_vec[vid] = *v; + index_vertex_map = IndexVertexMap(&index_vertex_vec[0]); + + // Initialize degreelists. Degreelists organizes the nodes + // according to their degree. + for (tie(v, vend) = vertices(G); v != vend; ++v) { + put(degree, *v, out_degree(*v, G)); + degreelists.push(*v); + } + } + + void do_mmd() + { + // Eliminate the isolated nodes -- these are simply the nodes + // with no neighbors, which are accessible as a list (really, a + // stack) at location 0. Since these don't affect any other + // nodes, we can eliminate them without doing degree updates. + typename DegreeLists::stack list_isolated = degreelists[0]; + while (!list_isolated.empty()) { + vertex_t node = list_isolated.top(); + marker.mark_done(node); + numbering(node); + numbering.increment(); + list_isolated.pop(); + } + size_type min_degree = 1; + typename DegreeLists::stack list_min_degree = degreelists[min_degree]; + + while (list_min_degree.empty()) { + ++min_degree; + list_min_degree = degreelists[min_degree]; + } + + // check if the whole eliminating process is done + while (!numbering.all_done()) { + + size_type min_degree_limit = min_degree + delta; // WARNING + typename Workspace::stack llist = work_space.make_stack(); + + // multiple elimination + while (delta >= 0) { + + // Find the next non-empty degree + for (list_min_degree = degreelists[min_degree]; + list_min_degree.empty() && min_degree <= min_degree_limit; + ++min_degree, list_min_degree = degreelists[min_degree]) + ; + if (min_degree > min_degree_limit) + break; + + const vertex_t node = list_min_degree.top(); + const size_type node_id = get(vertex_index_map, node); + list_min_degree.pop(); + numbering(node); + + // check if node is the last one + if (numbering.all_done(supernode_size[node])) { + numbering.increment(supernode_size[node]); + break; + } + marker.increment_tag(); + marker.mark_tagged(node); + + this->eliminate(node); + + numbering.increment(supernode_size[node]); + llist.push(node_id); + } // multiple elimination + + if (numbering.all_done()) + break; + + this->update( llist, min_degree); + } + + } // do_mmd() + + void eliminate(vertex_t node) + { + typename Workspace::stack element_neighbor = work_space.make_stack(); + + // Create two function objects for edge removal + typedef typename Workspace::stack WorkStack; + predicateRemoveEdge1 + p(G, marker, numbering, element_neighbor, vertex_index_map); + + predicate_remove_tagged_edges p2(G, marker); + + // Reconstruct the adjacent node list, push element neighbor in a List. + remove_out_edge_if(node, p, G); + //during removal element neighbors are collected. + + while (!element_neighbor.empty()) { + // element absorb + size_type e_id = element_neighbor.top(); + vertex_t element = get(index_vertex_map, e_id); + adj_iter i, i_end; + for (tie(i, i_end) = adjacent_vertices(element, G); i != i_end; ++i){ + vertex_t i_node = *i; + if (!marker.is_tagged(i_node) && !numbering.is_numbered(i_node)) { + marker.mark_tagged(i_node); + add_edge(node, i_node, G); + } + } + element_neighbor.pop(); + } + adj_iter v, ve; + for (tie(v, ve) = adjacent_vertices(node, G); v != ve; ++v) { + vertex_t v_node = *v; + if (!degree_lists_marker.need_update(v_node) + && !degree_lists_marker.outmatched_or_done(v_node)) { + degreelists.remove(v_node); + } + //update out edges of v_node + remove_out_edge_if(v_node, p2, G); + + if ( out_degree(v_node, G) == 0 ) { // indistinguishable nodes + supernode_size[node] += supernode_size[v_node]; + supernode_size[v_node] = 0; + numbering.indistinguishable(v_node, node); + marker.mark_done(v_node); + degree_lists_marker.mark(v_node); + } else { // not indistinguishable nodes + add_edge(v_node, node, G); + degree_lists_marker.mark_need_update(v_node); + } + } + } // eliminate() + + + template + void update(Stack llist, size_type& min_degree) + { + size_type min_degree0 = min_degree + delta + 1; + + while (! llist.empty()) { + size_type deg, deg0 = 0; + + marker.set_multiple_tag(min_degree0); + typename Workspace::stack q2list = work_space.make_stack(); + typename Workspace::stack qxlist = work_space.make_stack(); + + vertex_t current = get(index_vertex_map, llist.top()); + adj_iter i, ie; + for (tie(i,ie) = adjacent_vertices(current, G); i != ie; ++i) { + vertex_t i_node = *i; + const size_type i_id = get(vertex_index_map, i_node); + if (supernode_size[i_node] != 0) { + deg0 += supernode_size[i_node]; + marker.mark_multiple_tagged(i_node); + if (degree_lists_marker.need_update(i_node)) { + if (out_degree(i_node, G) == 2) + q2list.push(i_id); + else + qxlist.push(i_id); + } + } + } + + while (!q2list.empty()) { + const size_type u_id = q2list.top(); + vertex_t u_node = get(index_vertex_map, u_id); + // if u_id is outmatched by others, no need to update degree + if (degree_lists_marker.outmatched_or_done(u_node)) { + q2list.pop(); + continue; + } + marker.increment_tag(); + deg = deg0; + + adj_iter nu = adjacent_vertices(u_node, G).first; + vertex_t neighbor = *nu; + if (neighbor == u_node) { + ++nu; + neighbor = *nu; + } + if (numbering.is_numbered(neighbor)) { + adj_iter i, ie; + for (tie(i,ie) = adjacent_vertices(neighbor, G); + i != ie; ++i) { + const vertex_t i_node = *i; + if (i_node == u_node || supernode_size[i_node] == 0) + continue; + if (marker.is_tagged(i_node)) { + if (degree_lists_marker.need_update(i_node)) { + if ( out_degree(i_node, G) == 2 ) { // is indistinguishable + supernode_size[u_node] += supernode_size[i_node]; + supernode_size[i_node] = 0; + numbering.indistinguishable(i_node, u_node); + marker.mark_done(i_node); + degree_lists_marker.mark(i_node); + } else // is outmatched + degree_lists_marker.mark(i_node); + } + } else { + marker.mark_tagged(i_node); + deg += supernode_size[i_node]; + } + } + } else + deg += supernode_size[neighbor]; + + deg -= supernode_size[u_node]; + degree[u_node] = deg; //update degree + degreelists[deg].push(u_node); + //u_id has been pushed back into degreelists + degree_lists_marker.unmark(u_node); + if (min_degree > deg) + min_degree = deg; + q2list.pop(); + } // while (!q2list.empty()) + + while (!qxlist.empty()) { + const size_type u_id = qxlist.top(); + const vertex_t u_node = get(index_vertex_map, u_id); + + // if u_id is outmatched by others, no need to update degree + if (degree_lists_marker.outmatched_or_done(u_node)) { + qxlist.pop(); + continue; + } + marker.increment_tag(); + deg = deg0; + adj_iter i, ie; + for (tie(i, ie) = adjacent_vertices(u_node, G); i != ie; ++i) { + vertex_t i_node = *i; + if (marker.is_tagged(i_node)) + continue; + marker.mark_tagged(i_node); + + if (numbering.is_numbered(i_node)) { + adj_iter j, je; + for (tie(j, je) = adjacent_vertices(i_node, G); j != je; ++j) { + const vertex_t j_node = *j; + if (marker.is_not_tagged(j_node)) { + marker.mark_tagged(j_node); + deg += supernode_size[j_node]; + } + } + } else + deg += supernode_size[i_node]; + } // for adjacent vertices of u_node + deg -= supernode_size[u_node]; + degree[u_node] = deg; + degreelists[deg].push(u_node); + // u_id has been pushed back into degreelists + degree_lists_marker.unmark(u_node); + if (min_degree > deg) + min_degree = deg; + qxlist.pop(); + } // while (!qxlist.empty()) { + + marker.set_tag_as_multiple_tag(); + llist.pop(); + } // while (! llist.empty()) + + } // update() + + + void build_permutation(InversePermutationMap next, + PermutationMap prev) + { + // collect the permutation info + size_type i; + for (i = 0; i < n; ++i) { + diff_t size = supernode_size[get(index_vertex_map, i)]; + if ( size <= 0 ) { + prev[i] = next[i]; + supernode_size[get(index_vertex_map, i)] + = next[i] + 1; // record the supernode info + } else + prev[i] = - next[i]; + } + for (i = 1; i < n + 1; ++i) { + if ( prev[i-1] > 0 ) + continue; + diff_t parent = i; + while ( prev[parent - 1] < 0 ) { + parent = - prev[parent - 1]; + } + + diff_t root = parent; + diff_t num = prev[root - 1] + 1; + next[i-1] = - num; + prev[root-1] = num; + + parent = i; + diff_t next_node = - prev[parent - 1]; + while (next_node > 0) { + prev[parent-1] = - root; + parent = next_node; + next_node = - prev[parent - 1]; + } + } + for (i = 0; i < n; i++) { + diff_t num = - next[i] - 1; + next[i] = num; + prev[num] = i; + } + } // build_permutation() + }; + + } //namespace detail + + + // MMD algorithm + // + //The implementation presently includes the enhancements for mass + //elimination, incomplete degree update, multiple elimination, and + //external degree. + // + //Important Note: This implementation requires the BGL graph to be + //directed. Therefore, nonzero entry (i, j) in a symmetrical matrix + //A coresponds to two directed edges (i->j and j->i). + // + //see Alan George and Joseph W. H. Liu, The Evolution of the Minimum + //Degree Ordering Algorithm, SIAM Review, 31, 1989, Page 1-19 + template + void minimum_degree_ordering + (Graph& G, + DegreeMap degree, + InversePermutationMap inverse_perm, + PermutationMap perm, + SuperNodeMap supernode_size, + int delta, + VertexIndexMap vertex_index_map) + { + detail::mmd_impl + impl(G, num_vertices(G), delta, degree, inverse_perm, + perm, supernode_size, vertex_index_map); + impl.do_mmd(); + impl.build_permutation(inverse_perm, perm); + } + +} // namespace boost + +#endif // MINIMUM_DEGREE_ORDERING_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/named_function_params.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/named_function_params.hpp new file mode 100644 index 0000000000..db77ae3b4f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/named_function_params.hpp @@ -0,0 +1,795 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_NAMED_FUNCTION_PARAMS_HPP +#define BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP + +#include + +namespace boost { + + struct distance_compare_t { }; + struct distance_combine_t { }; + struct distance_inf_t { }; + struct distance_zero_t { }; + struct buffer_param_t { }; + struct edge_copy_t { }; + struct vertex_copy_t { }; + struct vertex_isomorphism_t { }; + struct vertex_invariant_t { }; + struct vertex_invariant1_t { }; + struct vertex_invariant2_t { }; + struct edge_compare_t { }; + struct vertex_max_invariant_t { }; + struct orig_to_copy_t { }; + struct root_vertex_t { }; + struct attractive_force_t { }; + struct repulsive_force_t { }; + struct force_pairs_t { }; + struct cooling_t { }; + struct vertex_displacement_t { }; + struct iterations_t { }; + struct diameter_range_t { }; + struct learning_constant_range_t { }; + + namespace detail { + template + struct wrap_ref { + wrap_ref(T& r) : ref(r) {} + T& ref; + }; + } + + template + struct bgl_named_params : public Base + { + typedef bgl_named_params self; + typedef Base next_type; + typedef Tag tag_type; + typedef T value_type; + bgl_named_params(T v) : m_value(v) { } + bgl_named_params(T v, const Base& b) : Base(b), m_value(v) { } + T m_value; + + template + bgl_named_params + weight_map(const WeightMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + weight_map2(const WeightMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + distance_map(const DistanceMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + predecessor_map(const PredecessorMap& pmap) const { + typedef bgl_named_params + Params; + return Params(pmap, *this); + } + + template + bgl_named_params + rank_map(const RankMap& pmap) const { + typedef bgl_named_params + Params; + return Params(pmap, *this); + } + + template + bgl_named_params + root_map(const RootMap& pmap) const { + typedef bgl_named_params + Params; + return Params(pmap, *this); + } + + template + bgl_named_params + root_vertex(const Vertex& r) const { + typedef bgl_named_params Params; + return Params(r, *this); + } + + template + bgl_named_params + edge_centrality_map(const EdgeCentralityMap& r) const { + typedef bgl_named_params Params; + return Params(r, *this); + } + + template + bgl_named_params + centrality_map(const CentralityMap& r) const { + typedef bgl_named_params Params; + return Params(r, *this); + } + + template + bgl_named_params + color_map(const ColorMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + vertex_color_map(const ColorMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + edge_color_map(const ColorMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + capacity_map(CapacityMap pmap) { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + residual_capacity_map(Residual_CapacityMap pmap) { + typedef bgl_named_params + Params; + return Params(pmap, *this); + } + + template + bgl_named_params + reverse_edge_map(ReverseMap pmap) { + typedef bgl_named_params + Params; + return Params(pmap, *this); + } + + template + bgl_named_params + discover_time_map(const DiscoverTimeMap& pmap) const { + typedef bgl_named_params + Params; + return Params(pmap, *this); + } + + template + bgl_named_params + lowpoint_map(const LowPointMap& pmap) const { + typedef bgl_named_params + Params; + return Params(pmap, *this); + } + + template + bgl_named_params + vertex_index_map(const IndexMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + vertex_index1_map(const IndexMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + vertex_index2_map(const IndexMap& pmap) const { + typedef bgl_named_params Params; + return Params(pmap, *this); + } + + template + bgl_named_params + visitor(const Visitor& vis) const { + typedef bgl_named_params Params; + return Params(vis, *this); + } + + template + bgl_named_params + distance_compare(Compare cmp) const { + typedef bgl_named_params Params; + return Params(cmp, *this); + } + + template + bgl_named_params + distance_combine(Combine cmb) const { + typedef bgl_named_params Params; + return Params(cmb, *this); + } + + template + bgl_named_params + distance_inf(Init init) const { + typedef bgl_named_params Params; + return Params(init, *this); + } + + template + bgl_named_params + distance_zero(Init init) const { + typedef bgl_named_params Params; + return Params(init, *this); + } + + template + bgl_named_params, buffer_param_t, self> + buffer(Buffer& b) const { + typedef bgl_named_params, buffer_param_t, self> + Params; + return Params(detail::wrap_ref(b), *this); + } + + template + bgl_named_params + edge_copy(const Copier& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + vertex_copy(const Copier& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + orig_to_copy(const Orig2CopyMap& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + isomorphism_map(const IsoMap& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + vertex_invariant(const VertexInvar& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + vertex_invariant1(const VertexInvar& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + vertex_invariant2(const VertexInvar& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + vertex_max_invariant(const VertexMaxInvar& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + displacement_map(const VertexDisplacement& c) const { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + attractive_force(const AttractiveForce& c) { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + repulsive_force(const RepulsiveForce& c) { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + force_pairs(const ForcePairs& c) { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + cooling(const Cooling& c) { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params + iterations(const TP& c) { + typedef bgl_named_params Params; + return Params(c, *this); + } + + template + bgl_named_params, diameter_range_t, self> + diameter_range(const std::pair& c) { + typedef bgl_named_params, diameter_range_t, self> Params; + return Params(c, *this); + } + + template + bgl_named_params, learning_constant_range_t, self> + learning_constant_range(const std::pair& c) { + typedef bgl_named_params, learning_constant_range_t, self> + Params; + return Params(c, *this); + } + }; + + template + bgl_named_params + weight_map(WeightMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + weight_map2(WeightMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + distance_map(DistanceMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + predecessor_map(PredecessorMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + rank_map(RankMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + root_map(RootMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + root_vertex(const Vertex& r) { + typedef bgl_named_params Params; + return Params(r); + } + + template + bgl_named_params + edge_centrality_map(const EdgeCentralityMap& r) { + typedef bgl_named_params Params; + return Params(r); + } + + template + bgl_named_params + centrality_map(const CentralityMap& r) { + typedef bgl_named_params Params; + return Params(r); + } + + template + bgl_named_params + color_map(ColorMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + capacity_map(CapacityMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + residual_capacity_map(Residual_CapacityMap pmap) { + typedef bgl_named_params + Params; + return Params(pmap); + } + + template + bgl_named_params + reverse_edge_map(ReverseMap pmap) { + typedef bgl_named_params + Params; + return Params(pmap); + } + + template + bgl_named_params + discover_time_map(DiscoverTimeMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + lowpoint_map(LowPointMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + vertex_index_map(IndexMap pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + vertex_index1_map(const IndexMap& pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + vertex_index2_map(const IndexMap& pmap) { + typedef bgl_named_params Params; + return Params(pmap); + } + + template + bgl_named_params + visitor(const Visitor& vis) { + typedef bgl_named_params Params; + return Params(vis); + } + + template + bgl_named_params + distance_compare(Compare cmp) { + typedef bgl_named_params Params; + return Params(cmp); + } + + template + bgl_named_params + distance_combine(Combine cmb) { + typedef bgl_named_params Params; + return Params(cmb); + } + + template + bgl_named_params + distance_inf(Init init) { + typedef bgl_named_params Params; + return Params(init); + } + + template + bgl_named_params + distance_zero(Init init) { + typedef bgl_named_params Params; + return Params(init); + } + + template + bgl_named_params, buffer_param_t> + buffer(Buffer& b) { + typedef bgl_named_params, buffer_param_t> Params; + return Params(detail::wrap_ref(b)); + } + + template + bgl_named_params + edge_copy(const Copier& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + vertex_copy(const Copier& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + orig_to_copy(const Orig2CopyMap& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + isomorphism_map(const IsoMap& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + vertex_invariant(const VertexInvar& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + vertex_invariant1(const VertexInvar& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + vertex_invariant2(const VertexInvar& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + vertex_max_invariant(const VertexMaxInvar& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + displacement_map(const VertexDisplacement& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + attractive_force(const AttractiveForce& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + repulsive_force(const RepulsiveForce& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + force_pairs(const ForcePairs& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + cooling(const Cooling& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params + iterations(const T& c) { + typedef bgl_named_params Params; + return Params(c); + } + + template + bgl_named_params, diameter_range_t> + diameter_range(const std::pair& c) { + typedef bgl_named_params, diameter_range_t> Params; + return Params(c); + } + + template + bgl_named_params, learning_constant_range_t> + learning_constant_range(const std::pair& c) { + typedef bgl_named_params, learning_constant_range_t> + Params; + return Params(c); + } + + //=========================================================================== + // Functions for extracting parameters from bgl_named_params + + template + inline + typename property_value< bgl_named_params, Tag2>::type + get_param(const bgl_named_params& p, Tag2 tag2) + { + enum { match = detail::same_property::value }; + typedef typename + property_value< bgl_named_params, Tag2>::type T2; + T2* t2 = 0; + typedef detail::property_value_dispatch Dispatcher; + return Dispatcher::const_get_value(p, t2, tag2); + } + + + namespace detail { + // MSVC++ workaround + template + struct choose_param_helper { + template struct result { typedef Param type; }; + template + static const Param& apply(const Param& p, const Default&) { return p; } + }; + template <> + struct choose_param_helper { + template struct result { typedef Default type; }; + template + static const Default& apply(const error_property_not_found&, const Default& d) + { return d; } + }; + } // namespace detail + + template + const typename detail::choose_param_helper

::template result::type& + choose_param(const P& param, const Default& d) { + return detail::choose_param_helper

::apply(param, d); + } + + template + inline bool is_default_param(const T&) { return false; } + + inline bool is_default_param(const detail::error_property_not_found&) + { return true; } + + namespace detail { + + struct choose_parameter { + template + struct bind_ { + typedef const P& const_result_type; + typedef const P& result_type; + typedef P type; + }; + + template + static typename bind_::const_result_type + const_apply(const P& p, const Graph&, Tag&) + { return p; } + + template + static typename bind_::result_type + apply(const P& p, Graph&, Tag&) + { return p; } + }; + + struct choose_default_param { + template + struct bind_ { + typedef typename property_map::type + result_type; + typedef typename property_map::const_type + const_result_type; + typedef typename property_map::const_type + type; + }; + + template + static typename bind_::const_result_type + const_apply(const P&, const Graph& g, Tag tag) { + return get(tag, g); + } + template + static typename bind_::result_type + apply(const P&, Graph& g, Tag tag) { + return get(tag, g); + } + }; + + template + struct choose_property_map { + typedef choose_parameter type; + }; + template <> + struct choose_property_map { + typedef choose_default_param type; + }; + + template + struct choose_pmap_helper { + typedef typename choose_property_map::type Selector; + typedef typename Selector:: template bind_ Bind; + typedef Bind type; + typedef typename Bind::result_type result_type; + typedef typename Bind::const_result_type const_result_type; + typedef typename Bind::type result; + }; + + // used in the max-flow algorithms + template + struct edge_capacity_value + { + typedef bgl_named_params Params; + typedef typename property_value< Params, edge_capacity_t>::type Param; + typedef typename detail::choose_pmap_helper::result CapacityEdgeMap; + typedef typename property_traits::value_type type; + }; + + } // namespace detail + + + // Use this function instead of choose_param() when you want + // to avoid requiring get(tag, g) when it is not used. + template + typename + detail::choose_pmap_helper::const_result_type + choose_const_pmap(const Param& p, const Graph& g, PropertyTag tag) + { + typedef typename + detail::choose_pmap_helper::Selector Choice; + return Choice::const_apply(p, g, tag); + } + + template + typename detail::choose_pmap_helper::result_type + choose_pmap(const Param& p, Graph& g, PropertyTag tag) + { + typedef typename + detail::choose_pmap_helper::Selector Choice; + return Choice::apply(p, g, tag); + } + +} // namespace boost + +#endif // BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/neighbor_bfs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/neighbor_bfs.hpp new file mode 100644 index 0000000000..1c7b9782ac --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/neighbor_bfs.hpp @@ -0,0 +1,323 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_NEIGHBOR_BREADTH_FIRST_SEARCH_HPP +#define BOOST_GRAPH_NEIGHBOR_BREADTH_FIRST_SEARCH_HPP + +/* + Neighbor Breadth First Search + Like BFS, but traverses in-edges as well as out-edges. + (for directed graphs only. use normal BFS for undirected graphs) +*/ +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + struct NeighborBFSVisitorConcept { + void constraints() { + function_requires< CopyConstructibleConcept >(); + vis.initialize_vertex(u, g); + vis.discover_vertex(u, g); + vis.examine_vertex(u, g); + vis.examine_out_edge(e, g); + vis.examine_in_edge(e, g); + vis.tree_out_edge(e, g); + vis.tree_in_edge(e, g); + vis.non_tree_out_edge(e, g); + vis.non_tree_in_edge(e, g); + vis.gray_target(e, g); + vis.black_target(e, g); + vis.gray_source(e, g); + vis.black_source(e, g); + vis.finish_vertex(u, g); + } + Visitor vis; + Graph g; + typename graph_traits::vertex_descriptor u; + typename graph_traits::edge_descriptor e; + }; + + template + class neighbor_bfs_visitor { + public: + neighbor_bfs_visitor(Visitors vis = Visitors()) : m_vis(vis) { } + + template + void initialize_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, on_initialize_vertex()); + } + template + void discover_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, on_discover_vertex()); + } + template + void examine_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, on_examine_vertex()); + } + template + void examine_out_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_examine_edge()); + } + template + void tree_out_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_tree_edge()); + } + template + void non_tree_out_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_non_tree_edge()); + } + template + void gray_target(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_gray_target()); + } + template + void black_target(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_black_target()); + } + template + void examine_in_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_examine_edge()); + } + template + void tree_in_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_tree_edge()); + } + template + void non_tree_in_edge(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_non_tree_edge()); + } + template + void gray_source(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_gray_target()); + } + template + void black_source(Edge e, Graph& g) { + invoke_visitors(m_vis, e, g, on_black_target()); + } + template + void finish_vertex(Vertex u, Graph& g) { + invoke_visitors(m_vis, u, g, on_finish_vertex()); + } + protected: + Visitors m_vis; + }; + + template + neighbor_bfs_visitor + make_neighbor_bfs_visitor(Visitors vis) { + return neighbor_bfs_visitor(vis); + } + + namespace detail { + + template + void neighbor_bfs_impl + (const BidirectionalGraph& g, + typename graph_traits::vertex_descriptor s, + Buffer& Q, BFSVisitor vis, ColorMap color) + + { + function_requires< BidirectionalGraphConcept >(); + typedef graph_traits GTraits; + typedef typename GTraits::vertex_descriptor Vertex; + typedef typename GTraits::edge_descriptor Edge; + function_requires< + NeighborBFSVisitorConcept >(); + function_requires< ReadWritePropertyMapConcept >(); + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + put(color, s, Color::gray()); + vis.discover_vertex(s, g); + Q.push(s); + while (! Q.empty()) { + Vertex u = Q.top(); + Q.pop(); // pop before push to avoid problem if Q is priority_queue. + vis.examine_vertex(u, g); + + typename GTraits::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + Edge e = *ei; + vis.examine_out_edge(e, g); + Vertex v = target(e, g); + ColorValue v_color = get(color, v); + if (v_color == Color::white()) { + vis.tree_out_edge(e, g); + put(color, v, Color::gray()); + vis.discover_vertex(v, g); + Q.push(v); + } else { + vis.non_tree_out_edge(e, g); + if (v_color == Color::gray()) + vis.gray_target(e, g); + else + vis.black_target(e, g); + } + } // for out-edges + + typename GTraits::in_edge_iterator in_ei, in_ei_end; + for (tie(in_ei, in_ei_end) = in_edges(u, g); + in_ei != in_ei_end; ++in_ei) { + Edge e = *in_ei; + vis.examine_in_edge(e, g); + Vertex v = source(e, g); + ColorValue v_color = get(color, v); + if (v_color == Color::white()) { + vis.tree_in_edge(e, g); + put(color, v, Color::gray()); + vis.discover_vertex(v, g); + Q.push(v); + } else { + vis.non_tree_in_edge(e, g); + if (v_color == Color::gray()) + vis.gray_source(e, g); + else + vis.black_source(e, g); + } + } // for in-edges + + put(color, u, Color::black()); + vis.finish_vertex(u, g); + } // while + } + + + template + void neighbor_bfs_helper + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + const bgl_named_params& params) + { + typedef graph_traits Traits; + // Buffer default + typedef typename Traits::vertex_descriptor Vertex; + typedef boost::queue queue_t; + queue_t Q; + detail::wrap_ref Qref(Q); + // Initialization + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typename boost::graph_traits::vertex_iterator i, i_end; + for (tie(i, i_end) = vertices(g); i != i_end; ++i) { + put(color, *i, Color::white()); + vis.initialize_vertex(*i, g); + } + neighbor_bfs_impl + (g, s, + choose_param(get_param(params, buffer_param_t()), Qref).ref, + vis, color); + } + + //------------------------------------------------------------------------- + // Choose between default color and color parameters. Using + // function dispatching so that we don't require vertex index if + // the color default is not being used. + + template + struct neighbor_bfs_dispatch { + template + static void apply + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params, + ColorMap color) + { + neighbor_bfs_helper + (g, s, color, + choose_param(get_param(params, graph_visitor), + make_neighbor_bfs_visitor(null_visitor())), + params); + } + }; + + template <> + struct neighbor_bfs_dispatch { + template + static void apply + (VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params, + detail::error_property_not_found) + { + std::vector color_vec(num_vertices(g)); + null_visitor null_vis; + + neighbor_bfs_helper + (g, s, + make_iterator_property_map + (color_vec.begin(), + choose_const_pmap(get_param(params, vertex_index), + g, vertex_index), color_vec[0]), + choose_param(get_param(params, graph_visitor), + make_neighbor_bfs_visitor(null_vis)), + params); + } + }; + + } // namespace detail + + + // Named Parameter Variant + template + void neighbor_breadth_first_search + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params) + { + // The graph is passed by *const* reference so that graph adaptors + // (temporaries) can be passed into this function. However, the + // graph is not really const since we may write to property maps + // of the graph. + VertexListGraph& ng = const_cast(g); + typedef typename property_value< bgl_named_params, + vertex_color_t>::type C; + detail::neighbor_bfs_dispatch::apply(ng, s, params, + get_param(params, vertex_color)); + } + + + // This version does not initialize colors, user has to. + + template + void neighbor_breadth_first_visit + (IncidenceGraph& g, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params) + { + typedef graph_traits Traits; + // Buffer default + typedef boost::queue queue_t; + queue_t Q; + detail::wrap_ref Qref(Q); + + detail::neighbor_bfs_impl + (g, s, + choose_param(get_param(params, buffer_param_t()), Qref).ref, + choose_param(get_param(params, graph_visitor), + make_neighbor_bfs_visitor(null_visitor())), + choose_pmap(get_param(params, vertex_color), g, vertex_color) + ); + } + +} // namespace boost + +#endif // BOOST_GRAPH_NEIGHBOR_BREADTH_FIRST_SEARCH_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/page_rank.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/page_rank.hpp new file mode 100644 index 0000000000..8a4e14143b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/page_rank.hpp @@ -0,0 +1,153 @@ +// Copyright 2004-5 The Trustees of Indiana University. +// Copyright 2002 Brad King and Douglas Gregor + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_PAGE_RANK_HPP +#define BOOST_GRAPH_PAGE_RANK_HPP + +#include +#include +#include +#include +#include + +namespace boost { namespace graph { + +struct n_iterations +{ + explicit n_iterations(std::size_t n) : n(n) { } + + template + bool + operator()(const RankMap&, const Graph&) + { + return n-- == 0; + } + + private: + std::size_t n; +}; + +namespace detail { + template + void page_rank_step(const Graph& g, RankMap from_rank, RankMap2 to_rank, + typename property_traits::value_type damping, + incidence_graph_tag) + { + typedef typename property_traits::value_type rank_type; + + // Set new rank maps + BGL_FORALL_VERTICES_T(v, g, Graph) put(to_rank, v, rank_type(1 - damping)); + + BGL_FORALL_VERTICES_T(u, g, Graph) { + rank_type u_rank_out = damping * get(from_rank, u) / out_degree(u, g); + BGL_FORALL_ADJ_T(u, v, g, Graph) + put(to_rank, v, get(to_rank, v) + u_rank_out); + } + } + + template + void page_rank_step(const Graph& g, RankMap from_rank, RankMap2 to_rank, + typename property_traits::value_type damping, + bidirectional_graph_tag) + { + typedef typename property_traits::value_type damping_type; + BGL_FORALL_VERTICES_T(v, g, Graph) { + typename property_traits::value_type rank(0); + BGL_FORALL_INEDGES_T(v, e, g, Graph) + rank += get(from_rank, source(e, g)) / out_degree(source(e, g), g); + put(to_rank, v, (damping_type(1) - damping) + damping * rank); + } + } +} // end namespace detail + +template +void +page_rank(const Graph& g, RankMap rank_map, Done done, + typename property_traits::value_type damping, + typename graph_traits::vertices_size_type n, + RankMap2 rank_map2) +{ + typedef typename property_traits::value_type rank_type; + + rank_type initial_rank = rank_type(rank_type(1) / n); + BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map, v, initial_rank); + + bool to_map_2 = true; + while ((to_map_2 && !done(rank_map, g)) || + (!to_map_2 && !done(rank_map2, g))) { + typedef typename graph_traits::traversal_category category; + + if (to_map_2) { + detail::page_rank_step(g, rank_map, rank_map2, damping, category()); + } else { + detail::page_rank_step(g, rank_map2, rank_map, damping, category()); + } + to_map_2 = !to_map_2; + } + + if (!to_map_2) { + BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map, v, get(rank_map2, v)); + } +} + +template +void +page_rank(const Graph& g, RankMap rank_map, Done done, + typename property_traits::value_type damping, + typename graph_traits::vertices_size_type n) +{ + typedef typename property_traits::value_type rank_type; + + std::vector ranks2(num_vertices(g)); + page_rank(g, rank_map, done, damping, n, + make_iterator_property_map(ranks2.begin(), get(vertex_index, g))); +} + +template +inline void +page_rank(const Graph& g, RankMap rank_map, Done done, + typename property_traits::value_type damping = 0.85) +{ + page_rank(g, rank_map, done, damping, num_vertices(g)); +} + +template +inline void +page_rank(const Graph& g, RankMap rank_map) +{ + page_rank(g, rank_map, n_iterations(20)); +} + +// TBD: this could be _much_ more efficient, using a queue to store +// the vertices that should be reprocessed and keeping track of which +// vertices are in the queue with a property map. Baah, this only +// applies when we have a bidirectional graph. +template +void +remove_dangling_links(MutableGraph& g) +{ + typename graph_traits::vertices_size_type old_n; + do { + old_n = num_vertices(g); + + typename graph_traits::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; /* in loop */) { + typename graph_traits::vertex_descriptor v = *vi++; + if (out_degree(v, g) == 0) { + clear_vertex(v, g); + remove_vertex(v, g); + } + } + } while (num_vertices(g) < old_n); +} + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_PAGE_RANK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_canonical_ordering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_canonical_ordering.hpp new file mode 100644 index 0000000000..6f8e2579d8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_canonical_ordering.hpp @@ -0,0 +1,211 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __PLANAR_CANONICAL_ORDERING_HPP__ +#define __PLANAR_CANONICAL_ORDERING_HPP__ + +#include +#include +#include +#include //for next and prior +#include +#include + + +namespace boost +{ + + + template + void planar_canonical_ordering(const Graph& g, + PlanarEmbedding embedding, + OutputIterator ordering, + VertexIndexMap vm) + { + + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::adjacency_iterator + adjacency_iterator_t; + typedef typename std::pair vertex_pair_t; + typedef typename property_traits::value_type + embedding_value_t; + typedef typename embedding_value_t::const_iterator embedding_iterator_t; + typedef iterator_property_map + ::iterator, VertexIndexMap> + vertex_to_vertex_map_t; + typedef iterator_property_map + ::iterator, VertexIndexMap> + vertex_to_size_t_map_t; + + enum {PROCESSED, + UNPROCESSED, + ONE_NEIGHBOR_PROCESSED, + READY_TO_BE_PROCESSED}; + + std::vector processed_neighbor_vector(num_vertices(g)); + vertex_to_vertex_map_t processed_neighbor + (processed_neighbor_vector.begin(), vm); + + std::vector status_vector(num_vertices(g), UNPROCESSED); + vertex_to_size_t_map_t status(status_vector.begin(), vm); + + std::list ready_to_be_processed; + + vertex_t first_vertex = *vertices(g).first; + vertex_t second_vertex; + adjacency_iterator_t ai, ai_end; + for(tie(ai,ai_end) = adjacent_vertices(first_vertex,g); ai != ai_end; ++ai) + { + if (*ai == first_vertex) + continue; + second_vertex = *ai; + break; + } + + ready_to_be_processed.push_back(first_vertex); + status[first_vertex] = READY_TO_BE_PROCESSED; + ready_to_be_processed.push_back(second_vertex); + status[second_vertex] = READY_TO_BE_PROCESSED; + + while(!ready_to_be_processed.empty()) + { + vertex_t u = ready_to_be_processed.front(); + ready_to_be_processed.pop_front(); + + if (status[u] != READY_TO_BE_PROCESSED && u != second_vertex) + continue; + + embedding_iterator_t ei, ei_start, ei_end; + embedding_iterator_t next_edge_itr, prior_edge_itr; + + ei_start = embedding[u].begin(); + ei_end = embedding[u].end(); + prior_edge_itr = prior(ei_end); + while(source(*prior_edge_itr, g) == target(*prior_edge_itr,g)) + prior_edge_itr = prior(prior_edge_itr); + + for(ei = ei_start; ei != ei_end; ++ei) + { + + edge_t e(*ei); // e = (u,v) + next_edge_itr = next(ei) == ei_end ? ei_start : next(ei); + vertex_t v = source(e,g) == u ? target(e,g) : source(e,g); + + vertex_t prior_vertex = source(*prior_edge_itr, g) == u ? + target(*prior_edge_itr, g) : source(*prior_edge_itr, g); + vertex_t next_vertex = source(*next_edge_itr, g) == u ? + target(*next_edge_itr, g) : source(*next_edge_itr, g); + + // Need prior_vertex, u, v, and next_vertex to all be + // distinct. This is possible, since the input graph is + // triangulated. It'll be true all the time in a simple + // graph, but loops and parallel edges cause some complications. + if (prior_vertex == v || prior_vertex == u) + { + prior_edge_itr = ei; + continue; + } + + //Skip any self-loops + if (u == v) + continue; + + // Move next_edge_itr (and next_vertex) forwards + // past any loops or parallel edges + while (next_vertex == v || next_vertex == u) + { + next_edge_itr = next(next_edge_itr) == ei_end ? + ei_start : next(next_edge_itr); + next_vertex = source(*next_edge_itr, g) == u ? + target(*next_edge_itr, g) : source(*next_edge_itr, g); + } + + + if (status[v] == UNPROCESSED) + { + status[v] = ONE_NEIGHBOR_PROCESSED; + processed_neighbor[v] = u; + } + else if (status[v] == ONE_NEIGHBOR_PROCESSED) + { + vertex_t x = processed_neighbor[v]; + //are edges (v,u) and (v,x) adjacent in the planar + //embedding? if so, set status[v] = 1. otherwise, set + //status[v] = 2. + + if ((next_vertex == x && + !(first_vertex == u && second_vertex == x) + ) + || + (prior_vertex == x && + !(first_vertex == x && second_vertex == u) + ) + ) + { + status[v] = READY_TO_BE_PROCESSED; + } + else + { + status[v] = READY_TO_BE_PROCESSED + 1; + } + } + else if (status[v] > ONE_NEIGHBOR_PROCESSED) + { + //check the two edges before and after (v,u) in the planar + //embedding, and update status[v] accordingly + + bool processed_before = false; + if (status[prior_vertex] == PROCESSED) + processed_before = true; + + bool processed_after = false; + if (status[next_vertex] == PROCESSED) + processed_after = true; + + if (!processed_before && !processed_after) + ++status[v]; + + else if (processed_before && processed_after) + --status[v]; + + } + + if (status[v] == READY_TO_BE_PROCESSED) + ready_to_be_processed.push_back(v); + + prior_edge_itr = ei; + + } + + status[u] = PROCESSED; + *ordering = u; + ++ordering; + + } + + } + + + template + void planar_canonical_ordering(const Graph& g, + PlanarEmbedding embedding, + OutputIterator ordering + ) + { + planar_canonical_ordering(g, embedding, ordering, get(vertex_index,g)); + } + + +} //namespace boost + +#endif //__PLANAR_CANONICAL_ORDERING_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/add_edge_visitors.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/add_edge_visitors.hpp new file mode 100644 index 0000000000..3ad65b8228 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/add_edge_visitors.hpp @@ -0,0 +1,59 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __ADD_EDGE_VISITORS_HPP__ +#define __ADD_EDGE_VISITORS_HPP__ + +#include + +namespace boost +{ + + struct default_add_edge_visitor + { + + template + void visit_vertex_pair(Vertex u, Vertex v, Graph& g) + { + add_edge(u,v,g); + } + + }; + + template + struct edge_index_update_visitor + { + + typedef typename + property_traits::value_type edge_index_value_t; + + edge_index_update_visitor(EdgeIndexMap em, + edge_index_value_t next_index_available + ) : + m_em(em), + m_next_index(next_index_available) + {} + + template + void visit_vertex_pair(Vertex u, Vertex v, Graph& g) + { + typedef typename graph_traits::edge_descriptor edge_t; + std::pair return_value = add_edge(u,v,g); + if (return_value.second) + put( m_em, return_value.first, m_next_index++); + } + + private: + + EdgeIndexMap m_em; + edge_index_value_t m_next_index; + + }; + +} // namespace boost + +#endif //__ADD_EDGE_VISITORS_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/boyer_myrvold_impl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/boyer_myrvold_impl.hpp new file mode 100644 index 0000000000..d09552217a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/boyer_myrvold_impl.hpp @@ -0,0 +1,2010 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __BOYER_MYRVOLD_IMPL_HPP__ +#define __BOYER_MYRVOLD_IMPL_HPP__ + +#include +#include +#include //for boost::next +#include //for std::min macros +#include +#include +#include +#include +#include +#include +#include +#include + + + +namespace boost +{ + + template + struct planar_dfs_visitor : public dfs_visitor<> + { + planar_dfs_visitor(LowPointMap lpm, DFSParentMap dfs_p, + DFSNumberMap dfs_n, LeastAncestorMap lam, + DFSParentEdgeMap dfs_edge) + : low(lpm), + parent(dfs_p), + df_number(dfs_n), + least_ancestor(lam), + df_edge(dfs_edge), + count(0) + {} + + + template + void start_vertex(const Vertex& u, Graph&) + { + put(parent, u, u); + put(least_ancestor, u, count); + } + + + template + void discover_vertex(const Vertex& u, Graph&) + { + put(low, u, count); + put(df_number, u, count); + ++count; + } + + template + void tree_edge(const Edge& e, Graph& g) + { + typedef typename graph_traits::vertex_descriptor vertex_t; + vertex_t s(source(e,g)); + vertex_t t(target(e,g)); + + put(parent, t, s); + put(df_edge, t, e); + put(least_ancestor, t, get(df_number, s)); + } + + template + void back_edge(const Edge& e, Graph& g) + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::vertices_size_type v_size_t; + + vertex_t s(source(e,g)); + vertex_t t(target(e,g)); + BOOST_USING_STD_MIN(); + + if ( t != get(parent, s) ) { + v_size_t s_low_df_number = get(low, s); + v_size_t t_df_number = get(df_number, t); + v_size_t s_least_ancestor_df_number = get(least_ancestor, s); + + put(low, s, + min BOOST_PREVENT_MACRO_SUBSTITUTION(s_low_df_number, + t_df_number) + ); + + put(least_ancestor, s, + min BOOST_PREVENT_MACRO_SUBSTITUTION(s_least_ancestor_df_number, + t_df_number + ) + ); + + } + } + + template + void finish_vertex(const Vertex& u, Graph& g) + { + typedef typename graph_traits::vertices_size_type v_size_t; + + Vertex u_parent = get(parent, u); + v_size_t u_parent_lowpoint = get(low, u_parent); + v_size_t u_lowpoint = get(low, u); + BOOST_USING_STD_MIN(); + + if (u_parent != u) + { + put(low, u_parent, + min BOOST_PREVENT_MACRO_SUBSTITUTION(u_lowpoint, + u_parent_lowpoint + ) + ); + } + } + + LowPointMap low; + DFSParentMap parent; + DFSNumberMap df_number; + LeastAncestorMap least_ancestor; + DFSParentEdgeMap df_edge; + SizeType count; + + }; + + + + + + + template + class boyer_myrvold_impl + { + + typedef typename graph_traits::vertices_size_type v_size_t; + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::edge_iterator edge_iterator_t; + typedef typename graph_traits::out_edge_iterator + out_edge_iterator_t; + typedef graph::detail::face_handle + face_handle_t; + typedef std::vector vertex_vector_t; + typedef std::vector edge_vector_t; + typedef std::list vertex_list_t; + typedef std::list< face_handle_t > face_handle_list_t; + typedef boost::shared_ptr< face_handle_list_t > face_handle_list_ptr_t; + typedef boost::shared_ptr< vertex_list_t > vertex_list_ptr_t; + typedef boost::tuple merge_stack_frame_t; + typedef std::vector merge_stack_t; + + template + struct map_vertex_to_ + { + typedef iterator_property_map + ::iterator, VertexIndexMap> type; + }; + + typedef typename map_vertex_to_::type vertex_to_v_size_map_t; + typedef typename map_vertex_to_::type vertex_to_vertex_map_t; + typedef typename map_vertex_to_::type vertex_to_edge_map_t; + typedef typename map_vertex_to_::type + vertex_to_vertex_list_ptr_map_t; + typedef typename map_vertex_to_< edge_vector_t >::type + vertex_to_edge_vector_map_t; + typedef typename map_vertex_to_::type vertex_to_bool_map_t; + typedef typename map_vertex_to_::type + vertex_to_face_handle_map_t; + typedef typename map_vertex_to_::type + vertex_to_face_handle_list_ptr_map_t; + typedef typename map_vertex_to_::type + vertex_to_separated_node_map_t; + + template + struct face_vertex_iterator + { + typedef face_iterator + type; + }; + + template + struct face_edge_iterator + { + typedef face_iterator + type; + }; + + + + public: + + + + boyer_myrvold_impl(const Graph& arg_g, VertexIndexMap arg_vm): + g(arg_g), + vm(arg_vm), + + low_point_vector(num_vertices(g)), + dfs_parent_vector(num_vertices(g)), + dfs_number_vector(num_vertices(g)), + least_ancestor_vector(num_vertices(g)), + pertinent_roots_vector(num_vertices(g)), + backedge_flag_vector(num_vertices(g), num_vertices(g) + 1), + visited_vector(num_vertices(g), num_vertices(g) + 1), + face_handles_vector(num_vertices(g)), + dfs_child_handles_vector(num_vertices(g)), + separated_dfs_child_list_vector(num_vertices(g)), + separated_node_in_parent_list_vector(num_vertices(g)), + canonical_dfs_child_vector(num_vertices(g)), + flipped_vector(num_vertices(g), false), + backedges_vector(num_vertices(g)), + dfs_parent_edge_vector(num_vertices(g)), + + vertices_by_dfs_num(num_vertices(g)), + + low_point(low_point_vector.begin(), vm), + dfs_parent(dfs_parent_vector.begin(), vm), + dfs_number(dfs_number_vector.begin(), vm), + least_ancestor(least_ancestor_vector.begin(), vm), + pertinent_roots(pertinent_roots_vector.begin(), vm), + backedge_flag(backedge_flag_vector.begin(), vm), + visited(visited_vector.begin(), vm), + face_handles(face_handles_vector.begin(), vm), + dfs_child_handles(dfs_child_handles_vector.begin(), vm), + separated_dfs_child_list(separated_dfs_child_list_vector.begin(), vm), + separated_node_in_parent_list + (separated_node_in_parent_list_vector.begin(), vm), + canonical_dfs_child(canonical_dfs_child_vector.begin(), vm), + flipped(flipped_vector.begin(), vm), + backedges(backedges_vector.begin(), vm), + dfs_parent_edge(dfs_parent_edge_vector.begin(), vm) + + { + + planar_dfs_visitor + vis + (low_point, dfs_parent, dfs_number, least_ancestor, dfs_parent_edge); + + // Perform a depth-first search to find each vertex's low point, least + // ancestor, and dfs tree information + depth_first_search(g, visitor(vis).vertex_index_map(vm)); + + // Sort vertices by their lowpoint - need this later in the constructor + vertex_vector_t vertices_by_lowpoint(num_vertices(g)); + std::copy( vertices(g).first, vertices(g).second, + vertices_by_lowpoint.begin() + ); + bucket_sort(vertices_by_lowpoint.begin(), + vertices_by_lowpoint.end(), + low_point, + num_vertices(g) + ); + + // Sort vertices by their dfs number - need this to iterate by reverse + // DFS number in the main loop. + std::copy( vertices(g).first, vertices(g).second, + vertices_by_dfs_num.begin() + ); + bucket_sort(vertices_by_dfs_num.begin(), + vertices_by_dfs_num.end(), + dfs_number, + num_vertices(g) + ); + + // Initialize face handles. A face handle is an abstraction that serves + // two uses in our implementation - it allows us to efficiently move + // along the outer face of embedded bicomps in a partially embedded + // graph, and it provides storage for the planar embedding. Face + // handles are implemented by a sequence of edges and are associated + // with a particular vertex - the sequence of edges represents the + // current embedding of edges around that vertex, and the first and + // last edges in the sequence represent the pair of edges on the outer + // face that are adjacent to the associated vertex. This lets us embed + // edges in the graph by just pushing them on the front or back of the + // sequence of edges held by the face handles. + // + // Our algorithm starts with a DFS tree of edges (where every vertex is + // an articulation point and every edge is a singleton bicomp) and + // repeatedly merges bicomps by embedding additional edges. Note that + // any bicomp at any point in the algorithm can be associated with a + // unique edge connecting the vertex of that bicomp with the lowest DFS + // number (which we refer to as the "root" of the bicomp) with its DFS + // child in the bicomp: the existence of two such edges would contradict + // the properties of a DFS tree. We refer to the DFS child of the root + // of a bicomp as the "canonical DFS child" of the bicomp. Note that a + // vertex can be the root of more than one bicomp. + // + // We move around the external faces of a bicomp using a few property + // maps, which we'll initialize presently: + // + // - face_handles: maps a vertex to a face handle that can be used to + // move "up" a bicomp. For a vertex that isn't an articulation point, + // this holds the face handles that can be used to move around that + // vertex's unique bicomp. For a vertex that is an articulation point, + // this holds the face handles associated with the unique bicomp that + // the vertex is NOT the root of. These handles can therefore be used + // to move from any point on the outer face of the tree of bicomps + // around the current outer face towards the root of the DFS tree. + // + // - dfs_child_handles: these are used to hold face handles for + // vertices that are articulation points - dfs_child_handles[v] holds + // the face handles corresponding to vertex u in the bicomp with root + // u and canonical DFS child v. + // + // - canonical_dfs_child: this property map allows one to determine the + // canonical DFS child of a bicomp while traversing the outer face. + // This property map is only valid when applied to one of the two + // vertices adjacent to the root of the bicomp on the outer face. To + // be more precise, if v is the canonical DFS child of a bicomp, + // canonical_dfs_child[dfs_child_handles[v].first_vertex()] == v and + // canonical_dfs_child[dfs_child_handles[v].second_vertex()] == v. + // + // - pertinent_roots: given a vertex v, pertinent_roots[v] contains a + // list of face handles pointing to the top of bicomps that need to + // be visited by the current walkdown traversal (since they lead to + // backedges that need to be embedded). These lists are populated by + // the walkup and consumed by the walkdown. + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + vertex_t parent = dfs_parent[v]; + + if (parent != v) + { + edge_t parent_edge = dfs_parent_edge[v]; + add_to_embedded_edges(parent_edge, StoreOldHandlesPolicy()); + face_handles[v] = face_handle_t(v, parent_edge, g); + dfs_child_handles[v] = face_handle_t(parent, parent_edge, g); + } + else + { + face_handles[v] = face_handle_t(v); + dfs_child_handles[v] = face_handle_t(parent); + } + + canonical_dfs_child[v] = v; + pertinent_roots[v] = face_handle_list_ptr_t(new face_handle_list_t); + separated_dfs_child_list[v] = vertex_list_ptr_t(new vertex_list_t); + + } + + // We need to create a list of not-yet-merged depth-first children for + // each vertex that will be updated as bicomps get merged. We sort each + // list by ascending lowpoint, which allows the externally_active + // function to run in constant time, and we keep a pointer to each + // vertex's representation in its parent's list, which allows merging + //in constant time. + + for(typename vertex_vector_t::iterator itr = + vertices_by_lowpoint.begin(); + itr != vertices_by_lowpoint.end(); ++itr) + { + vertex_t v(*itr); + vertex_t parent(dfs_parent[v]); + if (v != parent) + { + separated_node_in_parent_list[v] = + separated_dfs_child_list[parent]->insert + (separated_dfs_child_list[parent]->end(), v); + } + } + + // The merge stack holds path information during a walkdown iteration + merge_stack.reserve(num_vertices(g)); + + } + + + + + + + bool is_planar() + { + + // This is the main algorithm: starting with a DFS tree of embedded + // edges (which, since it's a tree, is planar), iterate through all + // vertices by reverse DFS number, attempting to embed all backedges + // connecting the current vertex to vertices with higher DFS numbers. + // + // The walkup is a procedure that examines all such backedges and sets + // up the required data structures so that they can be searched by the + // walkdown in linear time. The walkdown does the actual work of + // embedding edges and flipping bicomps, and can identify when it has + // come across a kuratowski subgraph. + // + // store_old_face_handles caches face handles from the previous + // iteration - this is used only for the kuratowski subgraph isolation, + // and is therefore dispatched based on the StoreOldHandlesPolicy. + // + // clean_up_embedding does some clean-up and fills in values that have + // to be computed lazily during the actual execution of the algorithm + // (for instance, whether or not a bicomp is flipped in the final + // embedding). It's dispatched on the the StoreEmbeddingPolicy, since + // it's not needed if an embedding isn't desired. + + typename vertex_vector_t::reverse_iterator vi, vi_end; + + vi_end = vertices_by_dfs_num.rend(); + for(vi = vertices_by_dfs_num.rbegin(); vi != vi_end; ++vi) + { + + store_old_face_handles(StoreOldHandlesPolicy()); + + vertex_t v(*vi); + + walkup(v); + + if (!walkdown(v)) + return false; + + } + + clean_up_embedding(StoreEmbeddingPolicy()); + + return true; + + } + + + + + + + private: + + + + + + void walkup(vertex_t v) + { + + // The point of the walkup is to follow all backedges from v to + // vertices with higher DFS numbers, and update pertinent_roots + // for the bicomp roots on the path from backedge endpoints up + // to v. This will set the stage for the walkdown to efficiently + // traverse the graph of bicomps down from v. + + typedef typename face_vertex_iterator::type walkup_iterator_t; + + out_edge_iterator_t oi, oi_end; + for(tie(oi,oi_end) = out_edges(v,g); oi != oi_end; ++oi) + { + edge_t e(*oi); + vertex_t e_source(source(e,g)); + vertex_t e_target(target(e,g)); + + if (e_source == e_target) + { + self_loops.push_back(e); + continue; + } + + vertex_t w(e_source == v ? e_target : e_source); + + //continue if not a back edge or already embedded + if (dfs_number[w] < dfs_number[v] || e == dfs_parent_edge[w]) + continue; + + backedges[w].push_back(e); + + v_size_t timestamp = dfs_number[v]; + backedge_flag[w] = timestamp; + + walkup_iterator_t walkup_itr(w, face_handles); + walkup_iterator_t walkup_end; + vertex_t lead_vertex = w; + + while (true) + { + + // Move to the root of the current bicomp or the first visited + // vertex on the bicomp by going up each side in parallel + + while(walkup_itr != walkup_end && + visited[*walkup_itr] != timestamp + ) + { + lead_vertex = *walkup_itr; + visited[lead_vertex] = timestamp; + ++walkup_itr; + } + + // If we've found the root of a bicomp through a path we haven't + // seen before, update pertinent_roots with a handle to the + // current bicomp. Otherwise, we've just seen a path we've been + // up before, so break out of the main while loop. + + if (walkup_itr == walkup_end) + { + vertex_t dfs_child = canonical_dfs_child[lead_vertex]; + vertex_t parent = dfs_parent[dfs_child]; + + visited[dfs_child_handles[dfs_child].first_vertex()] + = timestamp; + visited[dfs_child_handles[dfs_child].second_vertex()] + = timestamp; + + if (low_point[dfs_child] < dfs_number[v] || + least_ancestor[dfs_child] < dfs_number[v] + ) + { + pertinent_roots[parent]->push_back + (dfs_child_handles[dfs_child]); + } + else + { + pertinent_roots[parent]->push_front + (dfs_child_handles[dfs_child]); + } + + if (parent != v && visited[parent] != timestamp) + { + walkup_itr = walkup_iterator_t(parent, face_handles); + lead_vertex = parent; + } + else + break; + } + else + break; + } + + } + + } + + + + + + + + bool walkdown(vertex_t v) + { + // This procedure is where all of the action is - pertinent_roots + // has already been set up by the walkup, so we just need to move + // down bicomps from v until we find vertices that have been + // labeled as backedge endpoints. Once we find such a vertex, we + // embed the corresponding edge and glue together the bicomps on + // the path connecting the two vertices in the edge. This may + // involve flipping bicomps along the way. + + vertex_t w; //the other endpoint of the edge we're embedding + + while (!pertinent_roots[v]->empty()) + { + + face_handle_t root_face_handle = pertinent_roots[v]->front(); + face_handle_t curr_face_handle = root_face_handle; + pertinent_roots[v]->pop_front(); + + merge_stack.clear(); + + while(true) + { + + typename face_vertex_iterator<>::type + first_face_itr, second_face_itr, face_end; + vertex_t first_side_vertex + = graph_traits::null_vertex(); + vertex_t second_side_vertex; + vertex_t first_tail, second_tail; + + first_tail = second_tail = curr_face_handle.get_anchor(); + first_face_itr = typename face_vertex_iterator<>::type + (curr_face_handle, face_handles, first_side()); + second_face_itr = typename face_vertex_iterator<>::type + (curr_face_handle, face_handles, second_side()); + + for(; first_face_itr != face_end; ++first_face_itr) + { + vertex_t face_vertex(*first_face_itr); + if (pertinent(face_vertex, v) || + externally_active(face_vertex, v) + ) + { + first_side_vertex = face_vertex; + second_side_vertex = face_vertex; + break; + } + first_tail = face_vertex; + } + + if (first_side_vertex == graph_traits::null_vertex() || + first_side_vertex == curr_face_handle.get_anchor() + ) + break; + + for(;second_face_itr != face_end; ++second_face_itr) + { + vertex_t face_vertex(*second_face_itr); + if (pertinent(face_vertex, v) || + externally_active(face_vertex, v) + ) + { + second_side_vertex = face_vertex; + break; + } + second_tail = face_vertex; + } + + vertex_t chosen; + bool chose_first_upper_path; + if (internally_active(first_side_vertex, v)) + { + chosen = first_side_vertex; + chose_first_upper_path = true; + } + else if (internally_active(second_side_vertex, v)) + { + chosen = second_side_vertex; + chose_first_upper_path = false; + } + else if (pertinent(first_side_vertex, v)) + { + chosen = first_side_vertex; + chose_first_upper_path = true; + } + else if (pertinent(second_side_vertex, v)) + { + chosen = second_side_vertex; + chose_first_upper_path = false; + } + else + { + + // If there's a pertinent vertex on the lower face + // between the first_face_itr and the second_face_itr, + // this graph isn't planar. + for(; + *first_face_itr != second_side_vertex; + ++first_face_itr + ) + { + vertex_t p(*first_face_itr); + if (pertinent(p,v)) + { + //Found a Kuratowski subgraph + kuratowski_v = v; + kuratowski_x = first_side_vertex; + kuratowski_y = second_side_vertex; + return false; + } + } + + // Otherwise, the fact that we didn't find a pertinent + // vertex on this face is fine - we should set the + // short-circuit edges and break out of this loop to + // start looking at a different pertinent root. + + if (first_side_vertex == second_side_vertex) + { + if (first_tail != v) + { + vertex_t first + = face_handles[first_tail].first_vertex(); + vertex_t second + = face_handles[first_tail].second_vertex(); + tie(first_side_vertex, first_tail) + = make_tuple(first_tail, + first == first_side_vertex ? + second : first + ); + } + else if (second_tail != v) + { + vertex_t first + = face_handles[second_tail].first_vertex(); + vertex_t second + = face_handles[second_tail].second_vertex(); + tie(second_side_vertex, second_tail) + = make_tuple(second_tail, + first == second_side_vertex ? + second : first); + } + else + break; + } + + canonical_dfs_child[first_side_vertex] + = canonical_dfs_child[root_face_handle.first_vertex()]; + canonical_dfs_child[second_side_vertex] + = canonical_dfs_child[root_face_handle.second_vertex()]; + root_face_handle.set_first_vertex(first_side_vertex); + root_face_handle.set_second_vertex(second_side_vertex); + + if (face_handles[first_side_vertex].first_vertex() == + first_tail + ) + face_handles[first_side_vertex].set_first_vertex(v); + else + face_handles[first_side_vertex].set_second_vertex(v); + + if (face_handles[second_side_vertex].first_vertex() == + second_tail + ) + face_handles[second_side_vertex].set_first_vertex(v); + else + face_handles[second_side_vertex].set_second_vertex(v); + + break; + + } + + + // When we unwind the stack, we need to know which direction + // we came down from on the top face handle + + bool chose_first_lower_path = + (chose_first_upper_path && + face_handles[chosen].first_vertex() == first_tail) + || + (!chose_first_upper_path && + face_handles[chosen].first_vertex() == second_tail); + + //If there's a backedge at the chosen vertex, embed it now + if (backedge_flag[chosen] == dfs_number[v]) + { + w = chosen; + + backedge_flag[chosen] = num_vertices(g) + 1; + add_to_merge_points(chosen, StoreOldHandlesPolicy()); + + typename edge_vector_t::iterator ei, ei_end; + ei_end = backedges[chosen].end(); + for(ei = backedges[chosen].begin(); ei != ei_end; ++ei) + { + edge_t e(*ei); + add_to_embedded_edges(e, StoreOldHandlesPolicy()); + + if (chose_first_lower_path) + face_handles[chosen].push_first(e, g); + else + face_handles[chosen].push_second(e, g); + } + + } + else + { + merge_stack.push_back(make_tuple + (chosen, chose_first_upper_path, chose_first_lower_path) + ); + curr_face_handle = *pertinent_roots[chosen]->begin(); + continue; + } + + //Unwind the merge stack to the root, merging all bicomps + + bool bottom_path_follows_first; + bool top_path_follows_first; + bool next_bottom_follows_first = chose_first_upper_path; + face_handle_t top_handle, bottom_handle; + + vertex_t merge_point = chosen; + + while(!merge_stack.empty()) + { + + bottom_path_follows_first = next_bottom_follows_first; + tie(merge_point, + next_bottom_follows_first, + top_path_follows_first + ) = merge_stack.back(); + merge_stack.pop_back(); + + face_handle_t top_handle(face_handles[merge_point]); + face_handle_t bottom_handle + (*pertinent_roots[merge_point]->begin()); + + vertex_t bottom_dfs_child = canonical_dfs_child + [pertinent_roots[merge_point]->begin()->first_vertex()]; + + remove_vertex_from_separated_dfs_child_list( + canonical_dfs_child + [pertinent_roots[merge_point]->begin()->first_vertex()] + ); + + pertinent_roots[merge_point]->pop_front(); + + add_to_merge_points(top_handle.get_anchor(), + StoreOldHandlesPolicy() + ); + + if (top_path_follows_first && bottom_path_follows_first) + { + bottom_handle.flip(); + top_handle.glue_first_to_second(bottom_handle); + } + else if (!top_path_follows_first && + bottom_path_follows_first + ) + { + flipped[bottom_dfs_child] = true; + top_handle.glue_second_to_first(bottom_handle); + } + else if (top_path_follows_first && + !bottom_path_follows_first + ) + { + flipped[bottom_dfs_child] = true; + top_handle.glue_first_to_second(bottom_handle); + } + else //!top_path_follows_first && !bottom_path_follows_first + { + bottom_handle.flip(); + top_handle.glue_second_to_first(bottom_handle); + } + + } + + //Finally, embed all edges (v,w) at their upper end points + canonical_dfs_child[w] + = canonical_dfs_child[root_face_handle.first_vertex()]; + + add_to_merge_points(root_face_handle.get_anchor(), + StoreOldHandlesPolicy() + ); + + typename edge_vector_t::iterator ei, ei_end; + ei_end = backedges[chosen].end(); + for(ei = backedges[chosen].begin(); ei != ei_end; ++ei) + { + if (next_bottom_follows_first) + root_face_handle.push_first(*ei, g); + else + root_face_handle.push_second(*ei, g); + } + + backedges[chosen].clear(); + curr_face_handle = root_face_handle; + + }//while(true) + + }//while(!pertinent_roots[v]->empty()) + + return true; + + } + + + + + + + void store_old_face_handles(graph::detail::no_old_handles) {} + + void store_old_face_handles(graph::detail::store_old_handles) + { + for(typename std::vector::iterator mp_itr + = current_merge_points.begin(); + mp_itr != current_merge_points.end(); ++mp_itr) + { + face_handles[*mp_itr].store_old_face_handles(); + } + current_merge_points.clear(); + } + + + void add_to_merge_points(vertex_t v, graph::detail::no_old_handles) {} + + void add_to_merge_points(vertex_t v, graph::detail::store_old_handles) + { + current_merge_points.push_back(v); + } + + + void add_to_embedded_edges(edge_t e, graph::detail::no_old_handles) {} + + void add_to_embedded_edges(edge_t e, graph::detail::store_old_handles) + { + embedded_edges.push_back(e); + } + + + + + void clean_up_embedding(graph::detail::no_embedding) {} + + void clean_up_embedding(graph::detail::store_embedding) + { + + // If the graph isn't biconnected, we'll still have entries + // in the separated_dfs_child_list for some vertices. Since + // these represent articulation points, we can obtain a + // planar embedding no matter what order we embed them in. + + vertex_iterator_t xi, xi_end; + for(tie(xi,xi_end) = vertices(g); xi != xi_end; ++xi) + { + if (!separated_dfs_child_list[*xi]->empty()) + { + typename vertex_list_t::iterator yi, yi_end; + yi_end = separated_dfs_child_list[*xi]->end(); + for(yi = separated_dfs_child_list[*xi]->begin(); + yi != yi_end; ++yi + ) + { + dfs_child_handles[*yi].flip(); + face_handles[*xi].glue_first_to_second + (dfs_child_handles[*yi]); + } + } + } + + // Up until this point, we've flipped bicomps lazily by setting + // flipped[v] to true if the bicomp rooted at v was flipped (the + // lazy aspect of this flip is that all descendents of that vertex + // need to have their orientations reversed as well). Now, we + // traverse the DFS tree by DFS number and perform the actual + // flipping as needed + + typedef typename vertex_vector_t::iterator vertex_vector_itr_t; + vertex_vector_itr_t vi_end = vertices_by_dfs_num.end(); + for(vertex_vector_itr_t vi = vertices_by_dfs_num.begin(); + vi != vi_end; ++vi + ) + { + vertex_t v(*vi); + bool v_flipped = flipped[v]; + bool p_flipped = flipped[dfs_parent[v]]; + if (v_flipped && !p_flipped) + { + face_handles[v].flip(); + } + else if (p_flipped && !v_flipped) + { + face_handles[v].flip(); + flipped[v] = true; + } + else + { + flipped[v] = false; + } + } + + // If there are any self-loops in the graph, they were flagged + // during the walkup, and we should add them to the embedding now. + // Adding a self loop anywhere in the embedding could never + // invalidate the embedding, but they would complicate the traversal + // if they were added during the walkup/walkdown. + + typename edge_vector_t::iterator ei, ei_end; + ei_end = self_loops.end(); + for(ei = self_loops.begin(); ei != ei_end; ++ei) + { + edge_t e(*ei); + face_handles[source(e,g)].push_second(e,g); + } + + } + + + + + + bool pertinent(vertex_t w, vertex_t v) + { + // w is pertinent with respect to v if there is a backedge (v,w) or if + // w is the root of a bicomp that contains a pertinent vertex. + + return backedge_flag[w] == dfs_number[v] || !pertinent_roots[w]->empty(); + } + + + + bool externally_active(vertex_t w, vertex_t v) + { + // Let a be any proper depth-first search ancestor of v. w is externally + // active with respect to v if there exists a backedge (a,w) or a + // backedge (a,w_0) for some w_0 in a descendent bicomp of w. + + v_size_t dfs_number_of_v = dfs_number[v]; + return (least_ancestor[w] < dfs_number_of_v) || + (!separated_dfs_child_list[w]->empty() && + low_point[separated_dfs_child_list[w]->front()] < dfs_number_of_v); + } + + + + bool internally_active(vertex_t w, vertex_t v) + { + return pertinent(w,v) && !externally_active(w,v); + } + + + + + void remove_vertex_from_separated_dfs_child_list(vertex_t v) + { + typename vertex_list_t::iterator to_delete + = separated_node_in_parent_list[v]; + garbage.splice(garbage.end(), + *separated_dfs_child_list[dfs_parent[v]], + to_delete, + next(to_delete) + ); + } + + + + + + // End of the implementation of the basic Boyer-Myrvold Algorithm. The rest + // of the code below implements the isolation of a Kuratowski subgraph in + // the case that the input graph is not planar. This is by far the most + // complicated part of the implementation. + + + + + public: + + + + + template + vertex_t kuratowski_walkup(vertex_t v, + EdgeToBoolPropertyMap forbidden_edge, + EdgeToBoolPropertyMap goal_edge, + EdgeToBoolPropertyMap is_embedded, + EdgeContainer& path_edges + ) + { + vertex_t current_endpoint; + bool seen_goal_edge = false; + out_edge_iterator_t oi, oi_end; + + for(tie(oi,oi_end) = out_edges(v,g); oi != oi_end; ++oi) + forbidden_edge[*oi] = true; + + for(tie(oi,oi_end) = out_edges(v,g); oi != oi_end; ++oi) + { + path_edges.clear(); + + edge_t e(*oi); + current_endpoint = target(*oi,g) == v ? + source(*oi,g) : target(*oi,g); + + if (dfs_number[current_endpoint] < dfs_number[v] || + is_embedded[e] || + v == current_endpoint //self-loop + ) + { + //Not a backedge + continue; + } + + path_edges.push_back(e); + if (goal_edge[e]) + { + return current_endpoint; + } + + typedef typename face_edge_iterator<>::type walkup_itr_t; + + walkup_itr_t + walkup_itr(current_endpoint, face_handles, first_side()); + walkup_itr_t walkup_end; + + seen_goal_edge = false; + + while (true) + { + + if (walkup_itr != walkup_end && forbidden_edge[*walkup_itr]) + break; + + while(walkup_itr != walkup_end && + !goal_edge[*walkup_itr] && + !forbidden_edge[*walkup_itr] + ) + { + edge_t f(*walkup_itr); + forbidden_edge[f] = true; + path_edges.push_back(f); + current_endpoint = + source(f, g) == current_endpoint ? + target(f, g) : + source(f,g); + ++walkup_itr; + } + + if (walkup_itr != walkup_end && goal_edge[*walkup_itr]) + { + path_edges.push_back(*walkup_itr); + seen_goal_edge = true; + break; + } + + walkup_itr + = walkup_itr_t(current_endpoint, face_handles, first_side()); + + } + + if (seen_goal_edge) + break; + + } + + if (seen_goal_edge) + return current_endpoint; + else + return graph_traits::null_vertex(); + + } + + + + + + + + + template + void extract_kuratowski_subgraph(OutputIterator o_itr, EdgeIndexMap em) + { + + // If the main algorithm has failed to embed one of the back-edges from + // a vertex v, we can use the current state of the algorithm to isolate + // a Kuratowksi subgraph. The isolation process breaks down into five + // cases, A - E. The general configuration of all five cases is shown in + // figure 1. There is a vertex v from which the planar + // v embedding process could not proceed. This means that + // | there exists some bicomp containing three vertices + // ----- x,y, and z as shown such that x and y are externally + // | | active with respect to v (which means that there are + // x y two vertices x_0 and y_0 such that (1) both x_0 and + // | | y_0 are proper depth-first search ancestors of v and + // --z-- (2) there are two disjoint paths, one connecting x + // and x_0 and one connecting y and y_0, both consisting + // fig. 1 entirely of unembedded edges). Furthermore, there + // exists a vertex z_0 such that z is a depth-first + // search ancestor of z_0 and (v,z_0) is an unembedded back-edge from v. + // x,y and z all exist on the same bicomp, which consists entirely of + // embedded edges. The five subcases break down as follows, and are + // handled by the algorithm logically in the order A-E: First, if v is + // not on the same bicomp as x,y, and z, a K_3_3 can be isolated - this + // is case A. So, we'll assume that v is on the same bicomp as x,y, and + // z. If z_0 is on a different bicomp than x,y, and z, a K_3_3 can also + // be isolated - this is a case B - so we'll assume from now on that v + // is on the same bicomp as x, y, and z=z_0. In this case, one can use + // properties of the Boyer-Myrvold algorithm to show the existence of an + // "x-y path" connecting some vertex on the "left side" of the x,y,z + // bicomp with some vertex on the "right side" of the bicomp (where the + // left and right are split by a line drawn through v and z.If either of + // the endpoints of the x-y path is above x or y on the bicomp, a K_3_3 + // can be isolated - this is a case C. Otherwise, both endpoints are at + // or below x and y on the bicomp. If there is a vertex alpha on the x-y + // path such that alpha is not x or y and there's a path from alpha to v + // that's disjoint from any of the edges on the bicomp and the x-y path, + // a K_3_3 can be isolated - this is a case D. Otherwise, properties of + // the Boyer-Myrvold algorithm can be used to show that another vertex + // w exists on the lower half of the bicomp such that w is externally + // active with respect to v. w can then be used to isolate a K_5 - this + // is the configuration of case E. + + vertex_iterator_t vi, vi_end; + edge_iterator_t ei, ei_end; + out_edge_iterator_t oei, oei_end; + typename std::vector::iterator xi, xi_end; + + // Clear the short-circuit edges - these are needed for the planar + // testing/embedding algorithm to run in linear time, but they'll + // complicate the kuratowski subgraph isolation + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + face_handles[*vi].reset_vertex_cache(); + dfs_child_handles[*vi].reset_vertex_cache(); + } + + vertex_t v = kuratowski_v; + vertex_t x = kuratowski_x; + vertex_t y = kuratowski_y; + + typedef iterator_property_map + ::iterator, EdgeIndexMap> + edge_to_bool_map_t; + + std::vector is_in_subgraph_vector(num_edges(g), false); + edge_to_bool_map_t is_in_subgraph(is_in_subgraph_vector.begin(), em); + + std::vector is_embedded_vector(num_edges(g), false); + edge_to_bool_map_t is_embedded(is_embedded_vector.begin(), em); + + typename std::vector::iterator embedded_itr, embedded_end; + embedded_end = embedded_edges.end(); + for(embedded_itr = embedded_edges.begin(); + embedded_itr != embedded_end; ++embedded_itr + ) + is_embedded[*embedded_itr] = true; + + // upper_face_vertex is true for x,y, and all vertices above x and y in + // the bicomp + std::vector upper_face_vertex_vector(num_vertices(g), false); + vertex_to_bool_map_t upper_face_vertex + (upper_face_vertex_vector.begin(), vm); + + std::vector lower_face_vertex_vector(num_vertices(g), false); + vertex_to_bool_map_t lower_face_vertex + (lower_face_vertex_vector.begin(), vm); + + // These next few variable declarations are all things that we need + // to find. + vertex_t z; + vertex_t bicomp_root; + vertex_t w = graph_traits::null_vertex(); + face_handle_t w_handle; + face_handle_t v_dfchild_handle; + vertex_t first_x_y_path_endpoint = graph_traits::null_vertex(); + vertex_t second_x_y_path_endpoint = graph_traits::null_vertex(); + vertex_t w_ancestor = v; + + enum case_t{NO_CASE_CHOSEN, CASE_A, CASE_B, CASE_C, CASE_D, CASE_E}; + case_t chosen_case = NO_CASE_CHOSEN; + + std::vector x_external_path; + std::vector y_external_path; + std::vector case_d_edges; + + std::vector z_v_path; + std::vector w_path; + + //first, use a walkup to find a path from V that starts with a + //backedge from V, then goes up until it hits either X or Y + //(but doesn't find X or Y as the root of a bicomp) + + typename face_vertex_iterator<>::type + x_upper_itr(x, face_handles, first_side()); + typename face_vertex_iterator<>::type + x_lower_itr(x, face_handles, second_side()); + typename face_vertex_iterator<>::type face_itr, face_end; + + // Don't know which path from x is the upper or lower path - + // we'll find out here + for(face_itr = x_upper_itr; face_itr != face_end; ++face_itr) + { + if (*face_itr == y) + { + std::swap(x_upper_itr, x_lower_itr); + break; + } + } + + upper_face_vertex[x] = true; + + vertex_t current_vertex = x; + vertex_t previous_vertex; + for(face_itr = x_upper_itr; face_itr != face_end; ++face_itr) + { + previous_vertex = current_vertex; + current_vertex = *face_itr; + upper_face_vertex[current_vertex] = true; + } + + v_dfchild_handle + = dfs_child_handles[canonical_dfs_child[previous_vertex]]; + + for(face_itr = x_lower_itr; *face_itr != y; ++face_itr) + { + vertex_t current_vertex(*face_itr); + lower_face_vertex[current_vertex] = true; + + typename face_handle_list_t::iterator roots_itr, roots_end; + + if (w == graph_traits::null_vertex()) //haven't found a w yet + { + roots_end = pertinent_roots[current_vertex]->end(); + for(roots_itr = pertinent_roots[current_vertex]->begin(); + roots_itr != roots_end; ++roots_itr + ) + { + if (low_point[canonical_dfs_child[roots_itr->first_vertex()]] + < dfs_number[v] + ) + { + w = current_vertex; + w_handle = *roots_itr; + break; + } + } + } + + } + + for(; face_itr != face_end; ++face_itr) + { + vertex_t current_vertex(*face_itr); + upper_face_vertex[current_vertex] = true; + bicomp_root = current_vertex; + } + + typedef typename face_edge_iterator<>::type walkup_itr_t; + + std::vector outer_face_edge_vector(num_edges(g), false); + edge_to_bool_map_t outer_face_edge(outer_face_edge_vector.begin(), em); + + walkup_itr_t walkup_end; + for(walkup_itr_t walkup_itr(x, face_handles, first_side()); + walkup_itr != walkup_end; ++walkup_itr + ) + { + outer_face_edge[*walkup_itr] = true; + is_in_subgraph[*walkup_itr] = true; + } + + for(walkup_itr_t walkup_itr(x, face_handles, second_side()); + walkup_itr != walkup_end; ++walkup_itr + ) + { + outer_face_edge[*walkup_itr] = true; + is_in_subgraph[*walkup_itr] = true; + } + + std::vector forbidden_edge_vector(num_edges(g), false); + edge_to_bool_map_t forbidden_edge(forbidden_edge_vector.begin(), em); + + std::vector goal_edge_vector(num_edges(g), false); + edge_to_bool_map_t goal_edge(goal_edge_vector.begin(), em); + + + //Find external path to x and to y + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] + = !outer_face_edge[e] && (source(e,g) == x || target(e,g) == x); + forbidden_edge[*ei] = outer_face_edge[*ei]; + } + + vertex_t x_ancestor = v; + vertex_t x_endpoint = graph_traits::null_vertex(); + + while(x_endpoint == graph_traits::null_vertex()) + { + x_ancestor = dfs_parent[x_ancestor]; + x_endpoint = kuratowski_walkup(x_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + x_external_path + ); + + } + + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] + = !outer_face_edge[e] && (source(e,g) == y || target(e,g) == y); + forbidden_edge[*ei] = outer_face_edge[*ei]; + } + + vertex_t y_ancestor = v; + vertex_t y_endpoint = graph_traits::null_vertex(); + + while(y_endpoint == graph_traits::null_vertex()) + { + y_ancestor = dfs_parent[y_ancestor]; + y_endpoint = kuratowski_walkup(y_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + y_external_path + ); + + } + + + vertex_t parent, child; + + //If v isn't on the same bicomp as x and y, it's a case A + if (bicomp_root != v) + { + chosen_case = CASE_A; + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + if (lower_face_vertex[*vi]) + for(tie(oei,oei_end) = out_edges(*vi,g); oei != oei_end; ++oei) + if(!outer_face_edge[*oei]) + goal_edge[*oei] = true; + + for(tie(ei,ei_end) = edges(g); ei != ei_end; ++ei) + forbidden_edge[*ei] = outer_face_edge[*ei]; + + z = kuratowski_walkup + (v, forbidden_edge, goal_edge, is_embedded, z_v_path); + + } + else if (w != graph_traits::null_vertex()) + { + chosen_case = CASE_B; + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] = false; + forbidden_edge[e] = outer_face_edge[e]; + } + + goal_edge[w_handle.first_edge()] = true; + goal_edge[w_handle.second_edge()] = true; + + z = kuratowski_walkup(v, + forbidden_edge, + goal_edge, + is_embedded, + z_v_path + ); + + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + forbidden_edge[*ei] = outer_face_edge[*ei]; + } + + typename std::vector::iterator pi, pi_end; + pi_end = z_v_path.end(); + for(pi = z_v_path.begin(); pi != pi_end; ++pi) + { + goal_edge[*pi] = true; + } + + w_ancestor = v; + vertex_t w_endpoint = graph_traits::null_vertex(); + + while(w_endpoint == graph_traits::null_vertex()) + { + w_ancestor = dfs_parent[w_ancestor]; + w_endpoint = kuratowski_walkup(w_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + w_path + ); + + } + + // We really want both the w walkup and the z walkup to finish on + // exactly the same edge, but for convenience (since we don't have + // control over which side of a bicomp a walkup moves up) we've + // defined the walkup to either end at w_handle.first_edge() or + // w_handle.second_edge(). If both walkups ended at different edges, + // we'll do a little surgery on the w walkup path to make it follow + // the other side of the final bicomp. + + if ((w_path.back() == w_handle.first_edge() && + z_v_path.back() == w_handle.second_edge()) + || + (w_path.back() == w_handle.second_edge() && + z_v_path.back() == w_handle.first_edge()) + ) + { + walkup_itr_t wi, wi_end; + edge_t final_edge = w_path.back(); + vertex_t anchor + = source(final_edge, g) == w_handle.get_anchor() ? + target(final_edge, g) : source(final_edge, g); + if (face_handles[anchor].first_edge() == final_edge) + wi = walkup_itr_t(anchor, face_handles, second_side()); + else + wi = walkup_itr_t(anchor, face_handles, first_side()); + + w_path.pop_back(); + + for(; wi != wi_end; ++wi) + { + edge_t e(*wi); + if (w_path.back() == e) + w_path.pop_back(); + else + w_path.push_back(e); + } + } + + + } + else + { + + //We need to find a valid z, since the x-y path re-defines the lower + //face, and the z we found earlier may now be on the upper face. + + chosen_case = CASE_E; + + + // The z we've used so far is just an externally active vertex on the + // lower face path, but may not be the z we need for a case C, D, or + // E subgraph. the z we need now is any externally active vertex on + // the lower face path with both old_face_handles edges on the outer + // face. Since we know an x-y path exists, such a z must also exist. + + //TODO: find this z in the first place. + + //find the new z + + for(face_itr = x_lower_itr; *face_itr != y; ++face_itr) + { + vertex_t possible_z(*face_itr); + if (pertinent(possible_z,v) && + outer_face_edge[face_handles[possible_z].old_first_edge()] && + outer_face_edge[face_handles[possible_z].old_second_edge()] + ) + { + z = possible_z; + break; + } + } + + //find x-y path, and a w if one exists. + + if (externally_active(z,v)) + w = z; + + + typedef typename face_edge_iterator + ::type old_face_iterator_t; + + old_face_iterator_t + first_old_face_itr(z, face_handles, first_side()); + old_face_iterator_t + second_old_face_itr(z, face_handles, second_side()); + old_face_iterator_t old_face_itr, old_face_end; + + std::vector old_face_iterators; + old_face_iterators.push_back(first_old_face_itr); + old_face_iterators.push_back(second_old_face_itr); + + std::vector x_y_path_vertex_vector(num_vertices(g), false); + vertex_to_bool_map_t x_y_path_vertex + (x_y_path_vertex_vector.begin(), vm); + + typename std::vector::iterator + of_itr, of_itr_end; + of_itr_end = old_face_iterators.end(); + for(of_itr = old_face_iterators.begin(); + of_itr != of_itr_end; ++of_itr + ) + { + + old_face_itr = *of_itr; + + vertex_t previous_vertex; + bool seen_x_or_y = false; + vertex_t current_vertex = z; + for(; old_face_itr != old_face_end; ++old_face_itr) + { + edge_t e(*old_face_itr); + previous_vertex = current_vertex; + current_vertex = source(e,g) == current_vertex ? + target(e,g) : source(e,g); + + if (current_vertex == x || current_vertex == y) + seen_x_or_y = true; + + if (w == graph_traits::null_vertex() && + externally_active(current_vertex,v) && + outer_face_edge[e] && + outer_face_edge[*next(old_face_itr)] && + !seen_x_or_y + ) + { + w = current_vertex; + } + + if (!outer_face_edge[e]) + { + if (!upper_face_vertex[current_vertex] && + !lower_face_vertex[current_vertex] + ) + { + x_y_path_vertex[current_vertex] = true; + } + + is_in_subgraph[e] = true; + if (upper_face_vertex[source(e,g)] || + lower_face_vertex[source(e,g)] + ) + { + if (first_x_y_path_endpoint == + graph_traits::null_vertex() + ) + first_x_y_path_endpoint = source(e,g); + else + second_x_y_path_endpoint = source(e,g); + } + if (upper_face_vertex[target(e,g)] || + lower_face_vertex[target(e,g)] + ) + { + if (first_x_y_path_endpoint == + graph_traits::null_vertex() + ) + first_x_y_path_endpoint = target(e,g); + else + second_x_y_path_endpoint = target(e,g); + } + + + } + else if (previous_vertex == x || previous_vertex == y) + { + chosen_case = CASE_C; + } + + } + + } + + // Look for a case D - one of v's embedded edges will connect to the + // x-y path along an inner face path. + + //First, get a list of all of v's embedded child edges + + out_edge_iterator_t v_edge_itr, v_edge_end; + for(tie(v_edge_itr,v_edge_end) = out_edges(v,g); + v_edge_itr != v_edge_end; ++v_edge_itr + ) + { + edge_t embedded_edge(*v_edge_itr); + + if (!is_embedded[embedded_edge] || + embedded_edge == dfs_parent_edge[v] + ) + continue; + + case_d_edges.push_back(embedded_edge); + + vertex_t current_vertex + = source(embedded_edge,g) == v ? + target(embedded_edge,g) : source(embedded_edge,g); + + typename face_edge_iterator<>::type + internal_face_itr, internal_face_end; + if (face_handles[current_vertex].first_vertex() == v) + { + internal_face_itr = typename face_edge_iterator<>::type + (current_vertex, face_handles, second_side()); + } + else + { + internal_face_itr = typename face_edge_iterator<>::type + (current_vertex, face_handles, first_side()); + } + + while(internal_face_itr != internal_face_end && + !outer_face_edge[*internal_face_itr] && + !x_y_path_vertex[current_vertex] + ) + { + edge_t e(*internal_face_itr); + case_d_edges.push_back(e); + current_vertex = + source(e,g) == current_vertex ? target(e,g) : source(e,g); + ++internal_face_itr; + } + + if (x_y_path_vertex[current_vertex]) + { + chosen_case = CASE_D; + break; + } + else + { + case_d_edges.clear(); + } + + } + + + } + + + + + if (chosen_case != CASE_B && chosen_case != CASE_A) + { + + //Finding z and w. + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] = !outer_face_edge[e] && + (source(e,g) == z || target(e,g) == z); + forbidden_edge[e] = outer_face_edge[e]; + } + + kuratowski_walkup(v, + forbidden_edge, + goal_edge, + is_embedded, + z_v_path + ); + + if (chosen_case == CASE_E) + { + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + forbidden_edge[*ei] = outer_face_edge[*ei]; + goal_edge[*ei] = !outer_face_edge[*ei] && + (source(*ei,g) == w || target(*ei,g) == w); + } + + for(tie(oei, oei_end) = out_edges(w,g); oei != oei_end; ++oei) + { + if (!outer_face_edge[*oei]) + goal_edge[*oei] = true; + } + + typename std::vector::iterator pi, pi_end; + pi_end = z_v_path.end(); + for(pi = z_v_path.begin(); pi != pi_end; ++pi) + { + goal_edge[*pi] = true; + } + + w_ancestor = v; + vertex_t w_endpoint = graph_traits::null_vertex(); + + while(w_endpoint == graph_traits::null_vertex()) + { + w_ancestor = dfs_parent[w_ancestor]; + w_endpoint = kuratowski_walkup(w_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + w_path + ); + + } + + } + + + } + + + //We're done isolating the Kuratowski subgraph at this point - + //but there's still some cleaning up to do. + + //Update is_in_subgraph with the paths we just found + + xi_end = x_external_path.end(); + for(xi = x_external_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = y_external_path.end(); + for(xi = y_external_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = z_v_path.end(); + for(xi = z_v_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = case_d_edges.end(); + for(xi = case_d_edges.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = w_path.end(); + for(xi = w_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + child = bicomp_root; + parent = dfs_parent[child]; + while(child != parent) + { + is_in_subgraph[dfs_parent_edge[child]] = true; + tie(parent, child) = std::make_pair( dfs_parent[parent], parent ); + } + + + + + // At this point, we've already isolated the Kuratowski subgraph and + // collected all of the edges that compose it in the is_in_subgraph + // property map. But we want the verification of such a subgraph to be + // a deterministic process, and we can simplify the function + // is_kuratowski_subgraph by cleaning up some edges here. + + if (chosen_case == CASE_B) + { + is_in_subgraph[dfs_parent_edge[v]] = false; + } + else if (chosen_case == CASE_C) + { + // In a case C subgraph, at least one of the x-y path endpoints + // (call it alpha) is above either x or y on the outer face. The + // other endpoint may be attached at x or y OR above OR below. In + // any of these three cases, we can form a K_3_3 by removing the + // edge attached to v on the outer face that is NOT on the path to + // alpha. + + typename face_vertex_iterator::type + face_itr, face_end; + if (face_handles[v_dfchild_handle.first_vertex()].first_edge() == + v_dfchild_handle.first_edge() + ) + { + face_itr = typename face_vertex_iterator + ::type + (v_dfchild_handle.first_vertex(), face_handles, second_side()); + } + else + { + face_itr = typename face_vertex_iterator + ::type + (v_dfchild_handle.first_vertex(), face_handles, first_side()); + } + + for(; true; ++face_itr) + { + vertex_t current_vertex(*face_itr); + if (current_vertex == x || current_vertex == y) + { + is_in_subgraph[v_dfchild_handle.first_edge()] = false; + break; + } + else if (current_vertex == first_x_y_path_endpoint || + current_vertex == second_x_y_path_endpoint) + { + is_in_subgraph[v_dfchild_handle.second_edge()] = false; + break; + } + } + + } + else if (chosen_case == CASE_D) + { + // Need to remove both of the edges adjacent to v on the outer face. + // remove the connecting edges from v to bicomp, then + // is_kuratowski_subgraph will shrink vertices of degree 1 + // automatically... + + is_in_subgraph[v_dfchild_handle.first_edge()] = false; + is_in_subgraph[v_dfchild_handle.second_edge()] = false; + + } + else if (chosen_case == CASE_E) + { + // Similarly to case C, if the endpoints of the x-y path are both + // below x and y, we should remove an edge to allow the subgraph to + // contract to a K_3_3. + + + if ((first_x_y_path_endpoint != x && first_x_y_path_endpoint != y) || + (second_x_y_path_endpoint != x && second_x_y_path_endpoint != y) + ) + { + is_in_subgraph[dfs_parent_edge[v]] = false; + + vertex_t deletion_endpoint, other_endpoint; + if (lower_face_vertex[first_x_y_path_endpoint]) + { + deletion_endpoint = second_x_y_path_endpoint; + other_endpoint = first_x_y_path_endpoint; + } + else + { + deletion_endpoint = first_x_y_path_endpoint; + other_endpoint = second_x_y_path_endpoint; + } + + typename face_edge_iterator<>::type face_itr, face_end; + + bool found_other_endpoint = false; + for(face_itr = typename face_edge_iterator<>::type + (deletion_endpoint, face_handles, first_side()); + face_itr != face_end; ++face_itr + ) + { + edge_t e(*face_itr); + if (source(e,g) == other_endpoint || + target(e,g) == other_endpoint + ) + { + found_other_endpoint = true; + break; + } + } + + if (found_other_endpoint) + { + is_in_subgraph[face_handles[deletion_endpoint].first_edge()] + = false; + } + else + { + is_in_subgraph[face_handles[deletion_endpoint].second_edge()] + = false; + } + } + + } + + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + if (is_in_subgraph[*ei]) + *o_itr = *ei; + + } + + + + template + void make_edge_permutation(EdgePermutation perm) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + perm[v].clear(); + face_handles[v].get_list(std::back_inserter(perm[v])); + } + } + + + private: + + const Graph& g; + VertexIndexMap vm; + + vertex_t kuratowski_v; + vertex_t kuratowski_x; + vertex_t kuratowski_y; + + vertex_list_t garbage; // we delete items from linked lists by + // splicing them into garbage + + //only need these two for kuratowski subgraph isolation + std::vector current_merge_points; + std::vector embedded_edges; + + //property map storage + std::vector low_point_vector; + std::vector dfs_parent_vector; + std::vector dfs_number_vector; + std::vector least_ancestor_vector; + std::vector pertinent_roots_vector; + std::vector backedge_flag_vector; + std::vector visited_vector; + std::vector< face_handle_t > face_handles_vector; + std::vector< face_handle_t > dfs_child_handles_vector; + std::vector< vertex_list_ptr_t > separated_dfs_child_list_vector; + std::vector< typename vertex_list_t::iterator > + separated_node_in_parent_list_vector; + std::vector canonical_dfs_child_vector; + std::vector flipped_vector; + std::vector backedges_vector; + edge_vector_t self_loops; + std::vector dfs_parent_edge_vector; + vertex_vector_t vertices_by_dfs_num; + + //property maps + vertex_to_v_size_map_t low_point; + vertex_to_vertex_map_t dfs_parent; + vertex_to_v_size_map_t dfs_number; + vertex_to_v_size_map_t least_ancestor; + vertex_to_face_handle_list_ptr_map_t pertinent_roots; + vertex_to_v_size_map_t backedge_flag; + vertex_to_v_size_map_t visited; + vertex_to_face_handle_map_t face_handles; + vertex_to_face_handle_map_t dfs_child_handles; + vertex_to_vertex_list_ptr_map_t separated_dfs_child_list; + vertex_to_separated_node_map_t separated_node_in_parent_list; + vertex_to_vertex_map_t canonical_dfs_child; + vertex_to_bool_map_t flipped; + vertex_to_edge_vector_map_t backedges; + vertex_to_edge_map_t dfs_parent_edge; //only need for kuratowski + + merge_stack_t merge_stack; + + }; + + +} //namespace boost + +#endif //__BOYER_MYRVOLD_IMPL_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/bucket_sort.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/bucket_sort.hpp new file mode 100644 index 0000000000..f07262859d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/bucket_sort.hpp @@ -0,0 +1,144 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __BUCKET_SORT_HPP__ +#define __BUCKET_SORT_HPP__ + +#include +#include +#include + + + +namespace boost +{ + + + template + struct rank_comparison + { + rank_comparison(ItemToRankMap arg_itrm) : itrm(arg_itrm) {} + + template + bool operator() (Item x, Item y) const + { + return get(itrm, x) < get(itrm, y); + } + + private: + ItemToRankMap itrm; + + }; + + + template + struct property_map_tuple_adaptor : + public put_get_helper< typename PropertyMapWrapper::value_type, + property_map_tuple_adaptor + + > + { + typedef typename PropertyMapWrapper::reference reference; + typedef typename PropertyMapWrapper::value_type value_type; + typedef TupleType key_type; + typedef readable_property_map_tag category; + + property_map_tuple_adaptor() {} + + property_map_tuple_adaptor(PropertyMapWrapper wrapper_map) : + m_wrapper_map(wrapper_map) + {} + + inline value_type operator[](const key_type& x) const + { + return get(m_wrapper_map, get(x)); + } + + static const int n = N; + PropertyMapWrapper m_wrapper_map; + + }; + + + + + // This function sorts a sequence of n items by their ranks in linear time, + // given that all ranks are in the range [0, range). This sort is stable. + template + void bucket_sort(ForwardIterator begin, + ForwardIterator end, + ItemToRankMap rank, + SizeType range = 0) + { +#ifdef BOOST_GRAPH_PREFER_STD_LIB + std::stable_sort(begin, end, rank_comparison(rank)); +#else + typedef std::vector + < typename boost::property_traits::key_type > + vector_of_values_t; + typedef std::vector< vector_of_values_t > vector_of_vectors_t; + + if (!range) + { + rank_comparison cmp(rank); + ForwardIterator max_by_rank = std::max_element(begin, end, cmp); + if (max_by_rank == end) + return; + range = get(rank, *max_by_rank) + 1; + } + + vector_of_vectors_t temp_values(range); + + for(ForwardIterator itr = begin; itr != end; ++itr) + { + temp_values[get(rank, *itr)].push_back(*itr); + } + + ForwardIterator orig_seq_itr = begin; + typename vector_of_vectors_t::iterator itr_end = temp_values.end(); + for(typename vector_of_vectors_t::iterator itr = temp_values.begin(); + itr != itr_end; ++itr + ) + { + typename vector_of_values_t::iterator jtr_end = itr->end(); + for(typename vector_of_values_t::iterator jtr = itr->begin(); + jtr != jtr_end; ++jtr + ) + { + *orig_seq_itr = *jtr; + ++orig_seq_itr; + } + } +#endif + } + + + template + void bucket_sort(ForwardIterator begin, + ForwardIterator end, + ItemToRankMap rank) + { + bucket_sort(begin, end, rank, 0); + } + + template + void bucket_sort(ForwardIterator begin, + ForwardIterator end + ) + { + bucket_sort(begin, end, identity_property_map()); + } + + +} //namespace boost + + +#endif //__BUCKET_SORT_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/face_handles.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/face_handles.hpp new file mode 100644 index 0000000000..4e28d4afce --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/face_handles.hpp @@ -0,0 +1,497 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __FACE_HANDLES_HPP__ +#define __FACE_HANDLES_HPP__ + + +#include +#include +#include + + +// A "face handle" is an optimization meant to serve two purposes in +// the implementation of the Boyer-Myrvold planarity test: (1) it holds +// the partial planar embedding of a particular vertex as it's being +// constructed, and (2) it allows for efficient traversal around the +// outer face of the partial embedding at that particular vertex. A face +// handle is lightweight, just a shared pointer to the actual implementation, +// since it is passed around/copied liberally in the algorithm. It consists +// of an "anchor" (the actual vertex it's associated with) as well as a +// sequence of edges. The functions first_vertex/second_vertex and +// first_edge/second_edge allow fast access to the beginning and end of the +// stored sequence, which allows one to traverse the outer face of the partial +// planar embedding as it's being created. +// +// There are some policies below that define the contents of the face handles: +// in the case no embedding is needed (for example, if one just wants to use +// the Boyer-Myrvold algorithm as a true/false test for planarity, the +// no_embedding class can be passed as the StoreEmbedding policy. Otherwise, +// either std_list (which uses as std::list) or recursive_lazy_list can be +// passed as this policy. recursive_lazy_list has the best theoretical +// performance (O(n) for a sequence of interleaved concatenations and reversals +// of the underlying list), but I've noticed little difference between std_list +// and recursive_lazy_list in my tests, even though using std_list changes +// the worst-case complexity of the planarity test to O(n^2) +// +// Another policy is StoreOldHandlesPolicy, which specifies whether or not +// to keep a record of the previous first/second vertex/edge - this is needed +// if a Kuratowski subgraph needs to be isolated. + + +namespace boost { namespace graph { namespace detail { + + + //face handle policies + + //EmbeddingStorage policy + struct store_embedding {}; + struct recursive_lazy_list : public store_embedding {}; + struct std_list : public store_embedding {}; + struct no_embedding {}; + + //StoreOldHandlesPolicy + struct store_old_handles {}; + struct no_old_handles {}; + + + + + template + struct lazy_list_node + { + typedef shared_ptr< lazy_list_node > ptr_t; + + lazy_list_node(const DataType& data) : + m_reversed(false), + m_data(data), + m_has_data(true) + {} + + lazy_list_node(ptr_t left_child, ptr_t right_child) : + m_reversed(false), + m_has_data(false), + m_left_child(left_child), + m_right_child(right_child) + {} + + bool m_reversed; + DataType m_data; + bool m_has_data; + shared_ptr m_left_child; + shared_ptr m_right_child; + }; + + + + template + struct old_handles_storage; + + template + struct old_handles_storage + { + Vertex first_vertex; + Vertex second_vertex; + Edge first_edge; + Edge second_edge; + }; + + template + struct old_handles_storage + {}; + + + + + + + template + struct edge_list_storage; + + + + + + template + struct edge_list_storage + { + typedef void type; + + void push_back(Edge) {} + void push_front(Edge) {} + void reverse() {} + void concat_front(edge_list_storage) {} + void concat_back(edge_list_storage) {} + template + void get_list(OutputIterator) {} + }; + + + + + + template + struct edge_list_storage + { + typedef lazy_list_node node_type; + typedef shared_ptr< node_type > type; + type value; + + void push_back(Edge e) + { + type new_node(new node_type(e)); + value = type(new node_type(value, new_node)); + } + + void push_front(Edge e) + { + type new_node(new node_type(e)); + value = type(new node_type(new_node, value)); + } + + void reverse() + { + value->m_reversed = !value->m_reversed; + } + + void concat_front(edge_list_storage other) + { + value = type(new node_type(other.value, value)); + } + + void concat_back(edge_list_storage other) + { + value = type(new node_type(value, other.value)); + } + + template + void get_list(OutputIterator out) + { + get_list_helper(out, value); + } + + private: + + template + void get_list_helper(OutputIterator o_itr, + type root, + bool flipped = false + ) + { + if (!root) + return; + + if (root->m_has_data) + *o_itr = root->m_data; + + if ((flipped && !root->m_reversed) || + (!flipped && root->m_reversed) + ) + { + get_list_helper(o_itr, root->m_right_child, true); + get_list_helper(o_itr, root->m_left_child, true); + } + else + { + get_list_helper(o_itr, root->m_left_child, false); + get_list_helper(o_itr, root->m_right_child, false); + } + + } + + }; + + + + + + template + struct edge_list_storage + { + typedef std::list type; + type value; + + void push_back(Edge e) + { + value.push_back(e); + } + + void push_front(Edge e) + { + value.push_front(e); + } + + void reverse() + { + value.reverse(); + } + + void concat_front(edge_list_storage other) + { + value.splice(value.begin(), other.value); + } + + void concat_back(edge_list_storage other) + { + value.splice(value.end(), other.value); + } + + template + void get_list(OutputIterator out) + { + std::copy(value.begin(), value.end(), out); + } + + }; + + + + + + + + template + struct face_handle_impl + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename edge_list_storage::type + edge_list_storage_t; + + + face_handle_impl() : + cached_first_vertex(graph_traits::null_vertex()), + cached_second_vertex(graph_traits::null_vertex()), + true_first_vertex(graph_traits::null_vertex()), + true_second_vertex(graph_traits::null_vertex()), + anchor(graph_traits::null_vertex()) + { + initialize_old_vertices_dispatch(StoreOldHandlesPolicy()); + } + + void initialize_old_vertices_dispatch(store_old_handles) + { + old_handles.first_vertex = graph_traits::null_vertex(); + old_handles.second_vertex = graph_traits::null_vertex(); + } + + void initialize_old_vertices_dispatch(no_old_handles) {} + + vertex_t cached_first_vertex; + vertex_t cached_second_vertex; + vertex_t true_first_vertex; + vertex_t true_second_vertex; + vertex_t anchor; + edge_t cached_first_edge; + edge_t cached_second_edge; + + edge_list_storage edge_list; + old_handles_storage old_handles; + + }; + + + + + + + + + + + + template + class face_handle + { + public: + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef face_handle_impl + impl_t; + typedef face_handle + self_t; + + face_handle(vertex_t anchor = graph_traits::null_vertex()) : + pimpl(new impl_t()) + { + pimpl->anchor = anchor; + } + + face_handle(vertex_t anchor, edge_t initial_edge, const Graph& g) : + pimpl(new impl_t()) + { + vertex_t s(source(initial_edge,g)); + vertex_t t(target(initial_edge,g)); + vertex_t other_vertex = s == anchor ? t : s; + pimpl->anchor = anchor; + pimpl->cached_first_edge = initial_edge; + pimpl->cached_second_edge = initial_edge; + pimpl->cached_first_vertex = other_vertex; + pimpl->cached_second_vertex = other_vertex; + pimpl->true_first_vertex = other_vertex; + pimpl->true_second_vertex = other_vertex; + + pimpl->edge_list.push_back(initial_edge); + store_old_face_handles_dispatch(StoreOldHandlesPolicy()); + } + + //default copy construction, assignment okay. + + void push_first(edge_t e, const Graph& g) + { + pimpl->edge_list.push_front(e); + pimpl->cached_first_vertex = pimpl->true_first_vertex = + source(e, g) == pimpl->anchor ? target(e,g) : source(e,g); + pimpl->cached_first_edge = e; + } + + void push_second(edge_t e, const Graph& g) + { + pimpl->edge_list.push_back(e); + pimpl->cached_second_vertex = pimpl->true_second_vertex = + source(e, g) == pimpl->anchor ? target(e,g) : source(e,g); + pimpl->cached_second_edge = e; + } + + inline void store_old_face_handles() + { + store_old_face_handles_dispatch(StoreOldHandlesPolicy()); + } + + inline vertex_t first_vertex() const + { + return pimpl->cached_first_vertex; + } + + inline vertex_t second_vertex() const + { + return pimpl->cached_second_vertex; + } + + inline vertex_t true_first_vertex() const + { + return pimpl->true_first_vertex; + } + + inline vertex_t true_second_vertex() const + { + return pimpl->true_second_vertex; + } + + inline vertex_t old_first_vertex() const + { + return pimpl->old_handles.first_vertex; + } + + inline vertex_t old_second_vertex() const + { + return pimpl->old_handles.second_vertex; + } + + inline edge_t old_first_edge() const + { + return pimpl->old_handles.first_edge; + } + + inline edge_t old_second_edge() const + { + return pimpl->old_handles.second_edge; + } + + inline edge_t first_edge() const + { + return pimpl->cached_first_edge; + } + + inline edge_t second_edge() const + { + return pimpl->cached_second_edge; + } + + inline vertex_t get_anchor() const + { + return pimpl->anchor; + } + + void glue_first_to_second + (face_handle& bottom) + { + pimpl->edge_list.concat_front(bottom.pimpl->edge_list); + pimpl->true_first_vertex = bottom.pimpl->true_first_vertex; + pimpl->cached_first_vertex = bottom.pimpl->cached_first_vertex; + pimpl->cached_first_edge = bottom.pimpl->cached_first_edge; + } + + void glue_second_to_first + (face_handle& bottom) + { + pimpl->edge_list.concat_back(bottom.pimpl->edge_list); + pimpl->true_second_vertex = bottom.pimpl->true_second_vertex; + pimpl->cached_second_vertex = bottom.pimpl->cached_second_vertex; + pimpl->cached_second_edge = bottom.pimpl->cached_second_edge; + } + + void flip() + { + pimpl->edge_list.reverse(); + std::swap(pimpl->true_first_vertex, pimpl->true_second_vertex); + std::swap(pimpl->cached_first_vertex, pimpl->cached_second_vertex); + std::swap(pimpl->cached_first_edge, pimpl->cached_second_edge); + } + + template + void get_list(OutputIterator o_itr) + { + pimpl->edge_list.get_list(o_itr); + } + + void reset_vertex_cache() + { + pimpl->cached_first_vertex = pimpl->true_first_vertex; + pimpl->cached_second_vertex = pimpl->true_second_vertex; + } + + inline void set_first_vertex(vertex_t v) + { + pimpl->cached_first_vertex = v; + } + + inline void set_second_vertex(vertex_t v) + { + pimpl->cached_second_vertex = v; + } + + private: + + void store_old_face_handles_dispatch(store_old_handles) + { + pimpl->old_handles.first_vertex = pimpl->true_first_vertex; + pimpl->old_handles.second_vertex = pimpl->true_second_vertex; + pimpl->old_handles.first_edge = pimpl->cached_first_edge; + pimpl->old_handles.second_edge = pimpl->cached_second_edge; + } + + void store_old_face_handles_dispatch(no_old_handles) {} + + + + boost::shared_ptr pimpl; + + }; + + +} /* namespace detail */ } /* namespace graph */ } /* namespace boost */ + + +#endif //__FACE_HANDLES_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/face_iterators.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/face_iterators.hpp new file mode 100644 index 0000000000..2cd1df5ec3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_detail/face_iterators.hpp @@ -0,0 +1,375 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __FACE_ITERATORS_HPP__ +#define __FACE_ITERATORS_HPP__ + +#include +#include +#include + +namespace boost +{ + + //tags for defining traversal properties + + //VisitorType + struct lead_visitor {}; + struct follow_visitor {}; + + //TraversalType + struct single_side {}; + struct both_sides {}; + + //TraversalSubType + struct first_side {}; //for single_side + struct second_side {}; //for single_side + struct alternating {}; //for both_sides + + //Time + struct current_iteration {}; + struct previous_iteration {}; + + // Why TraversalType AND TraversalSubType? TraversalSubType is a function + // template parameter passed in to the constructor of the face iterator, + // whereas TraversalType is a class template parameter. This lets us decide + // at runtime whether to move along the first or second side of a bicomp (by + // assigning a face_iterator that has been constructed with TraversalSubType + // = first_side or second_side to a face_iterator variable) without any of + // the virtual function overhead that comes with implementing this + // functionality as a more structured form of type erasure. It also allows + // a single face_iterator to be the end iterator of two iterators traversing + // both sides of a bicomp. + + //ValueType is either graph_traits::vertex_descriptor + //or graph_traits::edge_descriptor + + + //forward declaration (defining defaults) + template + class face_iterator; + + + + template + struct edge_storage + {}; + + template + struct edge_storage + { + typename graph_traits::edge_descriptor value; + }; + + + + + //specialization for TraversalType = traverse_vertices + template + + class face_iterator + : public boost::iterator_facade < face_iterator, + ValueType, + boost::forward_traversal_tag, + ValueType + > + { + public: + + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef face_iterator + self; + typedef typename FaceHandlesMap::value_type face_handle_t; + + face_iterator() : + m_lead(graph_traits::null_vertex()), + m_follow(graph_traits::null_vertex()) + {} + + template + face_iterator(face_handle_t anchor_handle, + FaceHandlesMap face_handles, + TraversalSubType traversal_type): + m_follow(anchor_handle.get_anchor()), + m_face_handles(face_handles) + { + set_lead_dispatch(anchor_handle, traversal_type); + } + + template + face_iterator(vertex_t anchor, + FaceHandlesMap face_handles, + TraversalSubType traversal_type): + m_follow(anchor), + m_face_handles(face_handles) + { + set_lead_dispatch(m_face_handles[anchor], traversal_type); + } + + private: + + friend class boost::iterator_core_access; + + + + + inline vertex_t get_first_vertex(face_handle_t anchor_handle, + current_iteration + ) + { + return anchor_handle.first_vertex(); + } + + inline vertex_t get_second_vertex(face_handle_t anchor_handle, + current_iteration + ) + { + return anchor_handle.second_vertex(); + } + + inline vertex_t get_first_vertex(face_handle_t anchor_handle, + previous_iteration + ) + { + return anchor_handle.old_first_vertex(); + } + + inline vertex_t get_second_vertex(face_handle_t anchor_handle, + previous_iteration + ) + { + return anchor_handle.old_second_vertex(); + } + + + + + + inline void set_lead_dispatch(face_handle_t anchor_handle, first_side) + { + m_lead = get_first_vertex(anchor_handle, Time()); + set_edge_to_first_dispatch(anchor_handle, ValueType(), Time()); + } + + inline void set_lead_dispatch(face_handle_t anchor_handle, second_side) + { + m_lead = get_second_vertex(anchor_handle, Time()); + set_edge_to_second_dispatch(anchor_handle, ValueType(), Time()); + } + + + + + + inline void set_edge_to_first_dispatch(face_handle_t anchor_handle, + edge_t, + current_iteration + ) + { + m_edge.value = anchor_handle.first_edge(); + } + + inline void set_edge_to_second_dispatch(face_handle_t anchor_handle, + edge_t, + current_iteration + ) + { + m_edge.value = anchor_handle.second_edge(); + } + + inline void set_edge_to_first_dispatch(face_handle_t anchor_handle, + edge_t, + previous_iteration + ) + { + m_edge.value = anchor_handle.old_first_edge(); + } + + inline void set_edge_to_second_dispatch(face_handle_t anchor_handle, + edge_t, + previous_iteration + ) + { + m_edge.value = anchor_handle.old_second_edge(); + } + + template + inline void set_edge_to_first_dispatch(face_handle_t, vertex_t, T) + {} + + template + inline void set_edge_to_second_dispatch(face_handle_t, vertex_t, T) + {} + + void increment() + { + face_handle_t curr_face_handle(m_face_handles[m_lead]); + vertex_t first = get_first_vertex(curr_face_handle, Time()); + vertex_t second = get_second_vertex(curr_face_handle, Time()); + if (first == m_follow) + { + m_follow = m_lead; + set_edge_to_second_dispatch(curr_face_handle, ValueType(), Time()); + m_lead = second; + } + else if (second == m_follow) + { + m_follow = m_lead; + set_edge_to_first_dispatch(curr_face_handle, ValueType(), Time()); + m_lead = first; + } + else + m_lead = m_follow = graph_traits::null_vertex(); + } + + bool equal(self const& other) const + { + return m_lead == other.m_lead && m_follow == other.m_follow; + } + + ValueType dereference() const + { + return dereference_dispatch(VisitorType(), ValueType()); + } + + inline ValueType dereference_dispatch(lead_visitor, vertex_t) const + { return m_lead; } + + inline ValueType dereference_dispatch(follow_visitor, vertex_t) const + { return m_follow; } + + inline ValueType dereference_dispatch(lead_visitor, edge_t) const + { return m_edge.value; } + + inline ValueType dereference_dispatch(follow_visitor, edge_t) const + { return m_edge.value; } + + vertex_t m_lead; + vertex_t m_follow; + edge_storage::value > m_edge; + FaceHandlesMap m_face_handles; + }; + + + + + + + + + + template + class face_iterator + + : public boost::iterator_facade< face_iterator, + ValueType, + boost::forward_traversal_tag, + ValueType > + { + public: + + typedef face_iterator + self; + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename FaceHandlesMap::value_type face_handle_t; + + face_iterator() {} + + face_iterator(face_handle_t anchor_handle, FaceHandlesMap face_handles): + first_itr(anchor_handle, face_handles, first_side()), + second_itr(anchor_handle, face_handles, second_side()), + first_is_active(true), + first_increment(true) + {} + + face_iterator(vertex_t anchor, FaceHandlesMap face_handles): + first_itr(face_handles[anchor], face_handles, first_side()), + second_itr(face_handles[anchor], face_handles, second_side()), + first_is_active(true), + first_increment(true) + {} + + private: + + friend class boost::iterator_core_access; + + typedef face_iterator + + inner_itr_t; + + void increment() + { + if (first_increment) + { + ++first_itr; + ++second_itr; + first_increment = false; + } + else if (first_is_active) + ++first_itr; + else + ++second_itr; + first_is_active = !first_is_active; + } + + bool equal(self const& other) const + { + //Want this iterator to be equal to the "end" iterator when at least + //one of the iterators has reached the root of the current bicomp. + //This isn't ideal, but it works. + + return (first_itr == other.first_itr || second_itr == other.second_itr); + } + + ValueType dereference() const + { + return first_is_active ? *first_itr : *second_itr; + } + + inner_itr_t first_itr; + inner_itr_t second_itr; + inner_itr_t face_end; + bool first_is_active; + bool first_increment; + + }; + + +} /* namespace boost */ + + +#endif //__FACE_ITERATORS_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_face_traversal.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_face_traversal.hpp new file mode 100644 index 0000000000..95e8401fa8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/planar_face_traversal.hpp @@ -0,0 +1,210 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __PLANAR_FACE_TRAVERSAL_HPP__ +#define __PLANAR_FACE_TRAVERSAL_HPP__ + +#include +#include //for next and prior +#include + + +namespace boost +{ + + + + + struct planar_face_traversal_visitor + { + void begin_traversal() + {} + + void begin_face() + {} + + template + void next_edge(Edge e) + {} + + template + void next_vertex(Vertex v) + {} + + void end_face() + {} + + void end_traversal() + {} + + }; + + + + + + template + void planar_face_traversal(const Graph& g, + PlanarEmbedding embedding, + Visitor& visitor, EdgeIndexMap em + ) + { + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::vertex_iterator vertex_iterator_t; + typedef typename graph_traits::edge_iterator edge_iterator_t; + typedef typename + property_traits::value_type embedding_value_t; + typedef typename embedding_value_t::const_iterator embedding_iterator_t; + + typedef typename + std::vector< std::set > distinguished_edge_storage_t; + typedef typename + std::vector< std::map > + distinguished_edge_to_edge_storage_t; + + typedef typename + boost::iterator_property_map + + distinguished_edge_map_t; + + typedef typename + boost::iterator_property_map + + distinguished_edge_to_edge_map_t; + + distinguished_edge_storage_t visited_vector(num_edges(g)); + distinguished_edge_to_edge_storage_t next_edge_vector(num_edges(g)); + + distinguished_edge_map_t visited(visited_vector.begin(), em); + distinguished_edge_to_edge_map_t next_edge(next_edge_vector.begin(), em); + + vertex_iterator_t vi, vi_end; + typename std::vector::iterator ei, ei_end; + edge_iterator_t fi, fi_end; + embedding_iterator_t pi, pi_begin, pi_end; + + visitor.begin_traversal(); + + // Initialize the next_edge property map. This map is initialized from the + // PlanarEmbedding so that get(next_edge, e)[v] is the edge that comes + // after e in the clockwise embedding around vertex v. + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + pi_begin = embedding[v].begin(); + pi_end = embedding[v].end(); + for(pi = pi_begin; pi != pi_end; ++pi) + { + edge_t e(*pi); + std::map m = get(next_edge, e); + m[v] = next(pi) == pi_end ? *pi_begin : *next(pi); + put(next_edge, e, m); + } + } + + // Take a copy of the edges in the graph here, since we want to accomodate + // face traversals that add edges to the graph (for triangulation, in + // particular) and don't want to use invalidated edge iterators. + // Also, while iterating over all edges in the graph, we single out + // any self-loops, which need some special treatment in the face traversal. + + std::vector self_loops; + std::vector edges_cache; + std::vector vertices_in_edge; + + for(tie(fi,fi_end) = edges(g); fi != fi_end; ++fi) + { + edge_t e(*fi); + edges_cache.push_back(e); + if (source(e,g) == target(e,g)) + self_loops.push_back(e); + } + + + // Iterate over all edges in the graph + ei_end = edges_cache.end(); + for(ei = edges_cache.begin(); ei != ei_end; ++ei) + { + + edge_t e(*ei); + vertices_in_edge.clear(); + vertices_in_edge.push_back(source(e,g)); + vertices_in_edge.push_back(target(e,g)); + + typename std::vector::iterator vi, vi_end; + vi_end = vertices_in_edge.end(); + + //Iterate over both vertices in the current edge + for(vi = vertices_in_edge.begin(); vi != vi_end; ++vi) + { + + vertex_t v(*vi); + std::set e_visited = get(visited, e); + typename std::set::iterator e_visited_found + = e_visited.find(v); + + if (e_visited_found == e_visited.end()) + visitor.begin_face(); + + while (e_visited.find(v) == e_visited.end()) + { + visitor.next_vertex(v); + visitor.next_edge(e); + e_visited.insert(v); + put(visited, e, e_visited); + v = source(e,g) == v ? target(e,g) : source(e,g); + e = get(next_edge, e)[v]; + e_visited = get(visited, e); + } + + if (e_visited_found == e_visited.end()) + visitor.end_face(); + + } + + } + + // Iterate over all self-loops, visiting them once separately + // (they've already been visited once, this visitation is for + // the "inside" of the self-loop) + + ei_end = self_loops.end(); + for(ei = self_loops.begin(); ei != ei_end; ++ei) + { + visitor.begin_face(); + visitor.next_edge(*ei); + visitor.next_vertex(source(*ei,g)); + visitor.end_face(); + } + + visitor.end_traversal(); + + } + + + + template + inline void planar_face_traversal(const Graph& g, + PlanarEmbedding embedding, + Visitor& visitor + ) + { + planar_face_traversal(g, embedding, visitor, get(edge_index, g)); + } + + + + +} //namespace boost + +#endif //__PLANAR_FACE_TRAVERSAL_HPP__ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/plod_generator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/plod_generator.hpp new file mode 100644 index 0000000000..9a63ec8fa4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/plod_generator.hpp @@ -0,0 +1,161 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PLOD_GENERATOR_HPP +#define BOOST_GRAPH_PLOD_GENERATOR_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + template + class plod_iterator + { + typedef std::vector > out_degrees_t; + typedef typename graph_traits::directed_category directed_category; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + plod_iterator() + : gen(0), out_degrees(), degrees_left(0), allow_self_loops(false) { } + + plod_iterator(RandomGenerator& gen, std::size_t n, + double alpha, double beta, bool allow_self_loops = false) + : gen(&gen), n(n), out_degrees(new out_degrees_t), + degrees_left(0), allow_self_loops(allow_self_loops) + { + using std::pow; + + uniform_int x(0, n-1); + for (std::size_t i = 0; i != n; ++i) { + std::size_t xv = x(gen); + std::size_t degree = (xv == 0? 0 : std::size_t(beta * pow(xv, -alpha))); + if (degree != 0) { + out_degrees->push_back(std::make_pair(i, degree)); + } + degrees_left += degree; + } + + next(directed_category()); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + plod_iterator& operator++() + { + next(directed_category()); + return *this; + } + + plod_iterator operator++(int) + { + plod_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const plod_iterator& other) const + { + return degrees_left == other.degrees_left; + } + + bool operator!=(const plod_iterator& other) const + { return !(*this == other); } + + private: + void next(directed_tag) + { + uniform_int x(0, out_degrees->size()-1); + std::size_t source; + do { + source = x(*gen); + } while ((*out_degrees)[source].second == 0); + current.first = (*out_degrees)[source].first; + do { + current.second = x(*gen); + } while (current.first == current.second && !allow_self_loops); + --degrees_left; + if (--(*out_degrees)[source].second == 0) { + (*out_degrees)[source] = out_degrees->back(); + out_degrees->pop_back(); + } + } + + void next(undirected_tag) + { + std::size_t source, target; + while (true) { + /* We may get to the point where we can't actually find any + new edges, so we just add some random edge and set the + degrees left = 0 to signal termination. */ + if (out_degrees->size() < 2) { + uniform_int x(0, n); + current.first = x(*gen); + do { + current.second = x(*gen); + } while (current.first == current.second && !allow_self_loops); + degrees_left = 0; + out_degrees->clear(); + return; + } + + uniform_int x(0, out_degrees->size()-1); + + // Select source vertex + source = x(*gen); + if ((*out_degrees)[source].second == 0) { + (*out_degrees)[source] = out_degrees->back(); + out_degrees->pop_back(); + continue; + } + + // Select target vertex + target = x(*gen); + if ((*out_degrees)[target].second == 0) { + (*out_degrees)[target] = out_degrees->back(); + out_degrees->pop_back(); + continue; + } else if (source != target + || (allow_self_loops && (*out_degrees)[source].second > 2)) { + break; + } + } + + // Update degree counts + --(*out_degrees)[source].second; + --degrees_left; + --(*out_degrees)[target].second; + --degrees_left; + current.first = (*out_degrees)[source].first; + current.second = (*out_degrees)[target].first; + } + + RandomGenerator* gen; + std::size_t n; + shared_ptr out_degrees; + std::size_t degrees_left; + bool allow_self_loops; + value_type current; + }; + +} // end namespace boost + +#endif // BOOST_GRAPH_PLOD_GENERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/prim_minimum_spanning_tree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/prim_minimum_spanning_tree.hpp new file mode 100644 index 0000000000..79913b1a5c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/prim_minimum_spanning_tree.hpp @@ -0,0 +1,91 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_MST_PRIM_HPP +#define BOOST_GRAPH_MST_PRIM_HPP + +#include +#include +#include + +namespace boost { + + namespace detail { + // this should be somewhere else in boost... + template struct _project2nd { + V operator()(U, V v) const { return v; } + }; + } + + namespace detail { + + // This is Prim's algorithm to calculate the Minimum Spanning Tree + // for an undirected graph with weighted edges. + + template + inline void + prim_mst_impl(const Graph& G, + typename graph_traits::vertex_descriptor s, + const bgl_named_params& params, + Weight) + { + typedef typename property_traits::value_type W; + std::less compare; + detail::_project2nd combine; + dijkstra_shortest_paths(G, s, params.distance_compare(compare). + distance_combine(combine)); + } + } // namespace detail + + template + inline void + prim_minimum_spanning_tree + (const VertexListGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, + DijkstraVisitor vis) + { + typedef typename property_traits::value_type W; + std::less compare; + detail::_project2nd combine; + dijkstra_shortest_paths(g, s, predecessor, distance, weight, index_map, + compare, combine, (std::numeric_limits::max)(), 0, + vis); + } + + template + inline void prim_minimum_spanning_tree + (const VertexListGraph& g, + PredecessorMap p_map, + const bgl_named_params& params) + { + detail::prim_mst_impl + (g, + choose_param(get_param(params, root_vertex_t()), *vertices(g).first), + params.predecessor_map(p_map), + choose_const_pmap(get_param(params, edge_weight), g, edge_weight)); + } + + template + inline void prim_minimum_spanning_tree + (const VertexListGraph& g, PredecessorMap p_map) + { + detail::prim_mst_impl + (g, *vertices(g).first, predecessor_map(p_map). + weight_map(get(edge_weight, g)), + get(edge_weight, g)); + } + +} // namespace boost + +#endif // BOOST_GRAPH_MST_PRIM_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/profile.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/profile.hpp new file mode 100644 index 0000000000..1ba2d2498d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/profile.hpp @@ -0,0 +1,43 @@ +// +//======================================================================= +// Copyright 2002 Marc Wintermantel (wintermantel@even-ag.ch) +// ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st) +// +// 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_GRAPH_PROFILE_HPP +#define BOOST_GRAPH_PROFILE_HPP + +#include +#include +#include + +namespace boost { + + template + typename graph_traits::vertices_size_type + profile(const Graph& g, VertexIndexMap index) + { + typename graph_traits::vertices_size_type b = 0; + typename graph_traits::vertex_iterator i, end; + for (tie(i, end) = vertices(g); i != end; ++i){ + b += ith_bandwidth(*i, g, index) + 1; + } + + return b; + } + + template + typename graph_traits::vertices_size_type + profile(const Graph& g) + { + return profile(g, get(vertex_index, g)); + } + + +} // namespace boost + +#endif // BOOST_GRAPH_PROFILE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/properties.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/properties.hpp new file mode 100644 index 0000000000..e3816e36e8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/properties.hpp @@ -0,0 +1,389 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_PROPERTIES_HPP +#define BOOST_GRAPH_PROPERTIES_HPP + +#include +#include +#include +#include +#include +#include + + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define Graph Graph_ +# define RandomAccessContainer RandomAccessContainer_ +#endif + +namespace boost { + + enum default_color_type { white_color, gray_color, green_color, red_color, black_color }; + + template + struct color_traits { + static default_color_type white() { return white_color; } + static default_color_type gray() { return gray_color; } + static default_color_type green() { return green_color; } + static default_color_type red() { return red_color; } + static default_color_type black() { return black_color; } + }; + + // These functions are now obsolete, replaced by color_traits. + inline default_color_type white(default_color_type) { return white_color; } + inline default_color_type gray(default_color_type) { return gray_color; } + inline default_color_type green(default_color_type) { return green_color; } + inline default_color_type red(default_color_type) { return red_color; } + inline default_color_type black(default_color_type) { return black_color; } + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template <> + struct property_traits { + typedef default_color_type value_type; + typedef std::ptrdiff_t key_type; + typedef default_color_type& reference; + typedef lvalue_property_map_tag category; + }; + // get/put already defined for T* +#endif + + struct graph_property_tag { }; + struct vertex_property_tag { }; + struct edge_property_tag { }; + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // See examples/edge_property.cpp for how to use this. +#define BOOST_INSTALL_PROPERTY(KIND, NAME) \ + template <> struct property_kind { \ + typedef KIND##_property_tag type; \ + } +#else +#define BOOST_INSTALL_PROPERTY(KIND, NAME) \ + template <> struct property_kind { \ + typedef KIND##_property_tag type; \ + } +#endif + +#define BOOST_DEF_PROPERTY(KIND, NAME) \ + enum KIND##_##NAME##_t { KIND##_##NAME }; \ + BOOST_INSTALL_PROPERTY(KIND, NAME) + + BOOST_DEF_PROPERTY(vertex, all); + BOOST_DEF_PROPERTY(edge, all); + BOOST_DEF_PROPERTY(graph, all); + BOOST_DEF_PROPERTY(vertex, index); + BOOST_DEF_PROPERTY(vertex, index1); + BOOST_DEF_PROPERTY(vertex, index2); + BOOST_DEF_PROPERTY(vertex, root); + BOOST_DEF_PROPERTY(edge, index); + BOOST_DEF_PROPERTY(edge, name); + BOOST_DEF_PROPERTY(edge, weight); + BOOST_DEF_PROPERTY(edge, weight2); + BOOST_DEF_PROPERTY(edge, color); + BOOST_DEF_PROPERTY(vertex, name); + BOOST_DEF_PROPERTY(graph, name); + BOOST_DEF_PROPERTY(vertex, distance); + BOOST_DEF_PROPERTY(vertex, color); + BOOST_DEF_PROPERTY(vertex, degree); + BOOST_DEF_PROPERTY(vertex, in_degree); + BOOST_DEF_PROPERTY(vertex, out_degree); + BOOST_DEF_PROPERTY(vertex, current_degree); + BOOST_DEF_PROPERTY(vertex, priority); + BOOST_DEF_PROPERTY(vertex, discover_time); + BOOST_DEF_PROPERTY(vertex, finish_time); + BOOST_DEF_PROPERTY(vertex, predecessor); + BOOST_DEF_PROPERTY(vertex, rank); + BOOST_DEF_PROPERTY(vertex, centrality); + BOOST_DEF_PROPERTY(vertex, lowpoint); + BOOST_DEF_PROPERTY(edge, reverse); + BOOST_DEF_PROPERTY(edge, capacity); + BOOST_DEF_PROPERTY(edge, residual_capacity); + BOOST_DEF_PROPERTY(edge, centrality); + BOOST_DEF_PROPERTY(graph, visitor); + + // These tags are used for property bundles + BOOST_DEF_PROPERTY(vertex, bundle); + BOOST_DEF_PROPERTY(edge, bundle); + +#undef BOOST_DEF_PROPERTY + + namespace detail { + + struct dummy_edge_property_selector { + template + struct bind_ { + typedef identity_property_map type; + typedef identity_property_map const_type; + }; + }; + struct dummy_vertex_property_selector { + template + struct bind_ { + typedef identity_property_map type; + typedef identity_property_map const_type; + }; + }; + + } // namespace detail + + // Graph classes can either partially specialize property_map + // or they can specialize these two selector classes. + template + struct edge_property_selector { + typedef detail::dummy_edge_property_selector type; + }; + + template + struct vertex_property_selector { + typedef detail::dummy_vertex_property_selector type; + }; + + namespace detail { + + template + struct edge_property_map { + typedef typename Graph::edge_property_type Property; + typedef typename Graph::graph_tag graph_tag; + typedef typename edge_property_selector::type Selector; + typedef typename Selector::template bind_ + Bind; + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; + }; + template + class vertex_property_map { + typedef typename Graph::vertex_property_type Property; + typedef typename Graph::graph_tag graph_tag; + typedef typename vertex_property_selector::type Selector; + typedef typename Selector::template bind_ + Bind; + public: + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; + }; + + // This selects the kind of property map, whether is maps from + // edges or from vertices. + // + // It is overly complicated because it's a workaround for + // partial specialization. + struct choose_vertex_property_map { + template + struct bind_ { + typedef vertex_property_map type; + }; + }; + struct choose_edge_property_map { + template + struct bind_ { + typedef edge_property_map type; + }; + }; + template + struct property_map_kind_selector { + // VC++ gets confused if this isn't defined, even though + // this never gets used. + typedef choose_vertex_property_map type; + }; + template <> struct property_map_kind_selector { + typedef choose_vertex_property_map type; + }; + template <> struct property_map_kind_selector { + typedef choose_edge_property_map type; + }; + } // namespace detail + + template + struct property_map { + private: + typedef typename property_kind::type Kind; + typedef typename detail::property_map_kind_selector::type Selector; + typedef typename Selector::template bind_ Bind; + typedef typename Bind::type Map; + public: + typedef typename Map::type type; + typedef typename Map::const_type const_type; + }; + + // shortcut for accessing the value type of the property map + template + class property_map_value { + typedef typename property_map::const_type PMap; + public: + typedef typename property_traits::value_type type; + }; + + template + class graph_property { + public: + typedef typename property_value::type type; + }; + + template + class vertex_property { + public: + typedef typename Graph::vertex_property_type type; + }; + template + class edge_property { + public: + typedef typename Graph::edge_property_type type; + }; + + template + class degree_property_map + : public put_get_helper::degree_size_type, + degree_property_map > + { + public: + typedef typename graph_traits::vertex_descriptor key_type; + typedef typename graph_traits::degree_size_type value_type; + typedef value_type reference; + typedef readable_property_map_tag category; + degree_property_map(const Graph& g) : m_g(g) { } + value_type operator[](const key_type& v) const { + return degree(v, m_g); + } + private: + const Graph& m_g; + }; + template + inline degree_property_map + make_degree_map(const Graph& g) { + return degree_property_map(g); + } + + //======================================================================== + // Iterator Property Map Generating Functions contributed by + // Kevin Vanhorn. (see also the property map generating functions + // in boost/property_map.hpp) + +#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) + // A helper function for creating a vertex property map out of a + // random access iterator and the internal vertex index map from a + // graph. + template + inline + iterator_property_map< + RandomAccessIterator, + typename property_map::type, + typename std::iterator_traits::value_type, + typename std::iterator_traits::reference + > + make_iterator_vertex_map(RandomAccessIterator iter, const PropertyGraph& g) + { + return make_iterator_property_map(iter, get(vertex_index, g)); + } + + // Use this next function when vertex_descriptor is known to be an + // integer type, with values ranging from 0 to num_vertices(g). + // + template + inline + iterator_property_map< + RandomAccessIterator, + identity_property_map, + typename std::iterator_traits::value_type, + typename std::iterator_traits::reference + > + make_iterator_vertex_map(RandomAccessIterator iter) + { + return make_iterator_property_map(iter, identity_property_map()); + } +#endif + + template + inline + iterator_property_map< + typename RandomAccessContainer::iterator, + typename property_map::type, + typename RandomAccessContainer::value_type, + typename RandomAccessContainer::reference + > + make_container_vertex_map(RandomAccessContainer& c, const PropertyGraph& g) + { + assert(c.size() >= num_vertices(g)); + return make_iterator_vertex_map(c.begin(), g); + } + + template inline + iterator_property_map< + typename RandomAccessContainer::iterator, + identity_property_map, + typename RandomAccessContainer::value_type, + typename RandomAccessContainer::reference + > + make_container_vertex_map(RandomAccessContainer& c) + { + return make_iterator_vertex_map(c.begin()); + } + +#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +# define BOOST_GRAPH_NO_BUNDLED_PROPERTIES +#endif + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + struct bundle_property_map + : put_get_helper > + { + typedef Descriptor key_type; + typedef T value_type; + typedef T& reference; + typedef lvalue_property_map_tag category; + + bundle_property_map() { } + bundle_property_map(Graph* g_, T Bundle::* pm_) : g(g_), pm(pm_) {} + + reference operator[](key_type k) const { return (*g)[k].*pm; } + private: + Graph* g; + T Bundle::* pm; + }; + + namespace detail { + template + struct is_vertex_bundle : is_convertible {}; + } + + template + struct property_map + { + private: + typedef graph_traits traits; + typedef typename Graph::vertex_bundled vertex_bundled; + typedef typename Graph::edge_bundled edge_bundled; + typedef typename mpl::if_c<(detail::is_vertex_bundle::value), + typename traits::vertex_descriptor, + typename traits::edge_descriptor>::type + descriptor; + typedef typename mpl::if_c<(detail::is_vertex_bundle::value), + vertex_bundled, + edge_bundled>::type + actual_bundle; + + public: + typedef bundle_property_map type; + typedef bundle_property_map + const_type; + }; +#endif + +} // namespace boost + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# undef Graph +# undef RandomAccessIterator +#endif + + +#endif /* BOOST_GRAPH_PROPERTIES_HPPA */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/property_iter_range.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/property_iter_range.hpp new file mode 100644 index 0000000000..69ff7f0076 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/property_iter_range.hpp @@ -0,0 +1,118 @@ + +// (C) Copyright François Faure, iMAGIS-GRAVIR / UJF, 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) +// +// Revision History: +// 03 May 2001 Jeremy Siek +// Generalized the property map iterator and moved that +// part to boost/property_map.hpp. Also modified to +// differentiate between const/mutable graphs and +// added a workaround to avoid partial specialization. + +// 02 May 2001 François Faure +// Initial version. + +#ifndef BOOST_GRAPH_PROPERTY_ITER_RANGE_HPP +#define BOOST_GRAPH_PROPERTY_ITER_RANGE_HPP + +#include +#include +#include +#include + +namespace boost { + +//====================================================================== +// graph property iterator range + + template + class graph_property_iter_range { + typedef typename property_map::type map_type; + typedef typename property_map::const_type + const_map_type; + typedef typename property_kind::type Kind; + typedef typename mpl::if_c::value, + typename graph_traits::vertex_iterator, + typename graph_traits::edge_iterator>::type iter; + public: + typedef typename property_map_iterator_generator::type + iterator; + typedef typename property_map_iterator_generator + ::type const_iterator; + typedef std::pair type; + typedef std::pair const_type; + }; + + namespace detail { + + template + typename graph_property_iter_range::type + get_property_iter_range_kind(Graph& graph, const Tag& tag, + const vertex_property_tag& ) + { + typedef typename graph_property_iter_range::iterator iter; + return std::make_pair(iter(vertices(graph).first, get(tag, graph)), + iter(vertices(graph).second, get(tag, graph))); + } + + template + typename graph_property_iter_range::const_type + get_property_iter_range_kind(const Graph& graph, const Tag& tag, + const vertex_property_tag& ) + { + typedef typename graph_property_iter_range + ::const_iterator iter; + return std::make_pair(iter(vertices(graph).first, get(tag, graph)), + iter(vertices(graph).second, get(tag, graph))); + } + + + template + typename graph_property_iter_range::type + get_property_iter_range_kind(Graph& graph, const Tag& tag, + const edge_property_tag& ) + { + typedef typename graph_property_iter_range::iterator iter; + return std::make_pair(iter(edges(graph).first, get(tag, graph)), + iter(edges(graph).second, get(tag, graph))); + } + + template + typename graph_property_iter_range::const_type + get_property_iter_range_kind(const Graph& graph, const Tag& tag, + const edge_property_tag& ) + { + typedef typename graph_property_iter_range + ::const_iterator iter; + return std::make_pair(iter(edges(graph).first, get(tag, graph)), + iter(edges(graph).second, get(tag, graph))); + } + + } // namespace detail + + //====================================================================== + // get an iterator range of properties + + template + typename graph_property_iter_range::type + get_property_iter_range(Graph& graph, const Tag& tag) + { + typedef typename property_kind::type Kind; + return detail::get_property_iter_range_kind(graph, tag, Kind()); + } + + template + typename graph_property_iter_range::const_type + get_property_iter_range(const Graph& graph, const Tag& tag) + { + typedef typename property_kind::type Kind; + return detail::get_property_iter_range_kind(graph, tag, Kind()); + } + +} // namespace boost + + +#endif // BOOST_GRAPH_PROPERTY_ITER_RANGE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/push_relabel_max_flow.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/push_relabel_max_flow.hpp new file mode 100644 index 0000000000..987b8cfe4c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/push_relabel_max_flow.hpp @@ -0,0 +1,727 @@ +//======================================================================= +// Copyright 2000 University of Notre Dame. +// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee +// +// 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_PUSH_RELABEL_MAX_FLOW_HPP +#define BOOST_PUSH_RELABEL_MAX_FLOW_HPP + +#include +#include +#include +#include +#include +#include // for std::min and std::max + +#include +#include +#include +#include + +namespace boost { + + namespace detail { + + // This implementation is based on Goldberg's + // "On Implementing Push-Relabel Method for the Maximum Flow Problem" + // by B.V. Cherkassky and A.V. Goldberg, IPCO '95, pp. 157--171 + // and on the h_prf.c and hi_pr.c code written by the above authors. + + // This implements the highest-label version of the push-relabel method + // with the global relabeling and gap relabeling heuristics. + + // The terms "rank", "distance", "height" are synonyms in + // Goldberg's implementation, paper and in the CLR. A "layer" is a + // group of vertices with the same distance. The vertices in each + // layer are categorized as active or inactive. An active vertex + // has positive excess flow and its distance is less than n (it is + // not blocked). + + template + struct preflow_layer { + std::list active_vertices; + std::list inactive_vertices; + }; + + template integer + class FlowValue> + class push_relabel + { + public: + typedef graph_traits Traits; + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::edge_descriptor edge_descriptor; + typedef typename Traits::vertex_iterator vertex_iterator; + typedef typename Traits::out_edge_iterator out_edge_iterator; + typedef typename Traits::vertices_size_type vertices_size_type; + typedef typename Traits::edges_size_type edges_size_type; + + typedef preflow_layer Layer; + typedef std::vector< Layer > LayerArray; + typedef typename LayerArray::iterator layer_iterator; + typedef typename LayerArray::size_type distance_size_type; + + typedef color_traits ColorTraits; + + //======================================================================= + // Some helper predicates + + inline bool is_admissible(vertex_descriptor u, vertex_descriptor v) { + return distance[u] == distance[v] + 1; + } + inline bool is_residual_edge(edge_descriptor a) { + return 0 < residual_capacity[a]; + } + inline bool is_saturated(edge_descriptor a) { + return residual_capacity[a] == 0; + } + + //======================================================================= + // Layer List Management Functions + + typedef typename std::list::iterator list_iterator; + + void add_to_active_list(vertex_descriptor u, Layer& layer) { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + layer.active_vertices.push_front(u); + max_active = max BOOST_PREVENT_MACRO_SUBSTITUTION(distance[u], max_active); + min_active = min BOOST_PREVENT_MACRO_SUBSTITUTION(distance[u], min_active); + layer_list_ptr[u] = layer.active_vertices.begin(); + } + void remove_from_active_list(vertex_descriptor u) { + layers[distance[u]].active_vertices.erase(layer_list_ptr[u]); + } + + void add_to_inactive_list(vertex_descriptor u, Layer& layer) { + layer.inactive_vertices.push_front(u); + layer_list_ptr[u] = layer.inactive_vertices.begin(); + } + void remove_from_inactive_list(vertex_descriptor u) { + layers[distance[u]].inactive_vertices.erase(layer_list_ptr[u]); + } + + //======================================================================= + // initialization + push_relabel(Graph& g_, + EdgeCapacityMap cap, + ResidualCapacityEdgeMap res, + ReverseEdgeMap rev, + vertex_descriptor src_, + vertex_descriptor sink_, + VertexIndexMap idx) + : g(g_), n(num_vertices(g_)), capacity(cap), src(src_), sink(sink_), + index(idx), + excess_flow(num_vertices(g_)), + current(num_vertices(g_), out_edges(*vertices(g_).first, g_).second), + distance(num_vertices(g_)), + color(num_vertices(g_)), + reverse_edge(rev), + residual_capacity(res), + layers(num_vertices(g_)), + layer_list_ptr(num_vertices(g_), + layers.front().inactive_vertices.end()), + push_count(0), update_count(0), relabel_count(0), + gap_count(0), gap_node_count(0), + work_since_last_update(0) + { + vertex_iterator u_iter, u_end; + // Don't count the reverse edges + edges_size_type m = num_edges(g) / 2; + nm = alpha() * n + m; + + // Initialize flow to zero which means initializing + // the residual capacity to equal the capacity. + out_edge_iterator ei, e_end; + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) + for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) { + residual_capacity[*ei] = capacity[*ei]; + } + + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { + vertex_descriptor u = *u_iter; + excess_flow[u] = 0; + current[u] = out_edges(u, g).first; + } + + bool overflow_detected = false; + FlowValue test_excess = 0; + + out_edge_iterator a_iter, a_end; + for (tie(a_iter, a_end) = out_edges(src, g); a_iter != a_end; ++a_iter) + if (target(*a_iter, g) != src) + test_excess += residual_capacity[*a_iter]; + if (test_excess > (std::numeric_limits::max)()) + overflow_detected = true; + + if (overflow_detected) + excess_flow[src] = (std::numeric_limits::max)(); + else { + excess_flow[src] = 0; + for (tie(a_iter, a_end) = out_edges(src, g); + a_iter != a_end; ++a_iter) { + edge_descriptor a = *a_iter; + if (target(a, g) != src) { + ++push_count; + FlowValue delta = residual_capacity[a]; + residual_capacity[a] -= delta; + residual_capacity[reverse_edge[a]] += delta; + excess_flow[target(a, g)] += delta; + } + } + } + max_distance = num_vertices(g) - 1; + max_active = 0; + min_active = n; + + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { + vertex_descriptor u = *u_iter; + if (u == sink) { + distance[u] = 0; + continue; + } else if (u == src && !overflow_detected) + distance[u] = n; + else + distance[u] = 1; + + if (excess_flow[u] > 0) + add_to_active_list(u, layers[1]); + else if (distance[u] < n) + add_to_inactive_list(u, layers[1]); + } + + } // push_relabel constructor + + //======================================================================= + // This is a breadth-first search over the residual graph + // (well, actually the reverse of the residual graph). + // Would be cool to have a graph view adaptor for hiding certain + // edges, like the saturated (non-residual) edges in this case. + // Goldberg's implementation abused "distance" for the coloring. + void global_distance_update() + { + BOOST_USING_STD_MAX(); + ++update_count; + vertex_iterator u_iter, u_end; + for (tie(u_iter,u_end) = vertices(g); u_iter != u_end; ++u_iter) { + color[*u_iter] = ColorTraits::white(); + distance[*u_iter] = n; + } + color[sink] = ColorTraits::gray(); + distance[sink] = 0; + + for (distance_size_type l = 0; l <= max_distance; ++l) { + layers[l].active_vertices.clear(); + layers[l].inactive_vertices.clear(); + } + + max_distance = max_active = 0; + min_active = n; + + Q.push(sink); + while (! Q.empty()) { + vertex_descriptor u = Q.top(); + Q.pop(); + distance_size_type d_v = distance[u] + 1; + + out_edge_iterator ai, a_end; + for (tie(ai, a_end) = out_edges(u, g); ai != a_end; ++ai) { + edge_descriptor a = *ai; + vertex_descriptor v = target(a, g); + if (color[v] == ColorTraits::white() + && is_residual_edge(reverse_edge[a])) { + distance[v] = d_v; + color[v] = ColorTraits::gray(); + current[v] = out_edges(v, g).first; + max_distance = max BOOST_PREVENT_MACRO_SUBSTITUTION(d_v, max_distance); + + if (excess_flow[v] > 0) + add_to_active_list(v, layers[d_v]); + else + add_to_inactive_list(v, layers[d_v]); + + Q.push(v); + } + } + } + } // global_distance_update() + + //======================================================================= + // This function is called "push" in Goldberg's h_prf implementation, + // but it is called "discharge" in the paper and in hi_pr.c. + void discharge(vertex_descriptor u) + { + assert(excess_flow[u] > 0); + while (1) { + out_edge_iterator ai, ai_end; + for (ai = current[u], ai_end = out_edges(u, g).second; + ai != ai_end; ++ai) { + edge_descriptor a = *ai; + if (is_residual_edge(a)) { + vertex_descriptor v = target(a, g); + if (is_admissible(u, v)) { + ++push_count; + if (v != sink && excess_flow[v] == 0) { + remove_from_inactive_list(v); + add_to_active_list(v, layers[distance[v]]); + } + push_flow(a); + if (excess_flow[u] == 0) + break; + } + } + } // for out_edges of i starting from current + + Layer& layer = layers[distance[u]]; + distance_size_type du = distance[u]; + + if (ai == ai_end) { // i must be relabeled + relabel_distance(u); + if (layer.active_vertices.empty() + && layer.inactive_vertices.empty()) + gap(du); + if (distance[u] == n) + break; + } else { // i is no longer active + current[u] = ai; + add_to_inactive_list(u, layer); + break; + } + } // while (1) + } // discharge() + + //======================================================================= + // This corresponds to the "push" update operation of the paper, + // not the "push" function in Goldberg's h_prf.c implementation. + // The idea is to push the excess flow from from vertex u to v. + void push_flow(edge_descriptor u_v) + { + vertex_descriptor + u = source(u_v, g), + v = target(u_v, g); + + BOOST_USING_STD_MIN(); + FlowValue flow_delta + = min BOOST_PREVENT_MACRO_SUBSTITUTION(excess_flow[u], residual_capacity[u_v]); + + residual_capacity[u_v] -= flow_delta; + residual_capacity[reverse_edge[u_v]] += flow_delta; + + excess_flow[u] -= flow_delta; + excess_flow[v] += flow_delta; + } // push_flow() + + //======================================================================= + // The main purpose of this routine is to set distance[v] + // to the smallest value allowed by the valid labeling constraints, + // which are: + // distance[t] = 0 + // distance[u] <= distance[v] + 1 for every residual edge (u,v) + // + distance_size_type relabel_distance(vertex_descriptor u) + { + BOOST_USING_STD_MAX(); + ++relabel_count; + work_since_last_update += beta(); + + distance_size_type min_distance = num_vertices(g); + distance[u] = min_distance; + + // Examine the residual out-edges of vertex i, choosing the + // edge whose target vertex has the minimal distance. + out_edge_iterator ai, a_end, min_edge_iter; + for (tie(ai, a_end) = out_edges(u, g); ai != a_end; ++ai) { + ++work_since_last_update; + edge_descriptor a = *ai; + vertex_descriptor v = target(a, g); + if (is_residual_edge(a) && distance[v] < min_distance) { + min_distance = distance[v]; + min_edge_iter = ai; + } + } + ++min_distance; + if (min_distance < n) { + distance[u] = min_distance; // this is the main action + current[u] = min_edge_iter; + max_distance = max BOOST_PREVENT_MACRO_SUBSTITUTION(min_distance, max_distance); + } + return min_distance; + } // relabel_distance() + + //======================================================================= + // cleanup beyond the gap + void gap(distance_size_type empty_distance) + { + ++gap_count; + + distance_size_type r; // distance of layer before the current layer + r = empty_distance - 1; + + // Set the distance for the vertices beyond the gap to "infinity". + for (layer_iterator l = layers.begin() + empty_distance + 1; + l < layers.begin() + max_distance; ++l) { + list_iterator i; + for (i = l->inactive_vertices.begin(); + i != l->inactive_vertices.end(); ++i) { + distance[*i] = n; + ++gap_node_count; + } + l->inactive_vertices.clear(); + } + max_distance = r; + max_active = r; + } + + //======================================================================= + // This is the core part of the algorithm, "phase one". + FlowValue maximum_preflow() + { + work_since_last_update = 0; + + while (max_active >= min_active) { // "main" loop + + Layer& layer = layers[max_active]; + list_iterator u_iter = layer.active_vertices.begin(); + + if (u_iter == layer.active_vertices.end()) + --max_active; + else { + vertex_descriptor u = *u_iter; + remove_from_active_list(u); + + discharge(u); + + if (work_since_last_update * global_update_frequency() > nm) { + global_distance_update(); + work_since_last_update = 0; + } + } + } // while (max_active >= min_active) + + return excess_flow[sink]; + } // maximum_preflow() + + //======================================================================= + // remove excess flow, the "second phase" + // This does a DFS on the reverse flow graph of nodes with excess flow. + // If a cycle is found, cancel it. + // Return the nodes with excess flow in topological order. + // + // Unlike the prefl_to_flow() implementation, we use + // "color" instead of "distance" for the DFS labels + // "parent" instead of nl_prev for the DFS tree + // "topo_next" instead of nl_next for the topological ordering + void convert_preflow_to_flow() + { + vertex_iterator u_iter, u_end; + out_edge_iterator ai, a_end; + + vertex_descriptor r, restart, u; + + std::vector parent(n); + std::vector topo_next(n); + + vertex_descriptor tos(parent[0]), + bos(parent[0]); // bogus initialization, just to avoid warning + bool bos_null = true; + + // handle self-loops + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) + for (tie(ai, a_end) = out_edges(*u_iter, g); ai != a_end; ++ai) + if (target(*ai, g) == *u_iter) + residual_capacity[*ai] = capacity[*ai]; + + // initialize + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { + u = *u_iter; + color[u] = ColorTraits::white(); + parent[u] = u; + current[u] = out_edges(u, g).first; + } + // eliminate flow cycles and topologically order the vertices + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { + u = *u_iter; + if (color[u] == ColorTraits::white() + && excess_flow[u] > 0 + && u != src && u != sink ) { + r = u; + color[r] = ColorTraits::gray(); + while (1) { + for (; current[u] != out_edges(u, g).second; ++current[u]) { + edge_descriptor a = *current[u]; + if (capacity[a] == 0 && is_residual_edge(a)) { + vertex_descriptor v = target(a, g); + if (color[v] == ColorTraits::white()) { + color[v] = ColorTraits::gray(); + parent[v] = u; + u = v; + break; + } else if (color[v] == ColorTraits::gray()) { + // find minimum flow on the cycle + FlowValue delta = residual_capacity[a]; + while (1) { + BOOST_USING_STD_MIN(); + delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[*current[v]]); + if (v == u) + break; + else + v = target(*current[v], g); + } + // remove delta flow units + v = u; + while (1) { + a = *current[v]; + residual_capacity[a] -= delta; + residual_capacity[reverse_edge[a]] += delta; + v = target(a, g); + if (v == u) + break; + } + + // back-out of DFS to the first saturated edge + restart = u; + for (v = target(*current[u], g); v != u; v = target(a, g)){ + a = *current[v]; + if (color[v] == ColorTraits::white() + || is_saturated(a)) { + color[target(*current[v], g)] = ColorTraits::white(); + if (color[v] != ColorTraits::white()) + restart = v; + } + } + if (restart != u) { + u = restart; + ++current[u]; + break; + } + } // else if (color[v] == ColorTraits::gray()) + } // if (capacity[a] == 0 ... + } // for out_edges(u, g) (though "u" changes during loop) + + if (current[u] == out_edges(u, g).second) { + // scan of i is complete + color[u] = ColorTraits::black(); + if (u != src) { + if (bos_null) { + bos = u; + bos_null = false; + tos = u; + } else { + topo_next[u] = tos; + tos = u; + } + } + if (u != r) { + u = parent[u]; + ++current[u]; + } else + break; + } + } // while (1) + } // if (color[u] == white && excess_flow[u] > 0 & ...) + } // for all vertices in g + + // return excess flows + // note that the sink is not on the stack + if (! bos_null) { + for (u = tos; u != bos; u = topo_next[u]) { + ai = out_edges(u, g).first; + while (excess_flow[u] > 0 && ai != out_edges(u, g).second) { + if (capacity[*ai] == 0 && is_residual_edge(*ai)) + push_flow(*ai); + ++ai; + } + } + // do the bottom + u = bos; + ai = out_edges(u, g).first; + while (excess_flow[u] > 0) { + if (capacity[*ai] == 0 && is_residual_edge(*ai)) + push_flow(*ai); + ++ai; + } + } + + } // convert_preflow_to_flow() + + //======================================================================= + inline bool is_flow() + { + vertex_iterator u_iter, u_end; + out_edge_iterator ai, a_end; + + // check edge flow values + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { + for (tie(ai, a_end) = out_edges(*u_iter, g); ai != a_end; ++ai) { + edge_descriptor a = *ai; + if (capacity[a] > 0) + if ((residual_capacity[a] + residual_capacity[reverse_edge[a]] + != capacity[a] + capacity[reverse_edge[a]]) + || (residual_capacity[a] < 0) + || (residual_capacity[reverse_edge[a]] < 0)) + return false; + } + } + + // check conservation + FlowValue sum; + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { + vertex_descriptor u = *u_iter; + if (u != src && u != sink) { + if (excess_flow[u] != 0) + return false; + sum = 0; + for (tie(ai, a_end) = out_edges(u, g); ai != a_end; ++ai) + if (capacity[*ai] > 0) + sum -= capacity[*ai] - residual_capacity[*ai]; + else + sum += residual_capacity[*ai]; + + if (excess_flow[u] != sum) + return false; + } + } + + return true; + } // is_flow() + + bool is_optimal() { + // check if mincut is saturated... + global_distance_update(); + return distance[src] >= n; + } + + void print_statistics(std::ostream& os) const { + os << "pushes: " << push_count << std::endl + << "relabels: " << relabel_count << std::endl + << "updates: " << update_count << std::endl + << "gaps: " << gap_count << std::endl + << "gap nodes: " << gap_node_count << std::endl + << std::endl; + } + + void print_flow_values(std::ostream& os) const { + os << "flow values" << std::endl; + vertex_iterator u_iter, u_end; + out_edge_iterator ei, e_end; + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) + for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) + if (capacity[*ei] > 0) + os << *u_iter << " " << target(*ei, g) << " " + << (capacity[*ei] - residual_capacity[*ei]) << std::endl; + os << std::endl; + } + + //======================================================================= + + Graph& g; + vertices_size_type n; + vertices_size_type nm; + EdgeCapacityMap capacity; + vertex_descriptor src; + vertex_descriptor sink; + VertexIndexMap index; + + // will need to use random_access_property_map with these + std::vector< FlowValue > excess_flow; + std::vector< out_edge_iterator > current; + std::vector< distance_size_type > distance; + std::vector< default_color_type > color; + + // Edge Property Maps that must be interior to the graph + ReverseEdgeMap reverse_edge; + ResidualCapacityEdgeMap residual_capacity; + + LayerArray layers; + std::vector< list_iterator > layer_list_ptr; + distance_size_type max_distance; // maximal distance + distance_size_type max_active; // maximal distance with active node + distance_size_type min_active; // minimal distance with active node + boost::queue Q; + + // Statistics counters + long push_count; + long update_count; + long relabel_count; + long gap_count; + long gap_node_count; + + inline double global_update_frequency() { return 0.5; } + inline vertices_size_type alpha() { return 6; } + inline long beta() { return 12; } + + long work_since_last_update; + }; + + } // namespace detail + + template + typename property_traits::value_type + push_relabel_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + CapacityEdgeMap cap, ResidualCapacityEdgeMap res, + ReverseEdgeMap rev, VertexIndexMap index_map) + { + typedef typename property_traits::value_type FlowValue; + + detail::push_relabel + algo(g, cap, res, rev, src, sink, index_map); + + FlowValue flow = algo.maximum_preflow(); + + algo.convert_preflow_to_flow(); + + assert(algo.is_flow()); + assert(algo.is_optimal()); + + return flow; + } // push_relabel_max_flow() + + template + typename detail::edge_capacity_value::type + push_relabel_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + const bgl_named_params& params) + { + return push_relabel_max_flow + (g, src, sink, + choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), + choose_pmap(get_param(params, edge_residual_capacity), + g, edge_residual_capacity), + choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index) + ); + } + + template + typename property_traits< + typename property_map::const_type + >::value_type + push_relabel_max_flow + (Graph& g, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink) + { + bgl_named_params params(0); // bogus empty param + return push_relabel_max_flow(g, src, sink, params); + } + +} // namespace boost + +#endif // BOOST_PUSH_RELABEL_MAX_FLOW_HPP + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/random.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/random.hpp new file mode 100644 index 0000000000..4159a02455 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/random.hpp @@ -0,0 +1,205 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright (C) Vladimir Prus 2003 +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_RANDOM_HPP +#define BOOST_GRAPH_RANDOM_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +namespace boost { + + // grab a random vertex from the graph's vertex set + template + typename graph_traits::vertex_descriptor + random_vertex(Graph& g, RandomNumGen& gen) + { + if (num_vertices(g) > 1) { + #if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581)) + std::size_t n = std::random( num_vertices(g) ); + #else + uniform_int<> distrib(0, num_vertices(g)-1); + variate_generator > rand_gen(gen, distrib); + std::size_t n = rand_gen(); + #endif + typename graph_traits::vertex_iterator + i = vertices(g).first; + while (n-- > 0) ++i; // std::advance not VC++ portable + return *i; + } else + return *vertices(g).first; + } + + template + typename graph_traits::edge_descriptor + random_edge(Graph& g, RandomNumGen& gen) { + if (num_edges(g) > 1) { + #if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581)) + typename graph_traits::edges_size_type + n = std::random( num_edges(g) ); + #else + uniform_int<> distrib(0, num_edges(g)-1); + variate_generator > rand_gen(gen, distrib); + typename graph_traits::edges_size_type + n = rand_gen(); + #endif + typename graph_traits::edge_iterator + i = edges(g).first; + while (n-- > 0) ++i; // std::advance not VC++ portable + return *i; + } else + return *edges(g).first; + } + + namespace detail { + class dummy_property_copier { + public: + template + void operator()(const V1&, const V2&) const {} + }; + } + + template + void generate_random_graph1 + (MutableGraph& g, + typename graph_traits::vertices_size_type V, + typename graph_traits::vertices_size_type E, + RandNumGen& gen, + bool allow_parallel = true, + bool self_edges = false) + { + typedef graph_traits Traits; + typedef typename Traits::vertices_size_type v_size_t; + typedef typename Traits::edges_size_type e_size_t; + typedef typename Traits::vertex_descriptor vertex_descriptor; + + // When parallel edges are not allowed, we create a new graph which + // does not allow parallel edges, construct it and copy back. + // This is not efficient if 'g' already disallow parallel edges, + // but that's task for later. + if (!allow_parallel) { + + typedef typename boost::graph_traits::directed_category dir; + typedef typename mpl::if_, + directedS, undirectedS>::type select; + adjacency_list g2; + generate_random_graph1(g2, V, E, gen, true, self_edges); + + copy_graph(g2, g, vertex_copy(detail::dummy_property_copier()). + edge_copy(detail::dummy_property_copier())); + + } else { + + for (v_size_t i = 0; i < V; ++i) + add_vertex(g); + + for (e_size_t j = 0; j < E; ++j) { + vertex_descriptor a = random_vertex(g, gen), b; + do { + b = random_vertex(g, gen); + } while (self_edges == false && a == b); + add_edge(a, b, g); + } + } + } + + template + void generate_random_graph + (MutableGraph& g, + typename graph_traits::vertices_size_type V, + typename graph_traits::vertices_size_type E, + RandNumGen& gen, + bool allow_parallel = true, + bool self_edges = false) + { + generate_random_graph1(g, V, E, gen, allow_parallel, self_edges); + } + + template + void generate_random_graph + (MutableGraph& g, + typename graph_traits::vertices_size_type V, + typename graph_traits::vertices_size_type E, + RandNumGen& gen, + VertexOutputIterator vertex_out, + EdgeOutputIterator edge_out, + bool self_edges = false) + { + typedef graph_traits Traits; + typedef typename Traits::vertices_size_type v_size_t; + typedef typename Traits::edges_size_type e_size_t; + typedef typename Traits::vertex_descriptor vertex_t; + typedef typename Traits::edge_descriptor edge_t; + + for (v_size_t i = 0; i < V; ++i) + *vertex_out++ = add_vertex(g); + + for (e_size_t j = 0; j < E; ++j) { + vertex_t a = random_vertex(g, gen), b; + do { + b = random_vertex(g, gen); + } while (self_edges == false && a == b); + edge_t e; bool inserted; + tie(e, inserted) = add_edge(a, b, g); + if (inserted) + *edge_out++ = std::make_pair(source(e, g), target(e, g)); + } + } + + namespace detail { + + template + void randomize_property(G& g, RandomGenerator& rg, + Property, vertex_property_tag) + { + typename property_map::type pm = get(Property(), g); + typename graph_traits::vertex_iterator vi, ve; + for (tie(vi, ve) = vertices(g); vi != ve; ++vi) { + pm[*vi] = rg(); + } + } + + template + void randomize_property(G& g, RandomGenerator& rg, + Property, edge_property_tag) + { + typename property_map::type pm = get(Property(), g); + typename graph_traits::edge_iterator ei, ee; + for (tie(ei, ee) = edges(g); ei != ee; ++ei) { + pm[*ei] = rg(); + } + } + } + + template + void randomize_property(G& g, RandomGenerator& rg) + { + detail::randomize_property + (g, rg, Property(), typename property_kind::type()); + } + + + + +} + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/random_layout.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/random_layout.hpp new file mode 100644 index 0000000000..b65950d6b8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/random_layout.hpp @@ -0,0 +1,49 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_RANDOM_LAYOUT_HPP +#define BOOST_GRAPH_RANDOM_LAYOUT_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { + +template +void +random_graph_layout(const Graph& g, PositionMap position_map, + Dimension minX, Dimension maxX, + Dimension minY, Dimension maxY, + RandomNumberGenerator& gen) +{ + typedef typename mpl::if_, + uniform_int, + uniform_real >::type distrib_t; + typedef typename mpl::if_, + RandomNumberGenerator&, + uniform_01 > + ::type gen_t; + + gen_t my_gen(gen); + distrib_t x(minX, maxX); + distrib_t y(minY, maxY); + typename graph_traits::vertex_iterator vi, vi_end; + for(tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { + position_map[*vi].x = x(my_gen); + position_map[*vi].y = y(my_gen); + } +} + +} // end namespace boost + +#endif // BOOST_GRAPH_RANDOM_LAYOUT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/read_dimacs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/read_dimacs.hpp new file mode 100644 index 0000000000..4d4d160107 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/read_dimacs.hpp @@ -0,0 +1,277 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee +// +// 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) +//======================================================================= + +/* + Reads maximal flow problem in extended DIMACS format. + This works, but could use some polishing. +*/ + +/* ----------------------------------------------------------------- */ + +#include +#include +#include + +namespace boost { + +template +int read_dimacs_max_flow(Graph& g, + CapacityMap capacity, + ReverseEdgeMap reverse_edge, + typename graph_traits::vertex_descriptor& src, + typename graph_traits::vertex_descriptor& sink, + std::istream& in=std::cin) +{ + // const int MAXLINE = 100; /* max line length in the input file */ + const int ARC_FIELDS = 3; /* no of fields in arc line */ + const int NODE_FIELDS = 2; /* no of fields in node line */ + const int P_FIELDS = 3; /* no of fields in problem line */ + const char* PROBLEM_TYPE = "max"; /* name of problem type*/ + + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + std::vector verts; + + long m, n, /* number of edges and nodes */ + i, head, tail, cap; + + long no_lines=0, /* no of current input line */ + no_plines=0, /* no of problem-lines */ + no_nslines=0, /* no of node-source-lines */ + no_nklines=0, /* no of node-source-lines */ + no_alines=0; /* no of arc-lines */ + + std::string in_line; /* for reading input line */ + char pr_type[3]; /* for reading type of the problem */ + char nd; /* source (s) or sink (t) */ + + int k, /* temporary */ + err_no; /* no of detected error */ + + /* -------------- error numbers & error messages ---------------- */ + const int EN1 = 0; + const int EN2 = 1; + const int EN3 = 2; + const int EN4 = 3; + // const int EN6 = 4; + // const int EN10 = 5; + // const int EN7 = 6; + const int EN8 = 7; + const int EN9 = 8; + const int EN11 = 9; + const int EN12 = 10; + // const int EN13 = 11; + const int EN14 = 12; + const int EN16 = 13; + const int EN15 = 14; + const int EN17 = 15; + const int EN18 = 16; + const int EN21 = 17; + const int EN19 = 18; + const int EN20 = 19; + const int EN22 = 20; + + static char *err_message[] = + { + /* 0*/ "more than one problem line.", + /* 1*/ "wrong number of parameters in the problem line.", + /* 2*/ "it is not a Max Flow problem line.", + /* 3*/ "bad value of a parameter in the problem line.", + /* 4*/ "can't obtain enough memory to solve this problem.", + /* 5*/ "more than one line with the problem name.", + /* 6*/ "can't read problem name.", + /* 7*/ "problem description must be before node description.", + /* 8*/ "this parser doesn't support multiply sources and sinks.", + /* 9*/ "wrong number of parameters in the node line.", + /*10*/ "wrong value of parameters in the node line.", + /*11*/ " ", + /*12*/ "source and sink descriptions must be before arc descriptions.", + /*13*/ "too many arcs in the input.", + /*14*/ "wrong number of parameters in the arc line.", + /*15*/ "wrong value of parameters in the arc line.", + /*16*/ "unknown line type in the input.", + /*17*/ "reading error.", + /*18*/ "not enough arcs in the input.", + /*19*/ "source or sink doesn't have incident arcs.", + /*20*/ "can't read anything from the input file." + }; + /* --------------------------------------------------------------- */ + + /* The main loop: + - reads the line of the input, + - analyses its type, + - checks correctness of parameters, + - puts data to the arrays, + - does service functions + */ + + while (std::getline(in, in_line)) { + ++no_lines; + + switch (in_line[0]) { + case 'c': /* skip lines with comments */ + case '\n': /* skip empty lines */ + case '\0': /* skip empty lines at the end of file */ + break; + + case 'p': /* problem description */ + if ( no_plines > 0 ) + /* more than one problem line */ + { err_no = EN1 ; goto error; } + + no_plines = 1; + + if ( + /* reading problem line: type of problem, no of nodes, no of arcs */ + sscanf ( in_line.c_str(), "%*c %3s %ld %ld", pr_type, &n, &m ) + != P_FIELDS + ) + /*wrong number of parameters in the problem line*/ + { err_no = EN2; goto error; } + + if ( strcmp ( pr_type, PROBLEM_TYPE ) ) + /*wrong problem type*/ + { err_no = EN3; goto error; } + + if ( n <= 0 || m <= 0 ) + /*wrong value of no of arcs or nodes*/ + { err_no = EN4; goto error; } + + { + for (long vi = 0; vi < n; ++vi) + verts.push_back(add_vertex(g)); + } + break; + + case 'n': /* source(s) description */ + if ( no_plines == 0 ) + /* there was not problem line above */ + { err_no = EN8; goto error; } + + /* reading source or sink */ + k = sscanf ( in_line.c_str(),"%*c %ld %c", &i, &nd ); + --i; // index from 0 + if ( k < NODE_FIELDS ) + /* node line is incorrect */ + { err_no = EN11; goto error; } + + if ( i < 0 || i > n ) + /* wrong value of node */ + { err_no = EN12; goto error; } + + switch (nd) { + case 's': /* source line */ + + if ( no_nslines != 0) + /* more than one source line */ + { err_no = EN9; goto error; } + + no_nslines = 1; + src = verts[i]; + break; + + case 't': /* sink line */ + + if ( no_nklines != 0) + /* more than one sink line */ + { err_no = EN9; goto error; } + + no_nklines = 1; + sink = verts[i]; + break; + + default: + /* wrong type of node-line */ + err_no = EN12; goto error; + } + break; + + case 'a': /* arc description */ + if ( no_nslines == 0 || no_nklines == 0 ) + /* there was not source and sink description above */ + { err_no = EN14; goto error; } + + if ( no_alines >= m ) + /*too many arcs on input*/ + { err_no = EN16; goto error; } + + if ( + /* reading an arc description */ + sscanf ( in_line.c_str(),"%*c %ld %ld %ld", + &tail, &head, &cap ) + != ARC_FIELDS + ) + /* arc description is not correct */ + { err_no = EN15; goto error; } + + --tail; // index from 0, not 1 + --head; + if ( tail < 0 || tail > n || + head < 0 || head > n + ) + /* wrong value of nodes */ + { err_no = EN17; goto error; } + + { + edge_descriptor e1, e2; + bool in1, in2; + tie(e1, in1) = add_edge(verts[tail], verts[head], g); + tie(e2, in2) = add_edge(verts[head], verts[tail], g); + if (!in1 || !in2) { + std::cerr << "unable to add edge (" << head << "," << tail << ")" + << std::endl; + return -1; + } + capacity[e1] = cap; + capacity[e2] = 0; + reverse_edge[e1] = e2; + reverse_edge[e2] = e1; + } + ++no_alines; + break; + + default: + /* unknown type of line */ + err_no = EN18; goto error; + + } /* end of switch */ + } /* end of input loop */ + + /* ----- all is red or error while reading ----- */ + + if ( feof (stdin) == 0 ) /* reading error */ + { err_no=EN21; goto error; } + + if ( no_lines == 0 ) /* empty input */ + { err_no = EN22; goto error; } + + if ( no_alines < m ) /* not enough arcs */ + { err_no = EN19; goto error; } + + if ( out_degree(src, g) == 0 || out_degree(sink, g) == 0 ) + /* no arc goes out of the source */ + { err_no = EN20; goto error; } + + /* Thanks God! all is done */ + return (0); + + /* ---------------------------------- */ + error: /* error found reading input */ + + printf ( "\nline %ld of input - %s\n", + no_lines, err_message[err_no] ); + + exit (1); + return (0); /* to avoid warning */ +} +/* -------------------- end of parser -------------------*/ + +} // namespace boost diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/relax.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/relax.hpp new file mode 100644 index 0000000000..29205d1940 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/relax.hpp @@ -0,0 +1,77 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, +// +// 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_GRAPH_RELAX_HPP +#define BOOST_GRAPH_RELAX_HPP + +#include +#include // for numeric limits +#include +#include + +namespace boost { + + // The following version of the plus functor prevents + // problems due to overflow at positive infinity. + + template + struct closed_plus + { + T operator()(const T& a, const T& b) const { + using namespace std; + T zero(0); + T result = a + b; + if (result < zero && a >= zero && b >= zero) + return (numeric_limits::max)(); + return result; + } + }; + + template + bool relax(typename graph_traits::edge_descriptor e, + const Graph& g, const WeightMap& w, + PredecessorMap& p, DistanceMap& d, + const BinaryFunction& combine, const BinaryPredicate& compare) + { + typedef typename graph_traits::directed_category DirCat; + bool is_undirected = is_same::value; + typedef typename graph_traits::vertex_descriptor Vertex; + Vertex u = source(e, g), v = target(e, g); + typedef typename property_traits::value_type D; + typedef typename property_traits::value_type W; + D d_u = get(d, u), d_v = get(d, v); + W w_e = get(w, e); + + if ( compare(combine(d_u, w_e), d_v) ) { + put(d, v, combine(d_u, w_e)); + put(p, v, u); + return true; + } else if (is_undirected && compare(combine(d_v, w_e), d_u)) { + put(d, u, combine(d_v, w_e)); + put(p, u, v); + return true; + } else + return false; + } + + template + bool relax(typename graph_traits::edge_descriptor e, + const Graph& g, WeightMap w, PredecessorMap p, DistanceMap d) + { + typedef typename property_traits::value_type D; + typedef closed_plus Combine; + typedef std::less Compare; + return relax(e, g, w, p, d, Combine(), Compare()); + } + +} // namespace boost + +#endif /* BOOST_GRAPH_RELAX_HPP */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/reverse_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/reverse_graph.hpp new file mode 100644 index 0000000000..314584fabf --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/reverse_graph.hpp @@ -0,0 +1,324 @@ +// (C) Copyright David Abrahams 2000. +// 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 REVERSE_GRAPH_DWA092300_H_ +# define REVERSE_GRAPH_DWA092300_H_ + +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define BidirectionalGraph BidirectionalGraph_ +#endif + +namespace boost { + +struct reverse_graph_tag { }; + + namespace detail { + + template struct choose_rev_edge_iter { }; + template <> struct choose_rev_edge_iter { + template struct bind_ { + typedef typename graph_traits::edge_iterator type; + }; + }; + template <> struct choose_rev_edge_iter { + template struct bind_ { + typedef void type; + }; + }; + + } // namespace detail + +template +class reverse_graph { + typedef reverse_graph Self; + typedef graph_traits Traits; + public: + typedef BidirectionalGraph base_type; + + // Constructor + reverse_graph(GraphRef g) : m_g(g) {} + + // Graph requirements + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::edge_descriptor edge_descriptor; + typedef typename Traits::directed_category directed_category; + typedef typename Traits::edge_parallel_category edge_parallel_category; + typedef typename Traits::traversal_category traversal_category; + + // IncidenceGraph requirements + typedef typename Traits::in_edge_iterator out_edge_iterator; + typedef typename Traits::degree_size_type degree_size_type; + + // BidirectionalGraph requirements + typedef typename Traits::out_edge_iterator in_edge_iterator; + + // AdjacencyGraph requirements + typedef typename adjacency_iterator_generator::type adjacency_iterator; + + // VertexListGraph requirements + typedef typename Traits::vertex_iterator vertex_iterator; + + // EdgeListGraph requirements + enum { is_edge_list = is_convertible::value }; + typedef detail::choose_rev_edge_iter ChooseEdgeIter; + typedef typename ChooseEdgeIter:: + template bind_::type edge_iterator; + typedef typename Traits::vertices_size_type vertices_size_type; + typedef typename Traits::edges_size_type edges_size_type; + + // More typedefs used by detail::edge_property_map, vertex_property_map + typedef typename BidirectionalGraph::edge_property_type + edge_property_type; + typedef typename BidirectionalGraph::vertex_property_type + vertex_property_type; + typedef reverse_graph_tag graph_tag; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + // Bundled properties support + template + typename graph::detail::bundled_result::type& + operator[](Descriptor x) + { return m_g[x]; } + + template + typename graph::detail::bundled_result::type const& + operator[](Descriptor x) const + { return m_g[x]; } +#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + + static vertex_descriptor null_vertex() + { return Traits::null_vertex(); } + + // would be private, but template friends aren't portable enough. + // private: + GraphRef m_g; +}; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + struct vertex_bundle_type > + : vertex_bundle_type { }; + + template + struct edge_bundle_type > + : edge_bundle_type { }; +#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + +template +inline reverse_graph +make_reverse_graph(const BidirectionalGraph& g) +{ + return reverse_graph(g); +} + +template +inline reverse_graph +make_reverse_graph(BidirectionalGraph& g) +{ + return reverse_graph(g); +} + +template +std::pair::vertex_iterator, + typename reverse_graph::vertex_iterator> +vertices(const reverse_graph& g) +{ + return vertices(g.m_g); +} + +template +std::pair::edge_iterator, + typename reverse_graph::edge_iterator> +edges(const reverse_graph& g) +{ + return edges(g.m_g); +} + +template +inline std::pair +out_edges(const typename BidirectionalGraph::vertex_descriptor u, + const reverse_graph& g) +{ + return in_edges(u, g.m_g); +} + +template +inline typename BidirectionalGraph::vertices_size_type +num_vertices(const reverse_graph& g) +{ + return num_vertices(g.m_g); +} + +template +inline typename reverse_graph::edges_size_type +num_edges(const reverse_graph& g) +{ + return num_edges(g.m_g); +} + +template +inline typename BidirectionalGraph::degree_size_type +out_degree(const typename BidirectionalGraph::vertex_descriptor u, + const reverse_graph& g) +{ + return in_degree(u, g.m_g); +} + +template +inline std::pair +edge(const typename BidirectionalGraph::vertex_descriptor u, + const typename BidirectionalGraph::vertex_descriptor v, + const reverse_graph& g) +{ + return edge(v, u, g.m_g); +} + +template +inline std::pair +in_edges(const typename BidirectionalGraph::vertex_descriptor u, + const reverse_graph& g) +{ + return out_edges(u, g.m_g); +} + +template +inline std::pair::adjacency_iterator, + typename reverse_graph::adjacency_iterator> +adjacent_vertices(const typename BidirectionalGraph::vertex_descriptor u, + const reverse_graph& g) +{ + typedef reverse_graph Graph; + typename Graph::out_edge_iterator first, last; + tie(first, last) = out_edges(u, g); + typedef typename Graph::adjacency_iterator adjacency_iterator; + return std::make_pair(adjacency_iterator(first, const_cast(&g)), + adjacency_iterator(last, const_cast(&g))); +} + +template +inline typename BidirectionalGraph::degree_size_type +in_degree(const typename BidirectionalGraph::vertex_descriptor u, + const reverse_graph& g) +{ + return out_degree(u, g.m_g); +} + +template +inline typename graph_traits::vertex_descriptor +source(const Edge& e, const reverse_graph& g) +{ + return target(e, g.m_g); +} + +template +inline typename graph_traits::vertex_descriptor +target(const Edge& e, const reverse_graph& g) +{ + return source(e, g.m_g); +} + + +namespace detail { + + struct reverse_graph_vertex_property_selector { + template + struct bind_ { + typedef typename ReverseGraph::base_type Graph; + typedef property_map PMap; + typedef typename PMap::type type; + typedef typename PMap::const_type const_type; + }; + }; + + struct reverse_graph_edge_property_selector { + template + struct bind_ { + typedef typename ReverseGraph::base_type Graph; + typedef property_map PMap; + typedef typename PMap::type type; + typedef typename PMap::const_type const_type; + }; + }; + +} // namespace detail + +template <> +struct vertex_property_selector { + typedef detail::reverse_graph_vertex_property_selector type; +}; + +template <> +struct edge_property_selector { + typedef detail::reverse_graph_edge_property_selector type; +}; + +template +typename property_map::type +get(Property p, reverse_graph& g) +{ + return get(p, g.m_g); +} + +template +typename property_map::const_type +get(Property p, const reverse_graph& g) +{ + const BidirGraph& gref = g.m_g; // in case GRef is non-const + return get(p, gref); +} + +template +typename property_traits< + typename property_map::const_type +>::value_type +get(Property p, const reverse_graph& g, const Key& k) +{ + return get(p, g.m_g, k); +} + +template +void +put(Property p, const reverse_graph& g, const Key& k, + const Value& val) +{ + put(p, g.m_g, k, val); +} + +template +inline void +set_property(const reverse_graph& g, Tag tag, + const Value& value) +{ + set_property(g.m_g, tag, value); +} + +template +inline +typename graph_property::type +get_property(const reverse_graph& g, Tag tag) +{ + return get_property(g.m_g, tag); +} + +} // namespace boost + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# undef BidirectionalGraph +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/sequential_vertex_coloring.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/sequential_vertex_coloring.hpp new file mode 100644 index 0000000000..606f2e52d2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/sequential_vertex_coloring.hpp @@ -0,0 +1,124 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2004 The Trustees of Indiana University +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_SEQUENTIAL_VERTEX_COLORING_HPP +#define BOOST_GRAPH_SEQUENTIAL_VERTEX_COLORING_HPP + +#include +#include +#include +#include +#include + +#ifdef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# include +#endif + +/* This algorithm is to find coloring of a graph + + Algorithm: + Let G = (V,E) be a graph with vertices (somehow) ordered v_1, v_2, ..., + v_n. For k = 1, 2, ..., n the sequential algorithm assigns v_k to the + smallest possible color. + + Reference: + + Thomas F. Coleman and Jorge J. More, Estimation of sparse Jacobian + matrices and graph coloring problems. J. Numer. Anal. V20, P187-209, 1983 + + v_k is stored as o[k] here. + + The color of the vertex v will be stored in color[v]. + i.e., vertex v belongs to coloring color[v] */ + +namespace boost { + template + typename property_traits::value_type + sequential_vertex_coloring(const VertexListGraph& G, OrderPA order, + ColorMap color) + { + typedef graph_traits GraphTraits; + typedef typename GraphTraits::vertex_descriptor Vertex; + typedef typename property_traits::value_type size_type; + + size_type max_color = 0; + const size_type V = num_vertices(G); + + // We need to keep track of which colors are used by + // adjacent vertices. We do this by marking the colors + // that are used. The mark array contains the mark + // for each color. The length of mark is the + // number of vertices since the maximum possible number of colors + // is the number of vertices. + std::vector mark(V, + std::numeric_limits::max BOOST_PREVENT_MACRO_SUBSTITUTION()); + + //Initialize colors + typename GraphTraits::vertex_iterator v, vend; + for (tie(v, vend) = vertices(G); v != vend; ++v) + put(color, *v, V-1); + + //Determine the color for every vertex one by one + for ( size_type i = 0; i < V; i++) { + Vertex current = get(order,i); + typename GraphTraits::adjacency_iterator v, vend; + + //Mark the colors of vertices adjacent to current. + //i can be the value for marking since i increases successively + for (tie(v,vend) = adjacent_vertices(current, G); v != vend; ++v) + mark[get(color,*v)] = i; + + //Next step is to assign the smallest un-marked color + //to the current vertex. + size_type j = 0; + + //Scan through all useable colors, find the smallest possible + //color that is not used by neighbors. Note that if mark[j] + //is equal to i, color j is used by one of the current vertex's + //neighbors. + while ( j < max_color && mark[j] == i ) + ++j; + + if ( j == max_color ) //All colors are used up. Add one more color + ++max_color; + + //At this point, j is the smallest possible color + put(color, current, j); //Save the color of vertex current + } + + return max_color; + } + + template + typename property_traits::value_type + sequential_vertex_coloring(const VertexListGraph& G, ColorMap color) + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef typename graph_traits::vertex_iterator + vertex_iterator; + + std::pair v = vertices(G); +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS + std::vector order(v.first, v.second); +#else + std::vector order; + order.reserve(std::distance(v.first, v.second)); + while (v.first != v.second) order.push_back(*v.first++); +#endif + return sequential_vertex_coloring + (G, + make_iterator_property_map + (order.begin(), identity_property_map(), + graph_traits::null_vertex()), + color); + } +} + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/simple_point.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/simple_point.hpp new file mode 100644 index 0000000000..5f19c75f78 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/simple_point.hpp @@ -0,0 +1,23 @@ +//======================================================================= +// Copyright 2005 Trustees of Indiana University +// Authors: Andrew Lumsdaine, Douglas Gregor +// +// 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_GRAPH_SIMPLE_POINT_HPP +#define BOOST_GRAPH_SIMPLE_POINT_HPP + +namespace boost { + +template +struct simple_point +{ + T x; + T y; +}; + +} // end namespace boost + +#endif // BOOST_GRAPH_SIMPLE_POINT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/sloan_ordering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/sloan_ordering.hpp new file mode 100644 index 0000000000..b0855e5a1f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/sloan_ordering.hpp @@ -0,0 +1,448 @@ +// +//======================================================================= +// Copyright 2002 Marc Wintermantel (wintermantel@even-ag.ch) +// ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st) +// +// 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_GRAPH_SLOAN_HPP +#define BOOST_GRAPH_SLOAN_HPP + +#define WEIGHT1 1 //default weight for the distance in the Sloan algorithm +#define WEIGHT2 2 //default weight for the degree in the Sloan algorithm +#define MAXINT 2147483647 //Maximum value for a 32bit integer + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +// +//Sloan-Algorithm for graph reordering +//(optimzes profile and wavefront, not primiraly bandwidth +// +//////////////////////////////////////////////////////////// + +namespace boost { + + ///////////////////////////////////////////////////////////////////////// + // Function that returns the maximum depth of + // a rooted level strucutre (RLS) + // + ///////////////////////////////////////////////////////////////////////// + template + unsigned RLS_depth(Distance& d) + { + unsigned h_s = 0; + typename Distance::iterator iter; + + for (iter = d.begin(); iter != d.end(); ++iter) + { + if(*iter > h_s) + { + h_s = *iter; + } + } + + return h_s; + } + + + + ///////////////////////////////////////////////////////////////////////// + // Function that returns the width of the largest level of + // a rooted level strucutre (RLS) + // + ///////////////////////////////////////////////////////////////////////// + template + unsigned RLS_max_width(Distance& d, my_int depth) + { + + //Searching for the maximum width of a level + std::vector dummy_width(depth+1, 0); + std::vector::iterator my_it; + typename Distance::iterator iter; + unsigned w_max = 0; + + for (iter = d.begin(); iter != d.end(); ++iter) + { + dummy_width[*iter]++; + } + + for(my_it = dummy_width.begin(); my_it != dummy_width.end(); ++my_it) + { + if(*my_it > w_max) w_max = *my_it; + } + + return w_max; + + } + + + ///////////////////////////////////////////////////////////////////////// + // Function for finding a good starting node for Sloan algorithm + // + // This is to find a good starting node. "good" is in the sense + // of the ordering generated. + ///////////////////////////////////////////////////////////////////////// + template + typename graph_traits::vertex_descriptor + sloan_start_end_vertices(Graph& G, + typename graph_traits::vertex_descriptor &s, + ColorMap color, + DegreeMap degree) + { + typedef typename property_traits::value_type Degree; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename std::vector< typename graph_traits::vertices_size_type>::iterator vec_iter; + typedef typename graph_traits::vertices_size_type size_type; + + typedef typename property_map::const_type VertexID; + + s = *(vertices(G).first); + Vertex e = s; + Vertex i; + unsigned my_degree = get(degree, s ); + unsigned dummy, h_i, h_s, w_i, w_e; + bool new_start = true; + unsigned maximum_degree = 0; + + //Creating a std-vector for storing the distance from the start vertex in dist + std::vector::vertices_size_type> dist(num_vertices(G), 0); + + //Wrap a property_map_iterator around the std::iterator + boost::iterator_property_map dist_pmap(dist.begin(), get(vertex_index, G)); + + //Creating a property_map for the indices of a vertex + typename property_map::type index_map = get(vertex_index, G); + + //Creating a priority queue + typedef indirect_cmp > Compare; + Compare comp(degree); + std::priority_queue, Compare> degree_queue(comp); + + //step 1 + //Scan for the vertex with the smallest degree and the maximum degree + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) + { + dummy = get(degree, *ui); + + if(dummy < my_degree) + { + my_degree = dummy; + s = *ui; + } + + if(dummy > maximum_degree) + { + maximum_degree = dummy; + } + } + //end 1 + + do{ + new_start = false; //Setting the loop repetition status to false + + //step 2 + //initialize the the disance std-vector with 0 + for(typename std::vector::vertices_size_type>::iterator iter = dist.begin(); iter != dist.end(); ++iter) *iter = 0; + + //generating the RLS (rooted level structure) + breadth_first_search + (G, s, visitor + ( + make_bfs_visitor(record_distances(dist_pmap, on_tree_edge() ) ) + ) + ); + + //end 2 + + //step 3 + //calculating the depth of the RLS + h_s = RLS_depth(dist); + + //step 4 + //pushing one node of each degree in an ascending manner into degree_queue + std::vector shrink_trace(maximum_degree, false); + for (tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) + { + dummy = get(degree, *ui); + + if( (dist[index_map[*ui]] == h_s ) && ( !shrink_trace[ dummy ] ) ) + { + degree_queue.push(*ui); + shrink_trace[ dummy ] = true; + } + } + + //end 3 & 4 + + + //step 5 + //Initializing w + w_e = MAXINT; + //end 5 + + + //step 6 + //Testing for termination + while( !degree_queue.empty() ) + { + i = degree_queue.top(); //getting the node with the lowest degree from the degree queue + degree_queue.pop(); //ereasing the node with the lowest degree from the degree queue + + //generating a RLS + for(typename std::vector::vertices_size_type>::iterator iter = dist.begin(); iter != dist.end(); ++iter) *iter = 0; + + breadth_first_search + (G, i, boost::visitor + ( + make_bfs_visitor(record_distances(dist_pmap, on_tree_edge() ) ) + ) + ); + + //Calculating depth and width of the rooted level + h_i = RLS_depth(dist); + w_i = RLS_max_width(dist, h_i); + + //Testing for termination + if( (h_i > h_s) && (w_i < w_e) ) + { + h_s = h_i; + s = i; + while(!degree_queue.empty()) degree_queue.pop(); + new_start = true; + } + else if(w_i < w_e) + { + w_e = w_i; + e = i; + } + } + //end 6 + + }while(new_start); + + return e; + } + + ////////////////////////////////////////////////////////////////////////// + // Sloan algorithm with a given starting Vertex. + // + // This algorithm requires user to provide a starting vertex to + // compute Sloan ordering. + ////////////////////////////////////////////////////////////////////////// + template + OutputIterator + sloan_ordering(Graph& g, + typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor e, + OutputIterator permutation, + ColorMap color, + DegreeMap degree, + PriorityMap priority, + Weight W1, + Weight W2) + { + //typedef typename property_traits::value_type Degree; + typedef typename property_traits::value_type Degree; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename std::vector::vertices_size_type>::iterator vec_iter; + typedef typename graph_traits::vertices_size_type size_type; + + typedef typename property_map::const_type VertexID; + + + //Creating a std-vector for storing the distance from the end vertex in it + typename std::vector::vertices_size_type> dist(num_vertices(g), 0); + + //Wrap a property_map_iterator around the std::iterator + boost::iterator_property_map dist_pmap(dist.begin(), get(vertex_index, g)); + + breadth_first_search + (g, e, visitor + ( + make_bfs_visitor(record_distances(dist_pmap, on_tree_edge() ) ) + ) + ); + + //Creating a property_map for the indices of a vertex + typename property_map::type index_map = get(vertex_index, g); + + //Sets the color and priority to their initial status + unsigned cdeg; + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) + { + put(color, *ui, Color::white()); + cdeg=get(degree, *ui)+1; + put(priority, *ui, W1*dist[index_map[*ui]]-W2*cdeg ); + } + + //Priority list + typedef indirect_cmp > Compare; + Compare comp(priority); + std::list priority_list; + + //Some more declarations + typename graph_traits::out_edge_iterator ei, ei_end, ei2, ei2_end; + Vertex u, v, w; + + put(color, s, Color::green()); //Sets the color of the starting vertex to gray + priority_list.push_front(s); //Puts s into the priority_list + + while ( !priority_list.empty() ) + { + priority_list.sort(comp); //Orders the elements in the priority list in an ascending manner + + u = priority_list.front(); //Accesses the last element in the priority list + priority_list.pop_front(); //Removes the last element in the priority list + + if(get(color, u) == Color::green() ) + { + //for-loop over all out-edges of vertex u + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) + { + v = target(*ei, g); + + put( priority, v, get(priority, v) + W2 ); //updates the priority + + if (get(color, v) == Color::white() ) //test if the vertex is inactive + { + put(color, v, Color::green() ); //giving the vertex a preactive status + priority_list.push_front(v); //writing the vertex in the priority_queue + } + } + } + + //Here starts step 8 + *permutation++ = u; //Puts u to the first position in the permutation-vector + put(color, u, Color::black() ); //Gives u an inactive status + + //for loop over all the adjacent vertices of u + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + + v = target(*ei, g); + + if (get(color, v) == Color::green() ) { //tests if the vertex is inactive + + put(color, v, Color::red() ); //giving the vertex an active status + put(priority, v, get(priority, v)+W2); //updates the priority + + //for loop over alll adjacent vertices of v + for (tie(ei2, ei2_end) = out_edges(v, g); ei2 != ei2_end; ++ei2) { + w = target(*ei2, g); + + if(get(color, w) != Color::black() ) { //tests if vertex is postactive + + put(priority, w, get(priority, w)+W2); //updates the priority + + if(get(color, w) == Color::white() ){ + + put(color, w, Color::green() ); // gives the vertex a preactive status + priority_list.push_front(w); // puts the vertex into the priority queue + + } //end if + + } //end if + + } //end for + + } //end if + + } //end for + + } //end while + + + return permutation; + } + + ///////////////////////////////////////////////////////////////////////////////////////// + // Same algorithm as before, but without the weights given (taking default weights + template + OutputIterator + sloan_ordering(Graph& g, + typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor e, + OutputIterator permutation, + ColorMap color, + DegreeMap degree, + PriorityMap priority) + { + return sloan_ordering(g, s, e, permutation, color, degree, priority, WEIGHT1, WEIGHT2); + } + + + ////////////////////////////////////////////////////////////////////////// + // Sloan algorithm without a given starting Vertex. + // + // This algorithm finds a good starting vertex itself to + // compute Sloan-ordering. + ////////////////////////////////////////////////////////////////////////// + + + + template < class Graph, class OutputIterator, + class Color, class Degree, + class Priority, class Weight> + inline OutputIterator + sloan_ordering(Graph& G, + OutputIterator permutation, + Color color, + Degree degree, + Priority priority, + Weight W1, + Weight W2 ) + { + typedef typename boost::graph_traits::vertex_descriptor Vertex; + + Vertex s, e; + e = sloan_start_end_vertices(G, s, color, degree); + + return sloan_ordering(G, s, e, permutation, color, degree, priority, W1, W2); + } + + ///////////////////////////////////////////////////////////////////////////////////////// + // Same as before, but without given weights (default weights are taken instead) + template < class Graph, class OutputIterator, + class Color, class Degree, + class Priority > + inline OutputIterator + sloan_ordering(Graph& G, + OutputIterator permutation, + Color color, + Degree degree, + Priority priority) + { + return sloan_ordering(G, permutation, color, degree, priority, WEIGHT1, WEIGHT2); + } + + +} // namespace boost + + +#endif // BOOST_GRAPH_SLOAN_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/small_world_generator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/small_world_generator.hpp new file mode 100644 index 0000000000..ae26633719 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/small_world_generator.hpp @@ -0,0 +1,114 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_SMALL_WORLD_GENERATOR_HPP +#define BOOST_GRAPH_SMALL_WORLD_GENERATOR_HPP + +#include +#include +#include +#include + +namespace boost { + + // Assumes undirected + template + class small_world_iterator + { + typedef typename graph_traits::vertices_size_type + vertices_size_type; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + small_world_iterator() : gen(0) {} + small_world_iterator(RandomGenerator& gen, vertices_size_type n, + vertices_size_type k, double prob = 0.0, + bool allow_self_loops = false) + : gen(&gen), n(n), k(k), prob(prob), source(0), + target(allow_self_loops? 0 : 1), + allow_self_loops(allow_self_loops), + current(0, allow_self_loops? 0 : 1) + { } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + small_world_iterator& operator++() + { + target = (target + 1) % n; + if (target == (source + k/2 + 1) % n) { + ++source; + if (allow_self_loops) target = source; + else target = (source + 1) % n; + } + current.first = source; + + uniform_01 rand01(*gen); + uniform_int rand_vertex_gen(0, n-1); + double x = rand01(); + *gen = rand01.base(); // GRRRR + if (x < prob) { + vertices_size_type lower = (source + n - k/2) % n; + vertices_size_type upper = (source + k/2) % n; + do { + current.second = rand_vertex_gen(*gen); + } while (current.second >= lower && current.second <= upper + || (upper < lower + && (current.second >= lower || current.second <= upper))); + } else { + current.second = target; + } + return *this; + } + + small_world_iterator operator++(int) + { + small_world_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const small_world_iterator& other) const + { + if (!gen && other.gen) return other == *this; + else if (gen && !other.gen) return source == n; + else if (!gen && !other.gen) return true; + return source == other.source && target == other.target; + } + + bool operator!=(const small_world_iterator& other) const + { return !(*this == other); } + + private: + void next() + { + uniform_int rand_vertex(0, n-1); + current.first = rand_vertex(*gen); + do { + current.second = rand_vertex(*gen); + } while (current.first == current.second && !allow_self_loops); + } + + RandomGenerator* gen; + vertices_size_type n; + vertices_size_type k; + double prob; + vertices_size_type source; + vertices_size_type target; + bool allow_self_loops; + value_type current; + }; + +} // end namespace boost + +#endif // BOOST_GRAPH_SMALL_WORLD_GENERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/smallest_last_ordering.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/smallest_last_ordering.hpp new file mode 100644 index 0000000000..648efc61e8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/smallest_last_ordering.hpp @@ -0,0 +1,122 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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) +//======================================================================= + +// Revision History: +// 17 March 2006: Fixed a bug: when updating the degree a vertex +// could be moved to a wrong bucket. (Roman Dementiev) +// + + + +#ifndef BOOST_SMALLEST_LAST_VERTEX_ORDERING_HPP +#define BOOST_SMALLEST_LAST_VERTEX_ORDERING_HPP +/* + The smallest-last ordering is defined for the loopless graph G with + vertices a(j), j = 1,2,...,n where a(j) is the j-th column of A and + with edge (a(i),a(j)) if and only if columns i and j have a + non-zero in the same row position. The smallest-last ordering is + determined recursively by letting list(k), k = n,...,1 be a column + with least degree in the subgraph spanned by the un-ordered + columns. + */ +#include +#include +#include +#include +#include + +namespace boost { + + template + void + smallest_last_vertex_ordering(const VertexListGraph& G, Order order, + Degree degree, Marker marker) { + typedef typename boost::graph_traits GraphTraits; + typedef typename GraphTraits::vertex_descriptor Vertex; + //typedef typename GraphTraits::size_type size_type; + typedef std::size_t size_type; + + const size_type num = num_vertices(G); + + typedef typename boost::detail::vertex_property_map::type ID; + typedef bucket_sorter BucketSorter; + + BucketSorter degree_bucket_sorter(num, num, degree, + get(vertex_index,G)); + + smallest_last_vertex_ordering(G, order, degree, marker, degree_bucket_sorter); + } + + template + void + smallest_last_vertex_ordering(const VertexListGraph& G, Order order, + Degree degree, Marker marker, + BucketSorter& degree_buckets) { + typedef typename boost::graph_traits GraphTraits; + typedef typename GraphTraits::vertex_descriptor Vertex; + //typedef typename GraphTraits::size_type size_type; + typedef std::size_t size_type; + + const size_type num = num_vertices(G); + + typename GraphTraits::vertex_iterator v, vend; + for (boost::tie(v, vend) = vertices(G); v != vend; ++v) { + put(marker, *v, num); + put(degree, *v, out_degree(*v, G)); + degree_buckets.push(*v); + } + + size_type minimum_degree = 0; + size_type current_order = num - 1; + + while ( 1 ) { + typedef typename BucketSorter::stack MDStack; + MDStack minimum_degree_stack = degree_buckets[minimum_degree]; + while (minimum_degree_stack.empty()) + minimum_degree_stack = degree_buckets[++minimum_degree]; + + Vertex node = minimum_degree_stack.top(); + put(order, current_order, node); + + if ( current_order == 0 ) //find all vertices + break; + + minimum_degree_stack.pop(); + put(marker, node, 0); //node has been ordered. + + typename GraphTraits::adjacency_iterator v, vend; + for (boost::tie(v,vend) = adjacent_vertices(node, G); v != vend; ++v) + + if ( get(marker,*v) > current_order ) { //*v is unordered vertex + put(marker, *v, current_order); //mark the columns adjacent to node + + //delete *v from the bucket sorter + degree_buckets.remove(*v); + + //It is possible minimum degree goes down + //Here we keep tracking it. + put(degree, *v, get(degree, *v) - 1); + BOOST_USING_STD_MIN(); + minimum_degree = min BOOST_PREVENT_MACRO_SUBSTITUTION(minimum_degree, get(degree, *v)); + + //reinsert *v in the bucket sorter with the new degree + degree_buckets.push(*v); + } + + current_order--; + } + + //at this point, order[i] = v_i; + } + +} + +#endif + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/stanford_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/stanford_graph.hpp new file mode 100644 index 0000000000..c98bba1167 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/stanford_graph.hpp @@ -0,0 +1,565 @@ +//======================================================================= +// Copyright 1997-2001 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_SGB_GRAPH_HPP +#define BOOST_GRAPH_SGB_GRAPH_HPP + +#include +#include +#include +#include +#include +#include + +// Thanks to Andreas Scherer for numerous suggestions and fixes! + +// This file adapts a Stanford GraphBase (SGB) Graph pointer into a +// VertexListGraph. Note that a graph adaptor class is not needed, +// SGB's Graph* is used as is. The VertexListGraph concept is fulfilled by +// defining the appropriate non-member functions for Graph*. +// +// The PROTOTYPES change file extensions to SGB must be applied so +// that the SGB functions have real prototypes which are necessary for +// the C++ compiler. To apply the PROTOTYPES extensions, before you do +// "make tests install" for SGB do "ln -s PROTOTYPES/* ." to the SGB +// root directory (or just copy all the files from the PROTOTYPES +// directory to the SGB root directory). +// +extern "C" { + // We include all global definitions for the general stuff + // of The Stanford GraphBase and its various graph generator + // functions by reading all SGB headerfiles as in section 2 of + // the "test_sample" program. +#include /* SGB data structures */ +#include /* SGB input/output routines */ +#include /* random number generator */ +#include /* routines for shortest paths */ +#include /* the basic graph operations */ +#undef empty /* avoid name clash with C++ standard library */ + inline Graph* empty( long n ) /* and provide workaround */ + { return board(n,0L,0L,0L,2L,0L,0L); } +#include /* graphs based on literature */ +#include /* graphs based on economic data */ +#include /* graphs based on football scores */ +#include /* graphs based on logic circuits */ +#undef val /* avoid name clash with g++ headerfile stl_tempbuf.h */ + // val ==> Vertex::x.I +#include /* graphs based on Mona Lisa */ +#include /* graphs based on mileage data */ +#include /* planar graphs */ +#include /* Ramanujan graphs */ +#include /* random graphs */ +#include /* graphs based on Roget's Thesaurus */ +#include /* we save results in ASCII format */ +#include /* five-letter-word graphs */ +#undef weight /* avoid name clash with BGL parameter */ + // weight ==> Vertex::u.I +} + +namespace boost { + class sgb_edge; +} + +class sgb_out_edge_iterator; +class sgb_adj_iterator; +class sgb_vertex_iterator; + +namespace boost { + typedef Graph* sgb_graph_ptr; + typedef const Graph* sgb_const_graph_ptr; + + struct sgb_traversal_tag : + public virtual vertex_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag { }; + + template <> struct graph_traits { + typedef Vertex* vertex_descriptor; + typedef boost::sgb_edge edge_descriptor; + typedef sgb_out_edge_iterator out_edge_iterator; + typedef void in_edge_iterator; + typedef sgb_adj_iterator adjacency_iterator; + typedef sgb_vertex_iterator vertex_iterator; + typedef void edge_iterator; + typedef long vertices_size_type; + typedef long edge_size_type; + typedef long degree_size_type; + typedef directed_tag directed_category; + typedef sgb_traversal_tag traversal_category; + typedef allow_parallel_edge_tag edge_parallel_category; + }; + template <> struct graph_traits { + typedef Vertex* vertex_descriptor; + typedef boost::sgb_edge edge_descriptor; + typedef sgb_out_edge_iterator out_edge_iterator; + typedef void in_edge_iterator; + typedef sgb_adj_iterator adjacency_iterator; + typedef sgb_vertex_iterator vertex_iterator; + typedef void edge_iterator; + typedef long vertices_size_type; + typedef long edge_size_type; + typedef long degree_size_type; + typedef directed_tag directed_category; + typedef sgb_traversal_tag traversal_category; + typedef allow_parallel_edge_tag edge_parallel_category; + }; +} + +namespace boost { + + struct edge_length_t { + typedef edge_property_tag kind; + }; + + // We could just use Arc* as the edge descriptor type, but + // we want to add the source(e,g) function which requires + // that we carry along a pointer to the source vertex. + class sgb_edge { + typedef sgb_edge self; + public: + sgb_edge() : _arc(0), _src(0) { } + sgb_edge(Arc* a, Vertex* s) : _arc(a), _src(s) { } + friend Vertex* source(self e, sgb_const_graph_ptr) { return e._src; } + friend Vertex* target(self e, sgb_const_graph_ptr) { return e._arc->tip; } + friend bool operator==(const self& a, const self& b) { + return a._arc == b._arc; } + friend bool operator!=(const self& a, const self& b) { + return a._arc != b._arc; } +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template friend class sgb_edge_length_map; + template friend class sgb_edge_util_map; + friend long get(edge_length_t, const sgb_graph_ptr&, const sgb_edge& key); + friend long get(edge_length_t, const sgb_const_graph_ptr&, const sgb_edge& key); + friend void put(edge_length_t, sgb_graph_ptr&, const sgb_edge& key, long value); + protected: +#endif + Arc* _arc; + Vertex* _src; + }; +} // namespace boost + + class sgb_out_edge_iterator + : public boost::forward_iterator_helper< + sgb_out_edge_iterator, boost::sgb_edge, + std::ptrdiff_t, boost::sgb_edge*, boost::sgb_edge> + { + typedef sgb_out_edge_iterator self; + public: + sgb_out_edge_iterator() : _src(0), _arc(0) {} + sgb_out_edge_iterator(Vertex* s, Arc* d) : _src(s), _arc(d) {} + boost::sgb_edge operator*() { return boost::sgb_edge(_arc, _src); } + self& operator++() { _arc = _arc->next; return *this; } + friend bool operator==(const self& x, const self& y) { + return x._arc == y._arc; } + protected: + Vertex* _src; + Arc* _arc; + }; + + class sgb_adj_iterator + : public boost::forward_iterator_helper< + sgb_adj_iterator, Vertex*, std::ptrdiff_t, Vertex**,Vertex*> + { + typedef sgb_adj_iterator self; + public: + sgb_adj_iterator() : _arc(0) {} + sgb_adj_iterator(Arc* d) : _arc(d) {} + Vertex* operator*() { return _arc->tip; } + self& operator++() { _arc = _arc->next; return *this; } + friend bool operator==(const self& x, const self& y) { + return x._arc == y._arc; } + protected: + Arc* _arc; + }; + + // The reason we have this instead of just using Vertex* is that we + // want to use Vertex* as the vertex_descriptor instead of just + // Vertex, which avoids problems with boost passing vertex descriptors + // by value and how that interacts with the sgb_vertex_id_map. + class sgb_vertex_iterator + : public boost::forward_iterator_helper< + sgb_vertex_iterator, Vertex*, std::ptrdiff_t, Vertex**, Vertex*> + { + typedef sgb_vertex_iterator self; + public: + sgb_vertex_iterator() : _v(0) { } + sgb_vertex_iterator(Vertex* v) : _v(v) { } + Vertex* operator*() { return _v; } + self& operator++() { ++_v; return *this; } + friend bool operator==(const self& x, const self& y) { + return x._v == y._v; } + protected: + Vertex* _v; + }; + +namespace boost { + + inline std::pair + vertices(sgb_const_graph_ptr g) + { + return std::make_pair(sgb_vertex_iterator(g->vertices), + sgb_vertex_iterator(g->vertices + g->n)); + } + + inline std::pair + out_edges(Vertex* u, sgb_const_graph_ptr) + { + return std::make_pair( sgb_out_edge_iterator(u, u->arcs), + sgb_out_edge_iterator(u, 0) ); + } + + inline boost::graph_traits::degree_size_type + out_degree(Vertex* u, sgb_const_graph_ptr g) + { + boost::graph_traits::out_edge_iterator i, i_end; + boost::tie(i, i_end) = out_edges(u, g); + return std::distance(i, i_end); + } + + // in_edges? + + inline std::pair + adjacent_vertices(Vertex* u, sgb_const_graph_ptr) + { + return std::make_pair( sgb_adj_iterator(u->arcs), + sgb_adj_iterator(0) ); + } + + inline long num_vertices(sgb_const_graph_ptr g) { return g->n; } + inline long num_edges(sgb_const_graph_ptr g) { return g->m; } + + inline Vertex* vertex(long v, sgb_const_graph_ptr g) + { return g->vertices + v; } + + // Various Property Maps + + // Vertex ID + class sgb_vertex_id_map + : public boost::put_get_helper + { + public: + typedef boost::readable_property_map_tag category; + typedef long value_type; + typedef long reference; + typedef Vertex* key_type; + sgb_vertex_id_map() : _g(0) { } + sgb_vertex_id_map(sgb_graph_ptr g) : _g(g) { } + long operator[](Vertex* v) const { return v - _g->vertices; } + protected: + sgb_graph_ptr _g; + }; + inline sgb_vertex_id_map get(vertex_index_t, sgb_graph_ptr g) { + return sgb_vertex_id_map(g); + } + + // Vertex Name + class sgb_vertex_name_map + : public boost::put_get_helper + { + public: + typedef boost::readable_property_map_tag category; + typedef char* value_type; + typedef char* reference; + typedef Vertex* key_type; + char* operator[](Vertex* v) const { return v->name; } + }; + inline sgb_vertex_name_map get(vertex_name_t, sgb_graph_ptr) { + return sgb_vertex_name_map(); + } + + // Vertex Property Tags +#define SGB_PROPERTY_TAG(KIND,TAG) \ + template struct TAG##_property { \ + typedef KIND##_property_tag kind; \ + typedef T type; \ + }; + SGB_PROPERTY_TAG(vertex, u) + SGB_PROPERTY_TAG(vertex, v) + SGB_PROPERTY_TAG(vertex, w) + SGB_PROPERTY_TAG(vertex, x) + SGB_PROPERTY_TAG(vertex, y) + SGB_PROPERTY_TAG(vertex, z) + + // Edge Property Tags + SGB_PROPERTY_TAG(edge, a) + SGB_PROPERTY_TAG(edge, b) + + // Various Utility Maps + + // helpers + inline Vertex*& get_util(util& u, Vertex*) { return u.V; } + inline Arc*& get_util(util& u, Arc*) { return u.A; } + inline sgb_graph_ptr& get_util(util& u, sgb_graph_ptr) { return u.G; } + inline char*& get_util(util& u, char*) { return u.S; } + inline long& get_util(util& u, long) { return u.I; } + +#define SGB_GET_UTIL_FIELD(KIND,X) \ + template \ + inline T& get_util_field(KIND* k, X##_property) { \ + return get_util(k->X, T()); } + + SGB_GET_UTIL_FIELD(Vertex, u) + SGB_GET_UTIL_FIELD(Vertex, v) + SGB_GET_UTIL_FIELD(Vertex, w) + SGB_GET_UTIL_FIELD(Vertex, x) + SGB_GET_UTIL_FIELD(Vertex, y) + SGB_GET_UTIL_FIELD(Vertex, z) + + SGB_GET_UTIL_FIELD(Arc, a) + SGB_GET_UTIL_FIELD(Arc, b) + + // Vertex Utility Map + template + class sgb_vertex_util_map + : public boost::put_get_helper > + { + public: + typedef boost::lvalue_property_map_tag category; + typedef typename Tag::type value_type; + typedef Vertex* key_type; + typedef Ref reference; + reference operator[](Vertex* v) const { + return get_util_field(v, Tag()); + } + }; + + // Edge Utility Map + template + class sgb_edge_util_map + : public boost::put_get_helper > + { + public: + typedef boost::lvalue_property_map_tag category; + typedef typename Tag::type value_type; + typedef Vertex* key_type; + typedef Ref reference; + reference operator[](const sgb_edge& e) const { + return get_util_field(e._arc, Tag()); + } + }; + +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + template + inline sgb_vertex_util_map + get_property_map(Tag, const sgb_graph_ptr& g, vertex_property_tag) { + return sgb_vertex_util_map(); + } + template + inline sgb_vertex_util_map + get_property_map(Tag, sgb_graph_ptr& g, vertex_property_tag) { + return sgb_vertex_util_map(); + } + + template + inline sgb_edge_util_map + get_property_map(Tag, const sgb_graph_ptr& g, edge_property_tag) { + return sgb_edge_util_map(); + } + template + inline sgb_edge_util_map + get_property_map(Tag, sgb_graph_ptr& g, edge_property_tag) { + return sgb_edge_util_map(); + } + +#endif // ! BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // Edge Length Access + template + class sgb_edge_length_map + : public boost::put_get_helper > + { + public: + typedef boost::lvalue_property_map_tag category; + typedef long value_type; + typedef sgb_edge key_type; + typedef Ref reference; + reference operator[](const sgb_edge& e) const { + return e._arc->len; + } + }; + + inline sgb_edge_length_map + get(edge_length_t, const sgb_graph_ptr&) { + return sgb_edge_length_map(); + } + inline sgb_edge_length_map + get(edge_length_t, const sgb_const_graph_ptr&) { + return sgb_edge_length_map(); + } + inline sgb_edge_length_map + get(edge_length_t, sgb_graph_ptr&) { + return sgb_edge_length_map(); + } + inline long + get(edge_length_t, const sgb_graph_ptr&, const sgb_edge& key) { + return key._arc->len; + } + inline long + get(edge_length_t, const sgb_const_graph_ptr&, const sgb_edge& key) { + return key._arc->len; + } + inline void + put(edge_length_t, sgb_graph_ptr&, const sgb_edge& key, long value) + { + key._arc->len = value; + } + + // Property Map Traits Classes + template <> + struct property_map { + typedef sgb_edge_length_map type; + typedef sgb_edge_length_map const_type; + }; + template <> + struct property_map { + typedef sgb_vertex_id_map type; + typedef sgb_vertex_id_map const_type; + }; + template <> + struct property_map { + typedef sgb_vertex_name_map type; + typedef sgb_vertex_name_map const_type; + }; + + template <> + struct property_map { + typedef sgb_edge_length_map const_type; + }; + template <> + struct property_map { + typedef sgb_vertex_id_map const_type; + }; + template <> + struct property_map { + typedef sgb_vertex_name_map const_type; + }; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + + namespace detail { + template + struct sgb_choose_property_map { }; + template + struct sgb_choose_property_map { + typedef typename PropertyTag::type value_type; + typedef sgb_vertex_util_map type; + typedef sgb_vertex_util_map const_type; + }; + template + struct sgb_choose_property_map { + typedef typename PropertyTag::type value_type; + typedef sgb_edge_util_map type; + typedef sgb_edge_util_map const_type; + }; + } // namespace detail + template + struct property_map { + typedef typename property_kind::type Kind; + typedef detail::sgb_choose_property_map Choice; + typedef typename Choice::type type; + typedef typename Choice::const_type const_type; + }; + template + struct property_map { + typedef typename property_kind::type Kind; + typedef detail::sgb_choose_property_map Choice; + typedef typename Choice::const_type const_type; + }; + +#define SGB_UTIL_ACCESSOR(KIND,X) \ + template \ + inline sgb_##KIND##_util_map< X##_property, T&> \ + get(X##_property, sgb_graph_ptr&) { \ + return sgb_##KIND##_util_map< X##_property, T&>(); \ + } \ + template \ + inline sgb_##KIND##_util_map< X##_property, const T&> \ + get(X##_property, const sgb_graph_ptr&) { \ + return sgb_##KIND##_util_map< X##_property, const T&>(); \ + } \ + template \ + inline sgb_##KIND##_util_map< X##_property, const T&> \ + get(X##_property, const sgb_const_graph_ptr&) { \ + return sgb_##KIND##_util_map< X##_property, const T&>(); \ + } \ + template \ + inline typename \ + sgb_##KIND##_util_map< X##_property, const T&>::value_type \ + get(X##_property, const sgb_graph_ptr&, const Key& key) { \ + return sgb_##KIND##_util_map< X##_property, const T&>()[key]; \ + } \ + template \ + inline typename \ + sgb_##KIND##_util_map< X##_property, const T&>::value_type \ + get(X##_property, const sgb_const_graph_ptr&, const Key& key) { \ + return sgb_##KIND##_util_map< X##_property, const T&>()[key]; \ + } \ + template \ + inline void \ + put(X##_property, sgb_graph_ptr&, const Key& key, const Value& value) { \ + sgb_##KIND##_util_map< X##_property, T&>()[key] = value; \ + } + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#define SGB_UTIL_ACCESSOR_TYPE(KIND,TAG,TYPE) \ + inline sgb_##KIND##_util_map< TAG, TYPE& > \ + get(TAG, sgb_graph_ptr&) { \ + return sgb_##KIND##_util_map< TAG, TYPE& >(); \ + } \ + inline sgb_##KIND##_util_map< TAG, const TYPE& > \ + get(TAG, const sgb_graph_ptr&) { \ + return sgb_##KIND##_util_map< TAG, const TYPE& >(); \ + } \ + inline sgb_##KIND##_util_map< TAG, const TYPE& > \ + get(TAG, const sgb_const_graph_ptr&) { \ + return sgb_##KIND##_util_map< TAG, const TYPE& >(); \ + } \ + template \ + inline typename sgb_##KIND##_util_map< TAG, const TYPE& >::value_type \ + get(TAG, const sgb_graph_ptr&, const Key& key) { \ + return sgb_##KIND##_util_map< TAG, const TYPE& >()[key]; \ + } \ + template \ + inline typename sgb_##KIND##_util_map< TAG, const TYPE& >::value_type \ + get(TAG, const sgb_const_graph_ptr&, const Key& key) { \ + return sgb_##KIND##_util_map< TAG, const TYPE& >()[key]; \ + } \ + template \ + inline void \ + put(TAG, sgb_graph_ptr&, const Key& key, const Value& value) { \ + sgb_##KIND##_util_map< TAG, TYPE& >()[key] = value; \ + } \ + template <> struct property_map > { \ + typedef sgb_##KIND##_util_map< TAG, TYPE&> type; \ + typedef sgb_##KIND##_util_map< TAG, const TYPE&> const_type; \ + } + +#define SGB_UTIL_ACCESSOR(KIND,TAG) \ + SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, Vertex*); \ + SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, Arc*); \ + SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, sgb_graph_ptr); \ + SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, long); \ + SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, char*); + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + SGB_UTIL_ACCESSOR(vertex, u) + SGB_UTIL_ACCESSOR(vertex, v) + SGB_UTIL_ACCESSOR(vertex, w) + SGB_UTIL_ACCESSOR(vertex, x) + SGB_UTIL_ACCESSOR(vertex, y) + SGB_UTIL_ACCESSOR(vertex, z) + + SGB_UTIL_ACCESSOR(edge, a) + SGB_UTIL_ACCESSOR(edge, b) + +} // namespace boost + +#endif // BOOST_GRAPH_SGB_GRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/strong_components.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/strong_components.hpp new file mode 100644 index 0000000000..0ed0b4a19b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/strong_components.hpp @@ -0,0 +1,334 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_STRONG_COMPONENTS_HPP +#define BOOST_GRAPH_STRONG_COMPONENTS_HPP + +#include +#include +#include +#include +#include + +namespace boost { + + //========================================================================== + // This is Tarjan's algorithm for strongly connected components + // from his paper "Depth first search and linear graph algorithms". + // It calculates the components in a single application of DFS. + // We implement the algorithm as a dfs-visitor. + + namespace detail { + + template + class tarjan_scc_visitor : public dfs_visitor<> + { + typedef typename property_traits::value_type comp_type; + typedef typename property_traits::value_type time_type; + public: + tarjan_scc_visitor(ComponentMap comp_map, RootMap r, DiscoverTime d, + comp_type& c_, Stack& s_) + : c(c_), comp(comp_map), root(r), discover_time(d), + dfs_time(time_type()), s(s_) { } + + template + void discover_vertex(typename graph_traits::vertex_descriptor v, + const Graph&) { + put(root, v, v); + put(comp, v, (std::numeric_limits::max)()); + put(discover_time, v, dfs_time++); + s.push(v); + } + template + void finish_vertex(typename graph_traits::vertex_descriptor v, + const Graph& g) { + typename graph_traits::vertex_descriptor w; + typename graph_traits::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(v, g); ei != ei_end; ++ei) { + w = target(*ei, g); + if (get(comp, w) == (std::numeric_limits::max)()) + put(root, v, this->min_discover_time(get(root,v), get(root,w))); + } + if (get(root, v) == v) { + do { + w = s.top(); s.pop(); + put(comp, w, c); + } while (w != v); + ++c; + } + } + private: + template + Vertex min_discover_time(Vertex u, Vertex v) { + return get(discover_time, u) < get(discover_time,v) ? u : v; + } + + comp_type& c; + ComponentMap comp; + RootMap root; + DiscoverTime discover_time; + time_type dfs_time; + Stack& s; + }; + + template + typename property_traits::value_type + strong_components_impl + (const Graph& g, // Input + ComponentMap comp, // Output + // Internal record keeping + RootMap root, + DiscoverTime discover_time, + const bgl_named_params& params) + { + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadWritePropertyMapConcept >(); + function_requires< ReadWritePropertyMapConcept >(); + typedef typename property_traits::value_type RootV; + function_requires< ConvertibleConcept >(); + function_requires< ReadWritePropertyMapConcept >(); + + typename property_traits::value_type total = 0; + + std::stack s; + detail::tarjan_scc_visitor > + vis(comp, root, discover_time, total, s); + depth_first_search(g, params.visitor(vis)); + return total; + } + + //------------------------------------------------------------------------- + // The dispatch functions handle the defaults for the rank and discover + // time property maps. + // dispatch with class specialization to avoid VC++ bug + + template + struct strong_comp_dispatch2 { + template + inline static typename property_traits::value_type + apply(const Graph& g, + ComponentMap comp, + RootMap r_map, + const bgl_named_params& params, + DiscoverTimeMap time_map) + { + return strong_components_impl(g, comp, r_map, time_map, params); + } + }; + + + template <> + struct strong_comp_dispatch2 { + template + inline static typename property_traits::value_type + apply(const Graph& g, + ComponentMap comp, + RootMap r_map, + const bgl_named_params& params, + detail::error_property_not_found) + { + typedef typename graph_traits::vertices_size_type size_type; + size_type n = num_vertices(g) > 0 ? num_vertices(g) : 1; + std::vector time_vec(n); + return strong_components_impl + (g, comp, r_map, + make_iterator_property_map(time_vec.begin(), choose_const_pmap + (get_param(params, vertex_index), + g, vertex_index), time_vec[0]), + params); + } + }; + + template + inline typename property_traits::value_type + scc_helper2(const Graph& g, + ComponentMap comp, + RootMap r_map, + const bgl_named_params& params, + DiscoverTimeMap time_map) + { + return strong_comp_dispatch2::apply(g, comp, r_map, params, time_map); + } + + template + struct strong_comp_dispatch1 { + + template + inline static typename property_traits::value_type + apply(const Graph& g, + ComponentMap comp, + const bgl_named_params& params, + RootMap r_map) + { + return scc_helper2(g, comp, r_map, params, get_param(params, vertex_discover_time)); + } + }; + template <> + struct strong_comp_dispatch1 { + + template + inline static typename property_traits::value_type + apply(const Graph& g, + ComponentMap comp, + const bgl_named_params& params, + detail::error_property_not_found) + { + typedef typename graph_traits::vertex_descriptor Vertex; + typename std::vector::size_type + n = num_vertices(g) > 0 ? num_vertices(g) : 1; + std::vector root_vec(n); + return scc_helper2 + (g, comp, + make_iterator_property_map(root_vec.begin(), choose_const_pmap + (get_param(params, vertex_index), + g, vertex_index), root_vec[0]), + params, + get_param(params, vertex_discover_time)); + } + }; + + template + inline typename property_traits::value_type + scc_helper1(const Graph& g, + ComponentMap comp, + const bgl_named_params& params, + RootMap r_map) + { + return detail::strong_comp_dispatch1::apply(g, comp, params, + r_map); + } + + } // namespace detail + + template + inline typename property_traits::value_type + strong_components(const Graph& g, ComponentMap comp, + const bgl_named_params& params) + { + typedef typename graph_traits::directed_category DirCat; + BOOST_STATIC_ASSERT((is_convertible::value == true)); + return detail::scc_helper1(g, comp, params, + get_param(params, vertex_root_t())); + } + + template + inline typename property_traits::value_type + strong_components(const Graph& g, ComponentMap comp) + { + typedef typename graph_traits::directed_category DirCat; + BOOST_STATIC_ASSERT((is_convertible::value == true)); + bgl_named_params params(0); + return strong_components(g, comp, params); + } + + template + void build_component_lists + (const Graph& g, + typename graph_traits::vertices_size_type num_scc, + ComponentMap component_number, + ComponentLists& components) + { + components.resize(num_scc); + typename graph_traits::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + components[component_number[*vi]].push_back(*vi); + } + + +} // namespace boost + +#include +#include +#include +#include +#include // for components_recorder + +namespace boost { + + //========================================================================== + // This is the version of strongly connected components from + // "Intro. to Algorithms" by Cormen, Leiserson, Rivest, which was + // adapted from "Data Structure and Algorithms" by Aho, Hopcroft, + // and Ullman, who credit the algorithm to S.R. Kosaraju and M. Sharir. + // The algorithm is based on computing DFS forests the graph + // and its transpose. + + // This algorithm is slower than Tarjan's by a constant factor, uses + // more memory, and puts more requirements on the graph type. + + template + typename property_traits::value_type + kosaraju_strong_components(Graph& G, ComponentsMap c, + FinishTime finish_time, ColorMap color) + { + function_requires< MutableGraphConcept >(); + // ... + + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + typename property_traits::value_type time = 0; + depth_first_search + (G, make_dfs_visitor(stamp_times(finish_time, time, on_finish_vertex())), + color); + + Graph G_T(num_vertices(G)); + transpose_graph(G, G_T); + + typedef typename property_traits::value_type count_type; + + count_type c_count(0); + detail::components_recorder + vis(c, c_count); + + // initialize G_T + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(G_T); ui != ui_end; ++ui) + put(color, *ui, Color::white()); + + typedef typename property_traits::value_type D; + typedef indirect_cmp< FinishTime, std::less > Compare; + + Compare fl(finish_time); + std::priority_queue, Compare > Q(fl); + + typename graph_traits::vertex_iterator i, j, iend, jend; + tie(i, iend) = vertices(G_T); + tie(j, jend) = vertices(G); + for ( ; i != iend; ++i, ++j) { + put(finish_time, *i, get(finish_time, *j)); + Q.push(*i); + } + + while ( !Q.empty() ) { + Vertex u = Q.top(); + Q.pop(); + if (get(color, u) == Color::white()) { + depth_first_visit(G_T, u, vis, color); + ++c_count; + } + } + return c_count; + } + +} // namespace boost + +#endif // BOOST_GRAPH_STRONG_COMPONENTS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/subgraph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/subgraph.hpp new file mode 100644 index 0000000000..91d2e05fcf --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/subgraph.hpp @@ -0,0 +1,872 @@ +//======================================================================= +// Copyright 2001 University of Notre Dame. +// Authors: Jeremy G. Siek and Lie-Quan Lee +// +// 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_SUBGRAPH_HPP +#define BOOST_SUBGRAPH_HPP + +// UNDER CONSTRUCTION + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace boost { + + struct subgraph_tag { }; + + // Invariants of an induced subgraph: + // - If vertex u is in subgraph g, then u must be in g.parent(). + // - If edge e is in subgraph g, then e must be in g.parent(). + // - If edge e=(u,v) is in the root graph, then edge e + // is also in any subgraph that contains both vertex u and v. + + // The Graph template parameter must have a vertex_index + // and edge_index internal property. It is assumed that + // the vertex indices are assigned automatically by the + // graph during a call to add_vertex(). It is not + // assumed that the edge vertices are assigned automatically, + // they are explicitly assigned here. + + template + class subgraph { + typedef graph_traits Traits; + typedef std::list*> ChildrenList; + public: + // Graph requirements + typedef typename Traits::vertex_descriptor vertex_descriptor; + typedef typename Traits::edge_descriptor edge_descriptor; + typedef typename Traits::directed_category directed_category; + typedef typename Traits::edge_parallel_category edge_parallel_category; + typedef typename Traits::traversal_category traversal_category; + + static vertex_descriptor null_vertex() + { + return Traits::null_vertex(); + } + + + // IncidenceGraph requirements + typedef typename Traits::out_edge_iterator out_edge_iterator; + typedef typename Traits::degree_size_type degree_size_type; + + // AdjacencyGraph requirements + typedef typename Traits::adjacency_iterator adjacency_iterator; + + // VertexListGraph requirements + typedef typename Traits::vertex_iterator vertex_iterator; + typedef typename Traits::vertices_size_type vertices_size_type; + + // EdgeListGraph requirements + typedef typename Traits::edge_iterator edge_iterator; + typedef typename Traits::edges_size_type edges_size_type; + + typedef typename Traits::in_edge_iterator in_edge_iterator; + + typedef typename Graph::edge_property_type edge_property_type; + typedef typename Graph::vertex_property_type vertex_property_type; + typedef subgraph_tag graph_tag; + typedef Graph graph_type; + typedef typename Graph::graph_property_type graph_property_type; + + // Constructors + + // Create the main graph, the root of the subgraph tree + subgraph() + : m_parent(0), m_edge_counter(0) + { } + subgraph(const graph_property_type& p) + : m_graph(p), m_parent(0), m_edge_counter(0) + { } + subgraph(vertices_size_type n, + const graph_property_type& p = graph_property_type()) + : m_graph(n, p), m_parent(0), m_edge_counter(0), m_global_vertex(n) + { + typename Graph::vertex_iterator v, v_end; + vertices_size_type i = 0; + for (tie(v, v_end) = vertices(m_graph); v != v_end; ++v) + m_global_vertex[i++] = *v; + } + + // copy constructor + subgraph(const subgraph& x) + : m_graph(x.m_graph), m_parent(x.m_parent), + m_edge_counter(x.m_edge_counter), + m_global_vertex(x.m_global_vertex), + m_global_edge(x.m_global_edge) + { + // Do a deep copy + for (typename ChildrenList::const_iterator i = x.m_children.begin(); + i != x.m_children.end(); ++i) + m_children.push_back(new subgraph( **i )); + } + + + ~subgraph() { + for (typename ChildrenList::iterator i = m_children.begin(); + i != m_children.end(); ++i) + delete *i; + } + + + // Create a subgraph + subgraph& create_subgraph() { + m_children.push_back(new subgraph()); + m_children.back()->m_parent = this; + return *m_children.back(); + } + + // Create a subgraph with the specified vertex set. + template + subgraph& create_subgraph(VertexIterator first, + VertexIterator last) + { + m_children.push_back(new subgraph()); + m_children.back()->m_parent = this; + for (; first != last; ++first) + add_vertex(*first, *m_children.back()); + return *m_children.back(); + } + + // local <-> global descriptor conversion functions + vertex_descriptor local_to_global(vertex_descriptor u_local) const + { + return m_global_vertex[u_local]; + } + vertex_descriptor global_to_local(vertex_descriptor u_global) const + { + vertex_descriptor u_local; bool in_subgraph; + tie(u_local, in_subgraph) = this->find_vertex(u_global); + assert(in_subgraph == true); + return u_local; + } + edge_descriptor local_to_global(edge_descriptor e_local) const + { + return m_global_edge[get(get(edge_index, m_graph), e_local)]; + } + edge_descriptor global_to_local(edge_descriptor e_global) const + { + return + (*m_local_edge.find(get(get(edge_index, root().m_graph), e_global))).second; + } + + // Is vertex u (of the root graph) contained in this subgraph? + // If so, return the matching local vertex. + std::pair + find_vertex(vertex_descriptor u_global) const + { + typename std::map::const_iterator + i = m_local_vertex.find(u_global); + bool valid = i != m_local_vertex.end(); + return std::make_pair((valid ? (*i).second : null_vertex()), valid); + } + + // Return the parent graph. + subgraph& parent() { return *m_parent; } + const subgraph& parent() const { return *m_parent; } + + bool is_root() const { return m_parent == 0; } + + // Return the root graph of the subgraph tree. + subgraph& root() { + if (this->is_root()) + return *this; + else + return m_parent->root(); + } + const subgraph& root() const { + if (this->is_root()) + return *this; + else + return m_parent->root(); + } + + // Return the children subgraphs of this graph/subgraph. + // Use a list of pointers because the VC++ std::list doesn't like + // storing incomplete type. + typedef indirect_iterator< + typename ChildrenList::const_iterator + , subgraph + , std::bidirectional_iterator_tag + > + children_iterator; + + typedef indirect_iterator< + typename ChildrenList::const_iterator + , subgraph const + , std::bidirectional_iterator_tag + > + const_children_iterator; + + std::pair + children() const + { + return std::make_pair(const_children_iterator(m_children.begin()), + const_children_iterator(m_children.end())); + } + + std::pair + children() + { + return std::make_pair(children_iterator(m_children.begin()), + children_iterator(m_children.end())); + } + + std::size_t num_children() const { return m_children.size(); } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + // Bundled properties support + template + typename graph::detail::bundled_result::type& + operator[](Descriptor x) + { + if (m_parent == 0) return m_graph[x]; + else return root().m_graph[local_to_global(x)]; + } + + template + typename graph::detail::bundled_result::type const& + operator[](Descriptor x) const + { + if (m_parent == 0) return m_graph[x]; + else return root().m_graph[local_to_global(x)]; + } +#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + + // private: + typedef typename property_map::type EdgeIndexMap; + typedef typename property_traits::value_type edge_index_type; + BOOST_STATIC_ASSERT((!is_same::value)); + + Graph m_graph; + subgraph* m_parent; + edge_index_type m_edge_counter; // for generating unique edge indices + ChildrenList m_children; + std::vector m_global_vertex; // local -> global + std::map m_local_vertex; // global -> local + std::vector m_global_edge; // local -> global + std::map m_local_edge; // global -> local + + edge_descriptor + local_add_edge(vertex_descriptor u_local, vertex_descriptor v_local, + edge_descriptor e_global) + { + edge_descriptor e_local; + bool inserted; + tie(e_local, inserted) = add_edge(u_local, v_local, m_graph); + put(edge_index, m_graph, e_local, m_edge_counter++); + m_global_edge.push_back(e_global); + m_local_edge[get(get(edge_index, this->root()), e_global)] = e_local; + return e_local; + } + + }; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + template + struct vertex_bundle_type > : vertex_bundle_type { }; + + template + struct edge_bundle_type > : edge_bundle_type { }; +#endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + + //=========================================================================== + // Functions special to the Subgraph Class + + template + typename subgraph::vertex_descriptor + add_vertex(typename subgraph::vertex_descriptor u_global, + subgraph& g) + { + assert(!g.is_root()); + typename subgraph::vertex_descriptor u_local, v_global, uu_global; + typename subgraph::edge_descriptor e_global; + + u_local = add_vertex(g.m_graph); + g.m_global_vertex.push_back(u_global); + g.m_local_vertex[u_global] = u_local; + + subgraph& r = g.root(); + + // remember edge global and local maps + { + typename subgraph::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(u_global, r); + ei != ei_end; ++ei) { + e_global = *ei; + v_global = target(e_global, r); + if (g.find_vertex(v_global).second == true) + g.local_add_edge(u_local, g.global_to_local(v_global), e_global); + } + } + if (is_directed(g)) { // not necessary for undirected graph + typename subgraph::vertex_iterator vi, vi_end; + typename subgraph::out_edge_iterator ei, ei_end; + for (tie(vi, vi_end) = vertices(r); vi != vi_end; ++vi) { + v_global = *vi; + if (g.find_vertex(v_global).second) + for (tie(ei, ei_end) = out_edges(*vi, r); ei != ei_end; ++ei) { + e_global = *ei; + uu_global = target(e_global, r); + if (uu_global == u_global && g.find_vertex(v_global).second) + g.local_add_edge(g.global_to_local(v_global), u_local, e_global); + } + } + } + + return u_local; + } + + //=========================================================================== + // Functions required by the IncidenceGraph concept + + template + std::pair::out_edge_iterator, + typename graph_traits::out_edge_iterator> + out_edges(typename graph_traits::vertex_descriptor u_local, + const subgraph& g) + { return out_edges(u_local, g.m_graph); } + + template + typename graph_traits::degree_size_type + out_degree(typename graph_traits::vertex_descriptor u_local, + const subgraph& g) + { return out_degree(u_local, g.m_graph); } + + template + typename graph_traits::vertex_descriptor + source(typename graph_traits::edge_descriptor e_local, + const subgraph& g) + { return source(e_local, g.m_graph); } + + template + typename graph_traits::vertex_descriptor + target(typename graph_traits::edge_descriptor e_local, + const subgraph& g) + { return target(e_local, g.m_graph); } + + //=========================================================================== + // Functions required by the BidirectionalGraph concept + + template + std::pair::in_edge_iterator, + typename graph_traits::in_edge_iterator> + in_edges(typename graph_traits::vertex_descriptor u_local, + const subgraph& g) + { return in_edges(u_local, g.m_graph); } + + template + typename graph_traits::degree_size_type + in_degree(typename graph_traits::vertex_descriptor u_local, + const subgraph& g) + { return in_degree(u_local, g.m_graph); } + + template + typename graph_traits::degree_size_type + degree(typename graph_traits::vertex_descriptor u_local, + const subgraph& g) + { return degree(u_local, g.m_graph); } + + //=========================================================================== + // Functions required by the AdjacencyGraph concept + + template + std::pair::adjacency_iterator, + typename subgraph::adjacency_iterator> + adjacent_vertices(typename subgraph::vertex_descriptor u_local, + const subgraph& g) + { return adjacent_vertices(u_local, g.m_graph); } + + //=========================================================================== + // Functions required by the VertexListGraph concept + + template + std::pair::vertex_iterator, + typename subgraph::vertex_iterator> + vertices(const subgraph& g) + { return vertices(g.m_graph); } + + template + typename subgraph::vertices_size_type + num_vertices(const subgraph& g) + { return num_vertices(g.m_graph); } + + //=========================================================================== + // Functions required by the EdgeListGraph concept + + template + std::pair::edge_iterator, + typename subgraph::edge_iterator> + edges(const subgraph& g) + { return edges(g.m_graph); } + + template + typename subgraph::edges_size_type + num_edges(const subgraph& g) + { return num_edges(g.m_graph); } + + //=========================================================================== + // Functions required by the AdjacencyMatrix concept + + template + std::pair::edge_descriptor, bool> + edge(typename subgraph::vertex_descriptor u_local, + typename subgraph::vertex_descriptor v_local, + const subgraph& g) + { + return edge(u_local, v_local, g.m_graph); + } + + //=========================================================================== + // Functions required by the MutableGraph concept + + namespace detail { + + template + void add_edge_recur_down + (Vertex u_global, Vertex v_global, Edge e_global, subgraph& g); + + template + void children_add_edge(Vertex u_global, Vertex v_global, Edge e_global, + Children& c, subgraph* orig) + { + for (typename Children::iterator i = c.begin(); i != c.end(); ++i) + if ((*i)->find_vertex(u_global).second + && (*i)->find_vertex(v_global).second) + add_edge_recur_down(u_global, v_global, e_global, **i, orig); + } + + template + void add_edge_recur_down + (Vertex u_global, Vertex v_global, Edge e_global, subgraph& g, + subgraph* orig) + { + if (&g != orig ) { + // add local edge only if u_global and v_global are in subgraph g + Vertex u_local, v_local; + bool u_in_subgraph, v_in_subgraph; + tie(u_local, u_in_subgraph) = g.find_vertex(u_global); + tie(v_local, v_in_subgraph) = g.find_vertex(v_global); + if (u_in_subgraph && v_in_subgraph) + g.local_add_edge(u_local, v_local, e_global); + } + children_add_edge(u_global, v_global, e_global, g.m_children, orig); + } + + template + std::pair::edge_descriptor, bool> + add_edge_recur_up(Vertex u_global, Vertex v_global, + const typename Graph::edge_property_type& ep, + subgraph& g, subgraph* orig) + { + if (g.is_root()) { + typename subgraph::edge_descriptor e_global; + bool inserted; + tie(e_global, inserted) = add_edge(u_global, v_global, ep, g.m_graph); + put(edge_index, g.m_graph, e_global, g.m_edge_counter++); + g.m_global_edge.push_back(e_global); + children_add_edge(u_global, v_global, e_global, g.m_children, orig); + return std::make_pair(e_global, inserted); + } else + return add_edge_recur_up(u_global, v_global, ep, *g.m_parent, orig); + } + + } // namespace detail + + // Add an edge to the subgraph g, specified by the local vertex + // descriptors u and v. In addition, the edge will be added to any + // other subgraphs which contain vertex descriptors u and v. + + template + std::pair::edge_descriptor, bool> + add_edge(typename subgraph::vertex_descriptor u_local, + typename subgraph::vertex_descriptor v_local, + const typename G::edge_property_type& ep, + subgraph& g) + { + if (g.is_root()) // u_local and v_local are really global + return detail::add_edge_recur_up(u_local, v_local, ep, g, &g); + else { + typename subgraph::edge_descriptor e_local, e_global; + bool inserted; + tie(e_global, inserted) = detail::add_edge_recur_up + (g.local_to_global(u_local), g.local_to_global(v_local), ep, g, &g); + e_local = g.local_add_edge(u_local, v_local, e_global); + return std::make_pair(e_local, inserted); + } + } + + template + std::pair::edge_descriptor, bool> + add_edge(typename subgraph::vertex_descriptor u, + typename subgraph::vertex_descriptor v, + subgraph& g) + { + typename G::edge_property_type ep; + return add_edge(u, v, ep, g); + } + + namespace detail { + + //------------------------------------------------------------------------- + // implementation of remove_edge(u,v,g) + + template + void remove_edge_recur_down(Vertex u_global, Vertex v_global, + subgraph& g); + + template + void children_remove_edge(Vertex u_global, Vertex v_global, + Children& c) + { + for (typename Children::iterator i = c.begin(); i != c.end(); ++i) + if ((*i)->find_vertex(u_global).second + && (*i)->find_vertex(v_global).second) + remove_edge_recur_down(u_global, v_global, **i); + } + + template + void remove_edge_recur_down(Vertex u_global, Vertex v_global, + subgraph& g) + { + Vertex u_local, v_local; + u_local = g.m_local_vertex[u_global]; + v_local = g.m_local_vertex[v_global]; + remove_edge(u_local, v_local, g.m_graph); + children_remove_edge(u_global, v_global, g.m_children); + } + + template + void remove_edge_recur_up(Vertex u_global, Vertex v_global, + subgraph& g) + { + if (g.is_root()) { + remove_edge(u_global, v_global, g.m_graph); + children_remove_edge(u_global, v_global, g.m_children); + } else + remove_edge_recur_up(u_global, v_global, *g.m_parent); + } + + //------------------------------------------------------------------------- + // implementation of remove_edge(e,g) + + template + void remove_edge_recur_down(Edge e_global, subgraph& g); + + template + void children_remove_edge(Edge e_global, Children& c) + { + for (typename Children::iterator i = c.begin(); i != c.end(); ++i) + if ((*i)->find_vertex(source(e_global, **i)).second + && (*i)->find_vertex(target(e_global, **i)).second) + remove_edge_recur_down(source(e_global, **i), + target(e_global, **i), **i); + } + + template + void remove_edge_recur_down(Edge e_global, subgraph& g) + { + remove_edge(g.global_to_local(e_global), g.m_graph); + children_remove_edge(e_global, g.m_children); + } + + template + void remove_edge_recur_up(Edge e_global, subgraph& g) + { + if (g.is_root()) { + remove_edge(e_global, g.m_graph); + children_remove_edge(e_global, g.m_children); + } else + remove_edge_recur_up(e_global, *g.m_parent); + } + + } // namespace detail + + template + void + remove_edge(typename subgraph::vertex_descriptor u_local, + typename subgraph::vertex_descriptor v_local, + subgraph& g) + { + if (g.is_root()) + detail::remove_edge_recur_up(u_local, v_local, g); + else + detail::remove_edge_recur_up(g.local_to_global(u_local), + g.local_to_global(v_local), g); + } + + template + void + remove_edge(typename subgraph::edge_descriptor e_local, + subgraph& g) + { + if (g.is_root()) + detail::remove_edge_recur_up(e_local, g); + else + detail::remove_edge_recur_up(g.local_to_global(e_local), g); + } + + template + void + remove_edge_if(Predicate p, subgraph& g) + { + // This is wrong... + remove_edge_if(p, g.m_graph); + } + + template + void + clear_vertex(typename subgraph::vertex_descriptor v_local, + subgraph& g) + { + // this is wrong... + clear_vertex(v_local, g.m_graph); + } + + namespace detail { + + template + typename subgraph::vertex_descriptor + add_vertex_recur_up(subgraph& g) + { + typename subgraph::vertex_descriptor u_local, u_global; + if (g.is_root()) { + u_global = add_vertex(g.m_graph); + g.m_global_vertex.push_back(u_global); + } else { + u_global = add_vertex_recur_up(*g.m_parent); + u_local = add_vertex(g.m_graph); + g.m_global_vertex.push_back(u_global); + g.m_local_vertex[u_global] = u_local; + } + return u_global; + } + + } // namespace detail + + template + typename subgraph::vertex_descriptor + add_vertex(subgraph& g) + { + typename subgraph::vertex_descriptor u_local, u_global; + if (g.is_root()) { + u_global = add_vertex(g.m_graph); + g.m_global_vertex.push_back(u_global); + u_local = u_global; + } else { + u_global = detail::add_vertex_recur_up(g.parent()); + u_local = add_vertex(g.m_graph); + g.m_global_vertex.push_back(u_global); + g.m_local_vertex[u_global] = u_local; + } + return u_local; + } + + template + void remove_vertex(typename subgraph::vertex_descriptor u, + subgraph& g) + { + // UNDER CONSTRUCTION + assert(false); + } + + + //=========================================================================== + // Functions required by the PropertyGraph concept + + template + class subgraph_global_property_map + : public put_get_helper< + typename property_traits::reference, + subgraph_global_property_map > + { + typedef property_traits Traits; + public: + typedef typename Traits::category category; + typedef typename Traits::value_type value_type; + typedef typename Traits::key_type key_type; + typedef typename Traits::reference reference; + + subgraph_global_property_map() { } + + subgraph_global_property_map(GraphPtr g) + : m_g(g) { } + + inline reference operator[](key_type e_local) const { + PropertyMap pmap = get(Tag(), m_g->root().m_graph); + if (m_g->m_parent == 0) + return pmap[e_local]; + else + return pmap[m_g->local_to_global(e_local)]; + } + GraphPtr m_g; + }; + + template + class subgraph_local_property_map + : public put_get_helper< + typename property_traits::reference, + subgraph_local_property_map > + { + typedef property_traits Traits; + public: + typedef typename Traits::category category; + typedef typename Traits::value_type value_type; + typedef typename Traits::key_type key_type; + typedef typename Traits::reference reference; + + subgraph_local_property_map() { } + + subgraph_local_property_map(GraphPtr g) + : m_g(g) { } + + inline reference operator[](key_type e_local) const { + PropertyMap pmap = get(Tag(), *m_g); + return pmap[e_local]; + } + GraphPtr m_g; + }; + + namespace detail { + + struct subgraph_any_pmap { + template + class bind_ { + typedef typename SubGraph::graph_type Graph; + typedef SubGraph* SubGraphPtr; + typedef const SubGraph* const_SubGraphPtr; + typedef typename property_map::type PMap; + typedef typename property_map::const_type const_PMap; + public: + typedef subgraph_global_property_map type; + typedef subgraph_global_property_map + const_type; + }; + }; + struct subgraph_id_pmap { + template + struct bind_ { + typedef typename SubGraph::graph_type Graph; + typedef SubGraph* SubGraphPtr; + typedef const SubGraph* const_SubGraphPtr; + typedef typename property_map::type PMap; + typedef typename property_map::const_type const_PMap; + public: + typedef subgraph_local_property_map type; + typedef subgraph_local_property_map + const_type; + }; + }; + template + struct subgraph_choose_pmap_helper { + typedef subgraph_any_pmap type; + }; + template <> + struct subgraph_choose_pmap_helper { + typedef subgraph_id_pmap type; + }; + template + struct subgraph_choose_pmap { + typedef typename subgraph_choose_pmap_helper::type Helper; + typedef typename Helper::template bind_ Bind; + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; + }; + struct subgraph_property_generator { + template + struct bind_ { + typedef subgraph_choose_pmap Choice; + typedef typename Choice::type type; + typedef typename Choice::const_type const_type; + }; + }; + + } // namespace detail + + template <> + struct vertex_property_selector { + typedef detail::subgraph_property_generator type; + }; + + template <> + struct edge_property_selector { + typedef detail::subgraph_property_generator type; + }; + + template + typename property_map< subgraph, Property>::type + get(Property, subgraph& g) + { + typedef typename property_map< subgraph, Property>::type PMap; + return PMap(&g); + } + + template + typename property_map< subgraph, Property>::const_type + get(Property, const subgraph& g) + { + typedef typename property_map< subgraph, Property>::const_type PMap; + return PMap(&g); + } + + template + typename property_traits< + typename property_map< subgraph, Property>::const_type + >::value_type + get(Property, const subgraph& g, const Key& k) + { + typedef typename property_map< subgraph, Property>::const_type PMap; + PMap pmap(&g); + return pmap[k]; + } + + template + void + put(Property, subgraph& g, const Key& k, const Value& val) + { + typedef typename property_map< subgraph, Property>::type PMap; + PMap pmap(&g); + pmap[k] = val; + } + + template + inline + typename graph_property::type& + get_property(subgraph& g, Tag tag) { + return get_property(g.m_graph, tag); + } + + template + inline + const typename graph_property::type& + get_property(const subgraph& g, Tag tag) { + return get_property(g.m_graph, tag); + } + + //=========================================================================== + // Miscellaneous Functions + + template + typename subgraph::vertex_descriptor + vertex(typename subgraph::vertices_size_type n, const subgraph& g) + { + return vertex(n, g.m_graph); + } + +} // namespace boost + +#endif // BOOST_SUBGRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/topological_sort.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/topological_sort.hpp new file mode 100644 index 0000000000..2ed7e18e92 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/topological_sort.hpp @@ -0,0 +1,76 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_TOPOLOGICAL_SORT_HPP +#define BOOST_GRAPH_TOPOLOGICAL_SORT_HPP + +#include +#include +#include +#include +#include + +namespace boost { + + + // Topological sort visitor + // + // This visitor merely writes the linear ordering into an + // OutputIterator. The OutputIterator could be something like an + // ostream_iterator, or it could be a back/front_insert_iterator. + // Note that if it is a back_insert_iterator, the recorded order is + // the reverse topological order. On the other hand, if it is a + // front_insert_iterator, the recorded order is the topological + // order. + // + template + struct topo_sort_visitor : public dfs_visitor<> + { + topo_sort_visitor(OutputIterator _iter) + : m_iter(_iter) { } + + template + void back_edge(const Edge& u, Graph&) { throw not_a_dag(); } + + template + void finish_vertex(const Vertex& u, Graph&) { *m_iter++ = u; } + + OutputIterator m_iter; + }; + + + // Topological Sort + // + // The topological sort algorithm creates a linear ordering + // of the vertices such that if edge (u,v) appears in the graph, + // then u comes before v in the ordering. The graph must + // be a directed acyclic graph (DAG). The implementation + // consists mainly of a call to depth-first search. + // + + template + void topological_sort(VertexListGraph& g, OutputIterator result, + const bgl_named_params& params) + { + typedef topo_sort_visitor TopoVisitor; + depth_first_search(g, params.visitor(TopoVisitor(result))); + } + + template + void topological_sort(VertexListGraph& g, OutputIterator result) + { + topological_sort(g, result, + bgl_named_params(0)); // bogus + } + +} // namespace boost + +#endif /*BOOST_GRAPH_TOPOLOGICAL_SORT_H*/ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/transitive_closure.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/transitive_closure.hpp new file mode 100644 index 0000000000..a4742ab155 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/transitive_closure.hpp @@ -0,0 +1,370 @@ +// Copyright (C) 2001 Vladimir Prus +// Copyright (C) 2001 Jeremy Siek +// 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) + +// NOTE: this final is generated by libs/graph/doc/transitive_closure.w + +#ifndef BOOST_GRAPH_TRANSITIVE_CLOSURE_HPP +#define BOOST_GRAPH_TRANSITIVE_CLOSURE_HPP + +#include +#include // for std::min and std::max +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + + namespace detail + { + inline void + union_successor_sets(const std::vector < std::size_t > &s1, + const std::vector < std::size_t > &s2, + std::vector < std::size_t > &s3) + { + BOOST_USING_STD_MIN(); + for (std::size_t k = 0; k < s1.size(); ++k) + s3[k] = min BOOST_PREVENT_MACRO_SUBSTITUTION(s1[k], s2[k]); + } + } // namespace detail + + namespace detail + { + template < typename Container, typename ST = std::size_t, + typename VT = typename Container::value_type > + struct subscript_t:public std::unary_function < ST, VT > + { + typedef VT& result_type; + + subscript_t(Container & c):container(&c) + { + } + VT & operator() (const ST & i) const + { + return (*container)[i]; + } + protected: + Container * container; + }; + template < typename Container > + subscript_t < Container > subscript(Container & c) { + return subscript_t < Container > (c); + } + } // namespace detail + + template < typename Graph, typename GraphTC, + typename G_to_TC_VertexMap, + typename VertexIndexMap > + void transitive_closure(const Graph & g, GraphTC & tc, + G_to_TC_VertexMap g_to_tc_map, + VertexIndexMap index_map) + { + if (num_vertices(g) == 0) + return; + typedef typename graph_traits < Graph >::vertex_descriptor vertex; + typedef typename graph_traits < Graph >::edge_descriptor edge; + typedef typename graph_traits < Graph >::vertex_iterator vertex_iterator; + typedef typename property_traits < VertexIndexMap >::value_type size_type; + typedef typename graph_traits < + Graph >::adjacency_iterator adjacency_iterator; + + function_requires < VertexListGraphConcept < Graph > >(); + function_requires < AdjacencyGraphConcept < Graph > >(); + function_requires < VertexMutableGraphConcept < GraphTC > >(); + function_requires < EdgeMutableGraphConcept < GraphTC > >(); + function_requires < ReadablePropertyMapConcept < VertexIndexMap, + vertex > >(); + + typedef size_type cg_vertex; + std::vector < cg_vertex > component_number_vec(num_vertices(g)); + iterator_property_map < cg_vertex *, VertexIndexMap, cg_vertex, cg_vertex& > + component_number(&component_number_vec[0], index_map); + + int num_scc = strong_components(g, component_number, + vertex_index_map(index_map)); + + std::vector < std::vector < vertex > >components; + build_component_lists(g, num_scc, component_number, components); + + typedef std::vector > CG_t; + CG_t CG(num_scc); + for (cg_vertex s = 0; s < components.size(); ++s) { + std::vector < cg_vertex > adj; + for (size_type i = 0; i < components[s].size(); ++i) { + vertex u = components[s][i]; + adjacency_iterator v, v_end; + for (tie(v, v_end) = adjacent_vertices(u, g); v != v_end; ++v) { + cg_vertex t = component_number[*v]; + if (s != t) // Avoid loops in the condensation graph + adj.push_back(t); + } + } + std::sort(adj.begin(), adj.end()); + typename std::vector::iterator di = + std::unique(adj.begin(), adj.end()); + if (di != adj.end()) + adj.erase(di, adj.end()); + CG[s] = adj; + } + + std::vector topo_order; + std::vector topo_number(num_vertices(CG)); + topological_sort(CG, std::back_inserter(topo_order), + vertex_index_map(identity_property_map())); + std::reverse(topo_order.begin(), topo_order.end()); + size_type n = 0; + for (typename std::vector::iterator iter = topo_order.begin(); + iter != topo_order.end(); ++iter) + topo_number[*iter] = n++; + + for (size_type i = 0; i < num_vertices(CG); ++i) + std::sort(CG[i].begin(), CG[i].end(), + boost::bind(std::less(), + boost::bind(detail::subscript(topo_number), _1), + boost::bind(detail::subscript(topo_number), _2))); + + std::vector > chains; + { + std::vector in_a_chain(num_vertices(CG)); + for (typename std::vector::iterator i = topo_order.begin(); + i != topo_order.end(); ++i) { + cg_vertex v = *i; + if (!in_a_chain[v]) { + chains.resize(chains.size() + 1); + std::vector& chain = chains.back(); + for (;;) { + chain.push_back(v); + in_a_chain[v] = true; + typename graph_traits::adjacency_iterator adj_first, adj_last; + tie(adj_first, adj_last) = adjacent_vertices(v, CG); + typename graph_traits::adjacency_iterator next + = std::find_if(adj_first, adj_last, + std::not1(detail::subscript(in_a_chain))); + if (next != adj_last) + v = *next; + else + break; // end of chain, dead-end + + } + } + } + } + std::vector chain_number(num_vertices(CG)); + std::vector pos_in_chain(num_vertices(CG)); + for (size_type i = 0; i < chains.size(); ++i) + for (size_type j = 0; j < chains[i].size(); ++j) { + cg_vertex v = chains[i][j]; + chain_number[v] = i; + pos_in_chain[v] = j; + } + + cg_vertex inf = (std::numeric_limits< cg_vertex >::max)(); + std::vector > successors(num_vertices(CG), + std::vector + (chains.size(), inf)); + for (typename std::vector::reverse_iterator + i = topo_order.rbegin(); i != topo_order.rend(); ++i) { + cg_vertex u = *i; + typename graph_traits::adjacency_iterator adj, adj_last; + for (tie(adj, adj_last) = adjacent_vertices(u, CG); + adj != adj_last; ++adj) { + cg_vertex v = *adj; + if (topo_number[v] < successors[u][chain_number[v]]) { + // Succ(u) = Succ(u) U Succ(v) + detail::union_successor_sets(successors[u], successors[v], + successors[u]); + // Succ(u) = Succ(u) U {v} + successors[u][chain_number[v]] = topo_number[v]; + } + } + } + + for (size_type i = 0; i < CG.size(); ++i) + CG[i].clear(); + for (size_type i = 0; i < CG.size(); ++i) + for (size_type j = 0; j < chains.size(); ++j) { + size_type topo_num = successors[i][j]; + if (topo_num < inf) { + cg_vertex v = topo_order[topo_num]; + for (size_type k = pos_in_chain[v]; k < chains[j].size(); ++k) + CG[i].push_back(chains[j][k]); + } + } + + + // Add vertices to the transitive closure graph + typedef typename graph_traits < GraphTC >::vertex_descriptor tc_vertex; + { + vertex_iterator i, i_end; + for (tie(i, i_end) = vertices(g); i != i_end; ++i) + g_to_tc_map[*i] = add_vertex(tc); + } + // Add edges between all the vertices in two adjacent SCCs + typename graph_traits::vertex_iterator si, si_end; + for (tie(si, si_end) = vertices(CG); si != si_end; ++si) { + cg_vertex s = *si; + typename graph_traits::adjacency_iterator i, i_end; + for (tie(i, i_end) = adjacent_vertices(s, CG); i != i_end; ++i) { + cg_vertex t = *i; + for (size_type k = 0; k < components[s].size(); ++k) + for (size_type l = 0; l < components[t].size(); ++l) + add_edge(g_to_tc_map[components[s][k]], + g_to_tc_map[components[t][l]], tc); + } + } + // Add edges connecting all vertices in a SCC + for (size_type i = 0; i < components.size(); ++i) + if (components[i].size() > 1) + for (size_type k = 0; k < components[i].size(); ++k) + for (size_type l = 0; l < components[i].size(); ++l) { + vertex u = components[i][k], v = components[i][l]; + add_edge(g_to_tc_map[u], g_to_tc_map[v], tc); + } + + // Find loopbacks in the original graph. + // Need to add it to transitive closure. + { + vertex_iterator i, i_end; + for (tie(i, i_end) = vertices(g); i != i_end; ++i) + { + adjacency_iterator ab, ae; + for (boost::tie(ab, ae) = adjacent_vertices(*i, g); ab != ae; ++ab) + { + if (*ab == *i) + if (components[component_number[*i]].size() == 1) + add_edge(g_to_tc_map[*i], g_to_tc_map[*i], tc); + } + } + } + } + + template + void transitive_closure(const Graph & g, GraphTC & tc) + { + if (num_vertices(g) == 0) + return; + typedef typename property_map::const_type + VertexIndexMap; + VertexIndexMap index_map = get(vertex_index, g); + + typedef typename graph_traits::vertex_descriptor tc_vertex; + std::vector to_tc_vec(num_vertices(g)); + iterator_property_map < tc_vertex *, VertexIndexMap, tc_vertex, tc_vertex&> + g_to_tc_map(&to_tc_vec[0], index_map); + + transitive_closure(g, tc, g_to_tc_map, index_map); + } + + namespace detail + { + template < typename Graph, typename GraphTC, typename G_to_TC_VertexMap, + typename VertexIndexMap> + void transitive_closure_dispatch + (const Graph & g, GraphTC & tc, + G_to_TC_VertexMap g_to_tc_map, VertexIndexMap index_map) + { + typedef typename graph_traits < GraphTC >::vertex_descriptor tc_vertex; + typename std::vector < tc_vertex >::size_type + n = is_default_param(g_to_tc_map) ? num_vertices(g) : 1; + std::vector < tc_vertex > to_tc_vec(n); + + transitive_closure + (g, tc, + choose_param(g_to_tc_map, make_iterator_property_map + (to_tc_vec.begin(), index_map, to_tc_vec[0])), + index_map); + } + } // namespace detail + + template < typename Graph, typename GraphTC, + typename P, typename T, typename R > + void transitive_closure(const Graph & g, GraphTC & tc, + const bgl_named_params < P, T, R > ¶ms) + { + if (num_vertices(g) == 0) + return; + detail::transitive_closure_dispatch + (g, tc, get_param(params, orig_to_copy_t()), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index) ); + } + + + template < typename G > void warshall_transitive_closure(G & g) + { + typedef typename graph_traits < G >::vertex_descriptor vertex; + typedef typename graph_traits < G >::vertex_iterator vertex_iterator; + + function_requires < AdjacencyMatrixConcept < G > >(); + function_requires < EdgeMutableGraphConcept < G > >(); + + // Matrix form: + // for k + // for i + // if A[i,k] + // for j + // A[i,j] = A[i,j] | A[k,j] + vertex_iterator ki, ke, ii, ie, ji, je; + for (tie(ki, ke) = vertices(g); ki != ke; ++ki) + for (tie(ii, ie) = vertices(g); ii != ie; ++ii) + if (edge(*ii, *ki, g).second) + for (tie(ji, je) = vertices(g); ji != je; ++ji) + if (!edge(*ii, *ji, g).second && edge(*ki, *ji, g).second) { + add_edge(*ii, *ji, g); + } + } + + + template < typename G > void warren_transitive_closure(G & g) + { + using namespace boost; + typedef typename graph_traits < G >::vertex_descriptor vertex; + typedef typename graph_traits < G >::vertex_iterator vertex_iterator; + + function_requires < AdjacencyMatrixConcept < G > >(); + function_requires < EdgeMutableGraphConcept < G > >(); + + // Make sure second loop will work + if (num_vertices(g) == 0) + return; + + // for i = 2 to n + // for k = 1 to i - 1 + // if A[i,k] + // for j = 1 to n + // A[i,j] = A[i,j] | A[k,j] + + vertex_iterator ic, ie, jc, je, kc, ke; + for (tie(ic, ie) = vertices(g), ++ic; ic != ie; ++ic) + for (tie(kc, ke) = vertices(g); *kc != *ic; ++kc) + if (edge(*ic, *kc, g).second) + for (tie(jc, je) = vertices(g); jc != je; ++jc) + if (!edge(*ic, *jc, g).second && edge(*kc, *jc, g).second) { + add_edge(*ic, *jc, g); + } + // for i = 1 to n - 1 + // for k = i + 1 to n + // if A[i,k] + // for j = 1 to n + // A[i,j] = A[i,j] | A[k,j] + + for (tie(ic, ie) = vertices(g), --ie; ic != ie; ++ic) + for (kc = ic, ke = ie, ++kc; kc != ke; ++kc) + if (edge(*ic, *kc, g).second) + for (tie(jc, je) = vertices(g); jc != je; ++jc) + if (!edge(*ic, *jc, g).second && edge(*kc, *jc, g).second) { + add_edge(*ic, *jc, g); + } + } + + +} // namespace boost + +#endif // BOOST_GRAPH_TRANSITIVE_CLOSURE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/transpose_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/transpose_graph.hpp new file mode 100644 index 0000000000..b12ba1005d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/transpose_graph.hpp @@ -0,0 +1,40 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_TRANSPOSE_HPP +#define BOOST_GRAPH_TRANSPOSE_HPP + +#include +#include +#include +#include + + +namespace boost { + + template + void transpose_graph(const VertexListGraph& G, MutableGraph& G_T) + { + reverse_graph R(G); + copy_graph(R, G_T); + } + + template + void transpose_graph(const VertexListGraph& G, MutableGraph& G_T, + const bgl_named_params& params) + { + reverse_graph Rev(G); + copy_graph(Rev, G_T, params); + } + +} // namespace boost + +#endif // BOOST_GRAPH_TRANSPOSE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/tree_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/tree_traits.hpp new file mode 100644 index 0000000000..a9f7e8ce1b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/tree_traits.hpp @@ -0,0 +1,43 @@ +// (C) Copyright Jeremy Siek 1999. +// 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_TREE_STRUCTURE_HPP +#define BOOST_TREE_STRUCTURE_HPP + +namespace boost { + + template + struct tree_traits { + typedef typename T::node_descriptor node_descriptor; + typedef typename T::children_iterator children_iterator; + }; + + + template + void traverse_tree(typename tree_traits::node_descriptor v, + Tree& t, TreeVisitor visitor) + { + visitor.preorder(v, t); + typename tree_traits::children_iterator i, end; + tie(i, end) = children(v, t); + if (i != end) { + traverse_tree(*i++, t, visitor); + visitor.inorder(v, t); + while (i != end) + traverse_tree(*i++, t, visitor); + } else + visitor.inorder(v, t); + visitor.postorder(v, t); + } + + struct null_tree_visitor { + template void preorder(Node, Tree&) { } + template void inorder(Node, Tree&) { } + template void postorder(Node, Tree&) { } + }; + +} /* namespace boost */ + +#endif /* BOOST_TREE_STRUCTURE_HPP */ diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/two_bit_color_map.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/two_bit_color_map.hpp new file mode 100644 index 0000000000..3a6d691321 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/two_bit_color_map.hpp @@ -0,0 +1,90 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine + +// Two bit per color property map + +#ifndef BOOST_TWO_BIT_COLOR_MAP_HPP +#define BOOST_TWO_BIT_COLOR_MAP_HPP + +#include +#include + +namespace boost { + +enum two_bit_color_type { + two_bit_white = 0, + two_bit_gray = 1, + two_bit_green = 2, + two_bit_black = 3 +}; + +template <> +struct color_traits +{ + static two_bit_color_type white() { return two_bit_white; } + static two_bit_color_type gray() { return two_bit_gray; } + static two_bit_color_type green() { return two_bit_green; } + static two_bit_color_type black() { return two_bit_black; } +}; + + +template +struct two_bit_color_map +{ + std::size_t n; + IndexMap index; + shared_array data; + + typedef typename property_traits::key_type key_type; + typedef two_bit_color_type value_type; + typedef void reference; + typedef read_write_property_map_tag category; + + explicit two_bit_color_map(std::size_t n, const IndexMap& index = IndexMap()) + : n(n), index(index), data(new unsigned char[(n + 3) / 4]) + { + } +}; + +template +inline two_bit_color_type +get(const two_bit_color_map& pm, + typename two_bit_color_map::key_type key) +{ + typename property_traits::value_type i = get(pm.index, key); + assert (i < pm.n); + return two_bit_color_type((pm.data.get()[i / 4] >> ((i % 4) * 2)) & 3); +} + +template +inline void +put(const two_bit_color_map& pm, + typename two_bit_color_map::key_type key, + two_bit_color_type value) +{ + typename property_traits::value_type i = get(pm.index, key); + assert (i < pm.n); + assert (value >= 0 && value < 4); + std::size_t byte_num = i / 4; + std::size_t bit_position = ((i % 4) * 2); + pm.data.get()[byte_num] = (pm.data.get()[byte_num] & ~(3 << bit_position)) + | (value << bit_position); +} + +template +inline two_bit_color_map +make_two_bit_color_map(std::size_t n, const IndexMap& index_map) +{ + return two_bit_color_map(n, index_map); +} + +} // end namespace boost + +#endif // BOOST_TWO_BIT_COLOR_MAP_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/undirected_dfs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/undirected_dfs.hpp new file mode 100644 index 0000000000..2486cd4b69 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/undirected_dfs.hpp @@ -0,0 +1,250 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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_GRAPH_UNDIRECTED_DFS_HPP +#define BOOST_GRAPH_UNDIRECTED_DFS_HPP + +#include +#include + +namespace boost { + + namespace detail { + +// Define BOOST_RECURSIVE_DFS to use older, recursive version. +// It is retained for a while in order to perform performance +// comparison. +#ifndef BOOST_RECURSIVE_DFS + + template + void undir_dfv_impl + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor u, + DFSVisitor& vis, + VertexColorMap vertex_color, + EdgeColorMap edge_color) + { + function_requires >(); + function_requires >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + function_requires >(); + function_requires >(); + typedef typename property_traits::value_type ColorValue; + typedef typename property_traits::value_type EColorValue; + function_requires< ColorValueConcept >(); + function_requires< ColorValueConcept >(); + typedef color_traits Color; + typedef color_traits EColor; + typedef typename graph_traits::out_edge_iterator Iter; + typedef std::pair > VertexInfo; + + std::vector stack; + + put(vertex_color, u, Color::gray()); + vis.discover_vertex(u, g); + stack.push_back(std::make_pair(u, out_edges(u, g))); + while (!stack.empty()) { + VertexInfo& back = stack.back(); + u = back.first; + Iter ei, ei_end; + tie(ei, ei_end) = back.second; + stack.pop_back(); + while (ei != ei_end) { + Vertex v = target(*ei, g); + vis.examine_edge(*ei, g); + ColorValue v_color = get(vertex_color, v); + EColorValue uv_color = get(edge_color, *ei); + put(edge_color, *ei, EColor::black()); + if (v_color == Color::white()) { + vis.tree_edge(*ei, g); + stack.push_back(std::make_pair(u, std::make_pair(++ei, ei_end))); + u = v; + put(vertex_color, u, Color::gray()); + vis.discover_vertex(u, g); + tie(ei, ei_end) = out_edges(u, g); + } else if (v_color == Color::gray()) { + if (uv_color == EColor::white()) vis.back_edge(*ei, g); + ++ei; + } else { // if (v_color == Color::black()) + ++ei; + } + } + put(vertex_color, u, Color::black()); + vis.finish_vertex(u, g); + } + } + +#else // BOOST_RECURSIVE_DFS + + template + void undir_dfv_impl + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor u, + DFSVisitor& vis, // pass-by-reference here, important! + VertexColorMap vertex_color, + EdgeColorMap edge_color) + { + function_requires >(); + function_requires >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + function_requires >(); + function_requires >(); + typedef typename property_traits::value_type ColorValue; + typedef typename property_traits::value_type EColorValue; + function_requires< ColorValueConcept >(); + function_requires< ColorValueConcept >(); + typedef color_traits Color; + typedef color_traits EColor; + typename graph_traits::out_edge_iterator ei, ei_end; + + put(vertex_color, u, Color::gray()); vis.discover_vertex(u, g); + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + Vertex v = target(*ei, g); vis.examine_edge(*ei, g); + ColorValue v_color = get(vertex_color, v); + EColorValue uv_color = get(edge_color, *ei); + put(edge_color, *ei, EColor::black()); + if (v_color == Color::white()) { vis.tree_edge(*ei, g); + undir_dfv_impl(g, v, vis, vertex_color, edge_color); + } else if (v_color == Color::gray() && uv_color == EColor::white()) + vis.back_edge(*ei, g); + } + put(vertex_color, u, Color::black()); vis.finish_vertex(u, g); + } + +#endif // ! BOOST_RECURSIVE_DFS + + } // namespace detail + + template + void + undirected_dfs(const Graph& g, DFSVisitor vis, + VertexColorMap vertex_color, EdgeColorMap edge_color, + Vertex start_vertex) + { + function_requires >(); + function_requires >(); + + typedef typename property_traits::value_type ColorValue; + typedef color_traits Color; + + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(vertex_color, *ui, Color::white()); vis.initialize_vertex(*ui, g); + } + typename graph_traits::edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + put(edge_color, *ei, Color::white()); + + if (start_vertex != *vertices(g).first){ vis.start_vertex(start_vertex, g); + detail::undir_dfv_impl(g, start_vertex, vis, vertex_color, edge_color); + } + + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + ColorValue u_color = get(vertex_color, *ui); + if (u_color == Color::white()) { vis.start_vertex(*ui, g); + detail::undir_dfv_impl(g, *ui, vis, vertex_color, edge_color); + } + } + } + + template + void + undirected_dfs(const Graph& g, DFSVisitor vis, + VertexColorMap vertex_color, EdgeColorMap edge_color) + { + undirected_dfs(g, vis, vertex_color, edge_color, *vertices(g).first); + } + + namespace detail { + template + struct udfs_dispatch { + + template + static void + apply(const Graph& g, DFSVisitor vis, Vertex start_vertex, + const bgl_named_params&, + EdgeColorMap edge_color, + VertexColorMap vertex_color) + { + undirected_dfs(g, vis, vertex_color, edge_color, start_vertex); + } + }; + + template <> + struct udfs_dispatch { + template + static void + apply(const Graph& g, DFSVisitor vis, Vertex start_vertex, + const bgl_named_params& params, + EdgeColorMap edge_color, + detail::error_property_not_found) + { + std::vector color_vec(num_vertices(g)); + default_color_type c = white_color; // avoid warning about un-init + undirected_dfs + (g, vis, make_iterator_property_map + (color_vec.begin(), + choose_const_pmap(get_param(params, vertex_index), + g, vertex_index), c), + edge_color, + start_vertex); + } + }; + + } // namespace detail + + + // Named Parameter Variant + template + void + undirected_dfs(const Graph& g, + const bgl_named_params& params) + { + typedef typename property_value< bgl_named_params, + vertex_color_t>::type C; + detail::udfs_dispatch::apply + (g, + choose_param(get_param(params, graph_visitor), + make_dfs_visitor(null_visitor())), + choose_param(get_param(params, root_vertex_t()), + *vertices(g).first), + params, + get_param(params, edge_color), + get_param(params, vertex_color) + ); + } + + + template + void undirected_depth_first_visit + (const IncidenceGraph& g, + typename graph_traits::vertex_descriptor u, + DFSVisitor vis, VertexColorMap vertex_color, EdgeColorMap edge_color) + { + detail::undir_dfv_impl(g, u, vis, vertex_color, edge_color); + } + + +} // namespace boost + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/vector_as_graph.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/vector_as_graph.hpp new file mode 100644 index 0000000000..711b799ec5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/vector_as_graph.hpp @@ -0,0 +1,332 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2006 The Trustees of Indiana University. +// Copyright (C) 2001 Vladimir Prus +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Douglas Gregor +// +// 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) +//======================================================================= + +// The mutating functions (add_edge, etc.) were added by Vladimir Prus. + +#ifndef BOOST_VECTOR_AS_GRAPH_HPP +#define BOOST_VECTOR_AS_GRAPH_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + This module implements the VertexListGraph concept using a + std::vector as the "back-bone" of the graph (the vector *is* the + graph object). The edge-lists type of the graph is templated, so the + user can choose any STL container, so long as the value_type of the + container is convertible to the size_type of the vector. For now any + graph properties must be stored seperately. + + This module requires the C++ compiler to support partial + specialization for the graph_traits class, so this is not portable + to VC++. + +*/ + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#error The vector-as-graph module requires a compiler that supports partial specialization +#endif + + +namespace boost { + namespace detail { + template struct val_out_edge_ret; + template struct val_out_edge_iter; + template struct val_edge; + } +} + +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace boost { + + struct vector_as_graph_traversal_tag + : public vertex_list_graph_tag, + public adjacency_graph_tag, + public incidence_graph_tag { }; + + template + struct graph_traits< std::vector > + { + typedef typename EdgeList::value_type V; + typedef V vertex_descriptor; + typedef typename detail::val_edge::type edge_descriptor; + typedef typename EdgeList::const_iterator adjacency_iterator; + typedef typename detail::val_out_edge_iter::type + out_edge_iterator; + typedef void in_edge_iterator; + typedef void edge_iterator; + typedef typename integer_range::iterator vertex_iterator; + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + typedef vector_as_graph_traversal_tag traversal_category; + typedef typename std::vector::size_type vertices_size_type; + typedef void edges_size_type; + typedef typename EdgeList::size_type degree_size_type; + }; + template + struct edge_property_type< std::vector > + { + typedef void type; + }; + template + struct vertex_property_type< std::vector > + { + typedef void type; + }; + template + struct graph_property_type< std::vector > + { + typedef void type; + }; +} +#endif + +namespace boost { + + namespace detail { + + // "val" is short for Vector Adjacency List + + template + struct val_edge + { + typedef typename EdgeList::value_type V; + typedef std::pair type; + }; + + // need rewrite this using boost::iterator_adaptor + template + class val_out_edge_iterator + : public boost::iterator, + std::ptrdiff_t, std::pair*, const std::pair > + { + typedef val_out_edge_iterator self; + typedef std::pair Edge; + public: + val_out_edge_iterator() { } + val_out_edge_iterator(V s, Iter i) : _source(s), _iter(i) { } + Edge operator*() const { return Edge(_source, *_iter); } + self& operator++() { ++_iter; return *this; } + self operator++(int) { self t = *this; ++_iter; return t; } + bool operator==(const self& x) const { return _iter == x._iter; } + bool operator!=(const self& x) const { return _iter != x._iter; } + protected: + V _source; + Iter _iter; + }; + + template + struct val_out_edge_iter + { + typedef typename EdgeList::value_type V; + typedef typename EdgeList::const_iterator Iter; + typedef val_out_edge_iterator type; + }; + + template + struct val_out_edge_ret + { + typedef typename val_out_edge_iter::type IncIter; + typedef std::pair type; + }; + + } // namesapce detail + + template + typename detail::val_out_edge_ret::type + out_edges(typename EdgeList::value_type v, + const std::vector& g) + { + typedef typename detail::val_out_edge_iter::type Iter; + typedef typename detail::val_out_edge_ret::type return_type; + return return_type(Iter(v, g[v].begin()), Iter(v, g[v].end())); + } + + template + typename EdgeList::size_type + out_degree(typename EdgeList::value_type v, + const std::vector& g) + { + return g[v].size(); + } + + template + std::pair + adjacent_vertices(typename EdgeList::value_type v, + const std::vector& g) + { + return std::make_pair(g[v].begin(), g[v].end()); + } + + // source() and target() already provided for pairs in graph_traits.hpp + + template + std::pair + ::iterator, + typename boost::integer_range + ::iterator > + vertices(const std::vector& v) + { + typedef typename boost::integer_range + ::iterator Iter; + return std::make_pair(Iter(0), Iter(v.size())); + } + + template + typename std::vector::size_type + num_vertices(const std::vector& v) + { + return v.size(); + } + + template + typename std::pair::type, bool> + add_edge(typename EdgeList::value_type u, typename EdgeList::value_type v, + std::vector& g) + { + typedef typename detail::val_edge::type edge_type; + g[u].insert(g[u].end(), v); + return std::make_pair(edge_type(u, v), true); + } + + template + typename std::pair::type, bool> + edge(typename EdgeList::value_type u, typename EdgeList::value_type v, + std::vector& g) + { + typedef typename detail::val_edge::type edge_type; + typename EdgeList::iterator i = g[u].begin(), end = g[u].end(); + for (; i != end; ++i) + if (*i == v) + return std::make_pair(edge_type(u, v), true); + return std::make_pair(edge_type(), false); + } + + template + void + remove_edge(typename EdgeList::value_type u, typename EdgeList::value_type v, + std::vector& g) + { + typename EdgeList::iterator i = std::remove(g[u].begin(), g[u].end(), v); + if (i != g[u].end()) + g[u].erase(i, g[u].end()); + } + + template + void + remove_edge(typename detail::val_edge::type e, + std::vector& g) + { + typename EdgeList::value_type u, v; + u = e.first; + v = e.second; + // FIXME: edge type does not fully specify the edge to be deleted + typename EdgeList::iterator i = std::remove(g[u].begin(), g[u].end(), v); + if (i != g[u].end()) + g[u].erase(i, g[u].end()); + } + + template + void + remove_edge_if(Predicate p, + std::vector& g) + { + for (std::size_t u = 0; u < g.size(); ++u) { + // Oops! gcc gets internal compiler error on compose_....... + + typedef typename EdgeList::iterator iterator; + iterator b = g[u].begin(), e = g[u].end(); + + if (!g[u].empty()) { + + for(; b != e;) { + if (p(std::make_pair(u, *b))) { + --e; + if (b == e) + break; + else + iter_swap(b, e); + } else { + ++b; + } + } + } + + if (e != g[u].end()) + g[u].erase(e, g[u].end()); + } + } + + template + typename EdgeList::value_type + add_vertex(std::vector& g) + { + g.resize(g.size()+1); + return g.size()-1; + } + + template + void + clear_vertex(typename EdgeList::value_type u, + std::vector& g) + { + g[u].clear(); + for (std::size_t i = 0; i < g.size(); ++i) + remove_edge(i, u, g); + } + + template + void + remove_vertex(typename EdgeList::value_type u, + std::vector& g) + { + typedef typename EdgeList::iterator iterator; + clear_vertex(u, g); + g.erase(g.begin() + u); + for (std::size_t i = 0; i < g.size(); ++i) + for ( iterator it = g[i].begin(); it != g[i].end(); ++it ) + // after clear_vertex *it is never equal to u + if ( *it > u ) + --*it; + } + + template + struct property_map, vertex_index_t> + { + typedef identity_property_map type; + typedef type const_type; + }; + + template + identity_property_map + get(vertex_index_t, const std::vector&) + { + return identity_property_map(); + } + + template + identity_property_map + get(vertex_index_t, std::vector&) + { + return identity_property_map(); + } +} // namespace boost + +#endif // BOOST_VECTOR_AS_GRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/visitors.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/visitors.hpp new file mode 100644 index 0000000000..2b88ed0610 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/visitors.hpp @@ -0,0 +1,279 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// 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) +//======================================================================= +// +// Revision History: +// 01 April 2001: Modified to use new header. (JMaddock) +// +#ifndef BOOST_GRAPH_GRAPH_SEARCH_VISITORS_HPP +#define BOOST_GRAPH_GRAPH_SEARCH_VISITORS_HPP + +#include +#include +#include +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define Graph Graph_ +#endif + +namespace boost { + + // This is a bit more convenient than std::numeric_limits because + // you don't have to explicitly provide type T. + template + inline T numeric_limits_max(T) { return (std::numeric_limits::max)(); } + + //======================================================================== + // Event Tags + + namespace detail { + // For partial specialization workaround + enum event_visitor_enum + { on_no_event_num, + on_initialize_vertex_num, on_start_vertex_num, + on_discover_vertex_num, on_finish_vertex_num, on_examine_vertex_num, + on_examine_edge_num, on_tree_edge_num, on_non_tree_edge_num, + on_gray_target_num, on_black_target_num, + on_forward_or_cross_edge_num, on_back_edge_num, + on_edge_relaxed_num, on_edge_not_relaxed_num, + on_edge_minimized_num, on_edge_not_minimized_num + }; + + template + struct functor_to_visitor : Visitor + { + typedef Event event_filter; + functor_to_visitor(const Visitor& visitor) : Visitor(visitor) {} + }; + + } // namespace detail + + struct on_no_event { enum { num = detail::on_no_event_num }; }; + + struct on_initialize_vertex { + enum { num = detail::on_initialize_vertex_num }; }; + struct on_start_vertex { enum { num = detail::on_start_vertex_num }; }; + struct on_discover_vertex { enum { num = detail::on_discover_vertex_num }; }; + struct on_examine_vertex { enum { num = detail::on_examine_vertex_num }; }; + struct on_finish_vertex { enum { num = detail::on_finish_vertex_num }; }; + + struct on_examine_edge { enum { num = detail::on_examine_edge_num }; }; + struct on_tree_edge { enum { num = detail::on_tree_edge_num }; }; + struct on_non_tree_edge { enum { num = detail::on_non_tree_edge_num }; }; + struct on_gray_target { enum { num = detail::on_gray_target_num }; }; + struct on_black_target { enum { num = detail::on_black_target_num }; }; + struct on_forward_or_cross_edge { + enum { num = detail::on_forward_or_cross_edge_num }; }; + struct on_back_edge { enum { num = detail::on_back_edge_num }; }; + + struct on_edge_relaxed { enum { num = detail::on_edge_relaxed_num }; }; + struct on_edge_not_relaxed { + enum { num = detail::on_edge_not_relaxed_num }; }; + struct on_edge_minimized { enum { num = detail::on_edge_minimized_num }; }; + struct on_edge_not_minimized { + enum { num = detail::on_edge_not_minimized_num }; }; + + struct true_tag { enum { num = true }; }; + struct false_tag { enum { num = false }; }; + + //======================================================================== + // base_visitor and null_visitor + + // needed for MSVC workaround + template + struct base_visitor { + typedef on_no_event event_filter; + template + void operator()(T, Graph&) { } + }; + + struct null_visitor : public base_visitor { + typedef on_no_event event_filter; + template + void operator()(T, Graph&) { } + }; + + //======================================================================== + // The invoke_visitors() function + + namespace detail { + template + inline void + invoke_dispatch(Visitor& v, T x, Graph& g, true_tag) { + v(x, g); + } + template + inline void + invoke_dispatch(Visitor&, T, Graph&, false_tag) { } + } // namespace detail + + template + inline void + invoke_visitors(std::pair& vlist, T x, Graph& g, Tag tag) { + typedef typename Visitor::event_filter Category; + typedef typename graph_detail::is_same::is_same_tag + IsSameTag; + detail::invoke_dispatch(vlist.first, x, g, IsSameTag()); + invoke_visitors(vlist.second, x, g, tag); + } +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + template + inline void + invoke_visitors(base_visitor& vis, T x, Graph& g, Tag) { + typedef typename Visitor::event_filter Category; + typedef typename graph_detail::is_same::is_same_tag + IsSameTag; + Visitor& v = static_cast(vis); + detail::invoke_dispatch(v, x, g, IsSameTag()); + } +#else + template + inline void + invoke_visitors(Visitor& v, T x, Graph& g, Tag) { + typedef typename Visitor::event_filter Category; + typedef typename graph_detail::is_same::is_same_tag + IsSameTag; + detail::invoke_dispatch(v, x, g, IsSameTag()); + } +#endif + + //======================================================================== + // predecessor_recorder + + template + struct predecessor_recorder + : public base_visitor > + { + typedef Tag event_filter; + predecessor_recorder(PredecessorMap pa) : m_predecessor(pa) { } + template + void operator()(Edge e, const Graph& g) { + put(m_predecessor, target(e, g), source(e, g)); + } + PredecessorMap m_predecessor; + }; + template + predecessor_recorder + record_predecessors(PredecessorMap pa, Tag) { + return predecessor_recorder (pa); + } + + //======================================================================== + // edge_predecessor_recorder + + template + struct edge_predecessor_recorder + : public base_visitor > + { + typedef Tag event_filter; + edge_predecessor_recorder(PredEdgeMap pa) : m_predecessor(pa) { } + template + void operator()(Edge e, const Graph& g) { + put(m_predecessor, target(e, g), e); + } + PredEdgeMap m_predecessor; + }; + template + edge_predecessor_recorder + record_edge_predecessors(PredEdgeMap pa, Tag) { + return edge_predecessor_recorder (pa); + } + + //======================================================================== + // distance_recorder + + template + struct distance_recorder + : public base_visitor > + { + typedef Tag event_filter; + distance_recorder(DistanceMap pa) : m_distance(pa) { } + template + void operator()(Edge e, const Graph& g) { + typename graph_traits::vertex_descriptor + u = source(e, g), v = target(e, g); + put(m_distance, v, get(m_distance, u) + 1); + } + DistanceMap m_distance; + }; + template + distance_recorder + record_distances(DistanceMap pa, Tag) { + return distance_recorder (pa); + } + + //======================================================================== + // time_stamper + + + template + struct time_stamper + : public base_visitor > + { + typedef Tag event_filter; + time_stamper(TimeMap pa, TimeT& t) : m_time_pa(pa), m_time(t) { } + template + void operator()(Vertex u, const Graph&) { + put(m_time_pa, u, ++m_time); + } + TimeMap m_time_pa; + TimeT& m_time; + }; + template + time_stamper + stamp_times(TimeMap pa, TimeT& time_counter, Tag) { + return time_stamper(pa, time_counter); + } + + //======================================================================== + // property_writer + + template + struct property_writer + : public base_visitor > + { + typedef Tag event_filter; + + property_writer(PA pa, OutputIterator out) : m_pa(pa), m_out(out) { } + + template + void operator()(T x, Graph&) { *m_out++ = get(m_pa, x); } + PA m_pa; + OutputIterator m_out; + }; + template + property_writer + write_property(PA pa, OutputIterator out, Tag) { + return property_writer(pa, out); + } + +#define BOOST_GRAPH_EVENT_STUB(Event,Kind) \ + typedef ::boost::Event Event##_type; \ + template \ + Kind##_visitor, Visitors> > \ + do_##Event(Visitor visitor) \ + { \ + typedef std::pair, \ + Visitors> visitor_list; \ + typedef Kind##_visitor result_type; \ + return result_type(visitor_list(visitor, m_vis)); \ + } + +} /* namespace boost */ + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# undef Graph +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/wavefront.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/wavefront.hpp new file mode 100644 index 0000000000..00cf35241f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/wavefront.hpp @@ -0,0 +1,135 @@ +// +//======================================================================= +// Copyright 2002 Marc Wintermantel (wintermantel@even-ag.ch) +// ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st) +// +// 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_GRAPH_WAVEFRONT_HPP +#define BOOST_GRAPH_WAVEFRONT_HPP + +#include +#include +#include +#include +#include +#include +#include // for std::min and std::max + +namespace boost { + + template + typename graph_traits::vertices_size_type + ith_wavefront(typename graph_traits::vertex_descriptor i, + const Graph& g, + VertexIndexMap index) + { + typename graph_traits::vertex_descriptor v, w; + typename graph_traits::vertices_size_type b = 1; + typename graph_traits::out_edge_iterator edge_it2, edge_it2_end; + typename graph_traits::vertices_size_type index_i = index[i]; + std::vector rows_active(num_vertices(g), false); + + rows_active[index_i] = true; + + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) + { + v = *ui; + if(index[v] <= index_i) + { + for (tie(edge_it2, edge_it2_end) = out_edges(v, g); edge_it2 != edge_it2_end; ++edge_it2) + { + w = target(*edge_it2, g); + if( (index[w] >= index_i) && (!rows_active[index[w]]) ) + { + b++; + rows_active[index[w]] = true; + } + } + } + } + + return b; + } + + + template + typename graph_traits::vertices_size_type + ith_wavefront(typename graph_traits::vertex_descriptor i, + const Graph& g) + { + return ith_wavefront(i, g, get(vertex_index, g)); + } + + + template + typename graph_traits::vertices_size_type + max_wavefront(const Graph& g, VertexIndexMap index) + { + BOOST_USING_STD_MAX(); + typename graph_traits::vertices_size_type b = 0; + typename graph_traits::vertex_iterator i, end; + for (tie(i, end) = vertices(g); i != end; ++i) + b = max BOOST_PREVENT_MACRO_SUBSTITUTION(b, ith_wavefront(*i, g, index)); + return b; + } + + template + typename graph_traits::vertices_size_type + max_wavefront(const Graph& g) + { + return max_wavefront(g, get(vertex_index, g)); + } + + + template + double + aver_wavefront(const Graph& g, VertexIndexMap index) + { + double b = 0; + typename graph_traits::vertex_iterator i, end; + for (tie(i, end) = vertices(g); i != end; ++i) + b += ith_wavefront(*i, g, index); + + b /= num_vertices(g); + return b; + } + + template + double + aver_wavefront(const Graph& g) + { + return aver_wavefront(g, get(vertex_index, g)); + } + + + template + double + rms_wavefront(const Graph& g, VertexIndexMap index) + { + double b = 0; + typename graph_traits::vertex_iterator i, end; + for (tie(i, end) = vertices(g); i != end; ++i) + b += std::pow(double ( ith_wavefront(*i, g, index) ), 2.0); + + b /= num_vertices(g); + + return std::sqrt(b); + } + + template + double + rms_wavefront(const Graph& g) + { + return rms_wavefront(g, get(vertex_index, g)); + } + + +} // namespace boost + +#endif // BOOST_GRAPH_WAVEFRONT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/graph/write_dimacs.hpp b/deal.II/contrib/boost/include/boost-1.37.0/graph/write_dimacs.hpp new file mode 100644 index 0000000000..0b8af17df4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/graph/write_dimacs.hpp @@ -0,0 +1,72 @@ +// Copyright (c) 2006, Stephan Diederich +// +// This code may be used under either of the following two licences: +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. OF SUCH DAMAGE. +// +// Or: +// +// 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) + +/* + Writes maximal flow problem in extended DIMACS format to an OutputIterator + Vertex indices are read from an IndexMap and shiftet by 1. + so their new range is [1..num_vertices(g)] +*/ + +/* ----------------------------------------------------------------- */ + +#include +#include +#include + +namespace boost { + +template +void write_dimacs_max_flow(const Graph& g, + CapacityMap capacity, + IndexMap idx, + typename graph_traits::vertex_descriptor src, + typename graph_traits::vertex_descriptor sink, + std::ostream& out) +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename graph_traits::edges_size_type edges_size_type; + typedef typename graph_traits::edge_iterator edge_iterator; + + out << "c DIMACS max-flow file generated from boost::write_dimacs_max_flow" << std::endl; + out << "p max " << num_vertices(g) << " " << num_edges(g) << std::endl; //print problem description "max" and number of verts and edges + out << "n " << get(idx, src) + 1 << " s" << std::endl;; //say which one is source + out << "n " << get(idx, sink) + 1 << " t" << std::endl; //say which one is sink + + //output the edges + edge_iterator ei, e_end; + for(tie(ei,e_end) = edges(g); ei!=e_end; ++ei){ + out << "a " << idx[ source(*ei, g) ] + 1 << " " << idx[ target(*ei, g) ] + 1 << " " << get(capacity,*ei) << std::endl; + } +} + +} // namespace boost diff --git a/deal.II/contrib/boost/include/boost-1.37.0/implicit_cast.hpp b/deal.II/contrib/boost/include/boost-1.37.0/implicit_cast.hpp new file mode 100644 index 0000000000..5b1cd92b9b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/implicit_cast.hpp @@ -0,0 +1,29 @@ +// Copyright David Abrahams 2003. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef IMPLICIT_CAST_DWA200356_HPP +# define IMPLICIT_CAST_DWA200356_HPP + +# include + +namespace boost { + +// implementation originally suggested by C. Green in +// http://lists.boost.org/MailArchives/boost/msg00886.php + +// The use of identity creates a non-deduced form, so that the +// explicit template argument must be supplied +template +inline T implicit_cast (typename mpl::identity::type x) { + return x; +} + +// incomplete return type now is here +//template +//void implicit_cast (...); + +} // namespace boost + + +#endif // IMPLICIT_CAST_DWA200356_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/indirect_reference.hpp b/deal.II/contrib/boost/include/boost-1.37.0/indirect_reference.hpp new file mode 100644 index 0000000000..5fbb342319 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/indirect_reference.hpp @@ -0,0 +1,43 @@ +#ifndef INDIRECT_REFERENCE_DWA200415_HPP +# define INDIRECT_REFERENCE_DWA200415_HPP + +// +// Copyright David Abrahams 2004. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// typename indirect_reference

::type provides the type of *p. +// +// http://www.boost.org/libs/iterator/doc/pointee.html +// + +# include +# include +# include +# include +# include + +namespace boost { + +namespace detail +{ + template + struct smart_ptr_reference + { + typedef typename boost::pointee

::type& type; + }; +} + +template +struct indirect_reference + : mpl::eval_if< + detail::is_incrementable

+ , iterator_reference

+ , detail::smart_ptr_reference

+ > +{ +}; + +} // namespace boost + +#endif // INDIRECT_REFERENCE_DWA200415_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/integer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/integer.hpp new file mode 100644 index 0000000000..dc57dff778 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/integer.hpp @@ -0,0 +1,127 @@ +// boost integer.hpp header file -------------------------------------------// + +// Copyright Beman Dawes and Daryle Walker 1999. 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/integer for documentation. + +// Revision History +// 22 Sep 01 Added value-based integer templates. (Daryle Walker) +// 01 Apr 01 Modified to use new header. (John Maddock) +// 30 Jul 00 Add typename syntax fix (Jens Maurer) +// 28 Aug 99 Initial version + +#ifndef BOOST_INTEGER_HPP +#define BOOST_INTEGER_HPP + +#include // self include + +#include // for boost::integer_traits +#include // for std::numeric_limits + +namespace boost +{ + + // Helper templates ------------------------------------------------------// + + // fast integers from least integers + // int_fast_t<> works correctly for unsigned too, in spite of the name. + template< typename LeastInt > + struct int_fast_t { typedef LeastInt fast; }; // imps may specialize + + // convert category to type + template< int Category > struct int_least_helper {}; // default is empty + + // specializatons: 1=long, 2=int, 3=short, 4=signed char, + // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char + // no specializations for 0 and 5: requests for a type > long are in error + template<> struct int_least_helper<1> { typedef long least; }; + template<> struct int_least_helper<2> { typedef int least; }; + template<> struct int_least_helper<3> { typedef short least; }; + template<> struct int_least_helper<4> { typedef signed char least; }; + template<> struct int_least_helper<6> { typedef unsigned long least; }; + template<> struct int_least_helper<7> { typedef unsigned int least; }; + template<> struct int_least_helper<8> { typedef unsigned short least; }; + template<> struct int_least_helper<9> { typedef unsigned char least; }; + + // integer templates specifying number of bits ---------------------------// + + // signed + template< int Bits > // bits (including sign) required + struct int_t + { + typedef typename int_least_helper + < + (Bits-1 <= std::numeric_limits::digits) + + (Bits-1 <= std::numeric_limits::digits) + + (Bits-1 <= std::numeric_limits::digits) + + (Bits-1 <= std::numeric_limits::digits) + >::least least; + typedef typename int_fast_t::fast fast; + }; + + // unsigned + template< int Bits > // bits required + struct uint_t + { + typedef typename int_least_helper + < + 5 + + (Bits <= std::numeric_limits::digits) + + (Bits <= std::numeric_limits::digits) + + (Bits <= std::numeric_limits::digits) + + (Bits <= std::numeric_limits::digits) + >::least least; + typedef typename int_fast_t::fast fast; + // int_fast_t<> works correctly for unsigned too, in spite of the name. + }; + + // integer templates specifying extreme value ----------------------------// + + // signed + template< long MaxValue > // maximum value to require support + struct int_max_value_t + { + typedef typename int_least_helper + < + (MaxValue <= integer_traits::const_max) + + (MaxValue <= integer_traits::const_max) + + (MaxValue <= integer_traits::const_max) + + (MaxValue <= integer_traits::const_max) + >::least least; + typedef typename int_fast_t::fast fast; + }; + + template< long MinValue > // minimum value to require support + struct int_min_value_t + { + typedef typename int_least_helper + < + (MinValue >= integer_traits::const_min) + + (MinValue >= integer_traits::const_min) + + (MinValue >= integer_traits::const_min) + + (MinValue >= integer_traits::const_min) + >::least least; + typedef typename int_fast_t::fast fast; + }; + + // unsigned + template< unsigned long Value > // maximum value to require support + struct uint_value_t + { + typedef typename int_least_helper + < + 5 + + (Value <= integer_traits::const_max) + + (Value <= integer_traits::const_max) + + (Value <= integer_traits::const_max) + + (Value <= integer_traits::const_max) + >::least least; + typedef typename int_fast_t::fast fast; + }; + + +} // namespace boost + +#endif // BOOST_INTEGER_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/integer/integer_mask.hpp b/deal.II/contrib/boost/include/boost-1.37.0/integer/integer_mask.hpp new file mode 100644 index 0000000000..0a092d3850 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/integer/integer_mask.hpp @@ -0,0 +1,93 @@ +// Boost integer/integer_mask.hpp header file ------------------------------// + +// (C) Copyright Daryle Walker 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 for updates, documentation, and revision history. + +#ifndef BOOST_INTEGER_INTEGER_MASK_HPP +#define BOOST_INTEGER_INTEGER_MASK_HPP + +#include // self include + +#include // for BOOST_STATIC_CONSTANT +#include // for boost::uint_t + +#include // for UCHAR_MAX, etc. +#include // for std::size_t + +#include // for std::numeric_limits + + +namespace boost +{ + + +// Specified single-bit mask class declaration -----------------------------// +// (Lowest bit starts counting at 0.) + +template < std::size_t Bit > +struct high_bit_mask_t +{ + typedef typename uint_t<(Bit + 1)>::least least; + typedef typename uint_t<(Bit + 1)>::fast fast; + + BOOST_STATIC_CONSTANT( least, high_bit = (least( 1u ) << Bit) ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = (fast( 1u ) << Bit) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_position = Bit ); + +}; // boost::high_bit_mask_t + + +// Specified bit-block mask class declaration ------------------------------// +// Makes masks for the lowest N bits +// (Specializations are needed when N fills up a type.) + +template < std::size_t Bits > +struct low_bits_mask_t +{ + typedef typename uint_t::least least; + typedef typename uint_t::fast fast; + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + +}; // boost::low_bits_mask_t + + +#define BOOST_LOW_BITS_MASK_SPECIALIZE( Type ) \ + template < > struct low_bits_mask_t< std::numeric_limits::digits > { \ + typedef std::numeric_limits limits_type; \ + typedef uint_t::least least; \ + typedef uint_t::fast fast; \ + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); \ + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); \ + BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits ); \ + } + +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char ); + +#if USHRT_MAX > UCHAR_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned short ); +#endif + +#if UINT_MAX > USHRT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int ); +#endif + +#if ULONG_MAX > UINT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long ); +#endif + +#undef BOOST_LOW_BITS_MASK_SPECIALIZE + + +} // namespace boost + + +#endif // BOOST_INTEGER_INTEGER_MASK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/integer/static_log2.hpp b/deal.II/contrib/boost/include/boost-1.37.0/integer/static_log2.hpp new file mode 100644 index 0000000000..19e048bd03 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/integer/static_log2.hpp @@ -0,0 +1,132 @@ +// -------------- Boost static_log2.hpp header file ----------------------- // +// +// Copyright (C) 2001 Daryle Walker. +// Copyright (C) 2003 Vesa Karvonen. +// Copyright (C) 2003 Gennaro Prota. +// +// 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/integer for documentation. +// ------------------------------------------------------------------------- // + + +#ifndef BOOST_INTEGER_STATIC_LOG2_HPP +#define BOOST_INTEGER_STATIC_LOG2_HPP + +#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT + +namespace boost { + + namespace detail { + + namespace static_log2_impl { + + // choose_initial_n<> + // + // Recursively doubles its integer argument, until it + // becomes >= of the "width" (C99, 6.2.6.2p4) of + // static_log2_argument_type. + // + // Used to get the maximum power of two less then the width. + // + // Example: if on your platform argument_type has 48 value + // bits it yields n=32. + // + // It's easy to prove that, starting from such a value + // of n, the core algorithm works correctly for any width + // of static_log2_argument_type and that recursion always + // terminates with x = 1 and n = 0 (see the algorithm's + // invariant). + + typedef unsigned long argument_type; + typedef int result_type; + + + template + struct choose_initial_n { + + enum { c = (argument_type(1) << n << n) != 0 }; + BOOST_STATIC_CONSTANT( + result_type, + value = !c*n + choose_initial_n<2*c*n>::value + ); + + }; + + template <> + struct choose_initial_n<0> { + BOOST_STATIC_CONSTANT(result_type, value = 0); + }; + + + + // start computing from n_zero - must be a power of two + const result_type n_zero = 16; + const result_type initial_n = choose_initial_n::value; + + // static_log2_impl<> + // + // * Invariant: + // 2n + // 1 <= x && x < 2 at the start of each recursion + // (see also choose_initial_n<>) + // + // * Type requirements: + // + // argument_type maybe any unsigned type with at least n_zero + 1 + // value bits. (Note: If larger types will be standardized -e.g. + // unsigned long long- then the argument_type typedef can be + // changed without affecting the rest of the code.) + // + + template + struct static_log2_impl { + + enum { c = (x >> n) > 0 }; // x >= 2**n ? + BOOST_STATIC_CONSTANT( + result_type, + value = c*n + (static_log2_impl< (x>>c*n), n/2 >::value) + ); + + }; + + template <> + struct static_log2_impl<1, 0> { + BOOST_STATIC_CONSTANT(result_type, value = 0); + }; + + } + } // detail + + + + // -------------------------------------- + // static_log2 + // ---------------------------------------- + + typedef detail::static_log2_impl::argument_type static_log2_argument_type; + typedef detail::static_log2_impl::result_type static_log2_result_type; + + + template + struct static_log2 { + + BOOST_STATIC_CONSTANT( + static_log2_result_type, + value = detail::static_log2_impl::static_log2_impl::value + ); + + }; + + + template <> + struct static_log2<0> { }; + +} + + + +#endif // include guard diff --git a/deal.II/contrib/boost/include/boost-1.37.0/integer/static_min_max.hpp b/deal.II/contrib/boost/include/boost-1.37.0/integer/static_min_max.hpp new file mode 100644 index 0000000000..264603727f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/integer/static_min_max.hpp @@ -0,0 +1,55 @@ +// Boost integer/static_min_max.hpp header file ----------------------------// + +// (C) Copyright Daryle Walker 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 for updates, documentation, and revision history. + +#ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP +#define BOOST_INTEGER_STATIC_MIN_MAX_HPP + +#include // self include + +#include // for BOOST_STATIC_CONSTANT + + +namespace boost +{ + + +// Compile-time extrema class declarations ---------------------------------// +// Get the minimum or maximum of two values, signed or unsigned. + +template < long Value1, long Value2 > +struct static_signed_min +{ + BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 ); +}; + +template < long Value1, long Value2 > +struct static_signed_max +{ + BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 ); +}; + +template < unsigned long Value1, unsigned long Value2 > +struct static_unsigned_min +{ + BOOST_STATIC_CONSTANT( unsigned long, value + = (Value1 > Value2) ? Value2 : Value1 ); +}; + +template < unsigned long Value1, unsigned long Value2 > +struct static_unsigned_max +{ + BOOST_STATIC_CONSTANT( unsigned long, value + = (Value1 < Value2) ? Value2 : Value1 ); +}; + + +} // namespace boost + + +#endif // BOOST_INTEGER_STATIC_MIN_MAX_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/integer_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/integer_fwd.hpp new file mode 100644 index 0000000000..33cfc9986f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/integer_fwd.hpp @@ -0,0 +1,152 @@ +// Boost integer_fwd.hpp header file ---------------------------------------// + +// (C) Copyright Dave Abrahams and Daryle Walker 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/integer for documentation. + +#ifndef BOOST_INTEGER_FWD_HPP +#define BOOST_INTEGER_FWD_HPP + +#include // for UCHAR_MAX, etc. +#include // for std::size_t + +#include // for BOOST_NO_INTRINSIC_WCHAR_T +#include // for std::numeric_limits + + +namespace boost +{ + + +// From ------------------------------------------------// + +// Only has typedefs or using statements, with #conditionals + + +// From -----------------------------------------// + +template < class T > + class integer_traits; + +template < > + class integer_traits< bool >; + +template < > + class integer_traits< char >; + +template < > + class integer_traits< signed char >; + +template < > + class integer_traits< unsigned char >; + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template < > + class integer_traits< wchar_t >; +#endif + +template < > + class integer_traits< short >; + +template < > + class integer_traits< unsigned short >; + +template < > + class integer_traits< int >; + +template < > + class integer_traits< unsigned int >; + +template < > + class integer_traits< long >; + +template < > + class integer_traits< unsigned long >; + +#ifdef ULLONG_MAX +template < > + class integer_traits< ::boost::long_long_type>; + +template < > + class integer_traits< ::boost::ulong_long_type >; +#endif + + +// From ------------------------------------------------// + +template < typename LeastInt > + struct int_fast_t; + +template< int Bits > + struct int_t; + +template< int Bits > + struct uint_t; + +template< long MaxValue > + struct int_max_value_t; + +template< long MinValue > + struct int_min_value_t; + +template< unsigned long Value > + struct uint_value_t; + + +// From -----------------------------------// + +template < std::size_t Bit > + struct high_bit_mask_t; + +template < std::size_t Bits > + struct low_bits_mask_t; + +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; + +#if USHRT_MAX > UCHAR_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; +#endif + +#if UINT_MAX > USHRT_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; +#endif + +#if ULONG_MAX > UINT_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; +#endif + + +// From ------------------------------------// + +template < unsigned long Value > + struct static_log2; + +template < > + struct static_log2< 0ul >; + + +// From ---------------------------------// + +template < long Value1, long Value2 > + struct static_signed_min; + +template < long Value1, long Value2 > + struct static_signed_max; + +template < unsigned long Value1, unsigned long Value2 > + struct static_unsigned_min; + +template < unsigned long Value1, unsigned long Value2 > + struct static_unsigned_max; + + +} // namespace boost + + +#endif // BOOST_INTEGER_FWD_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/integer_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/integer_traits.hpp new file mode 100644 index 0000000000..ac4ef32f30 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/integer_traits.hpp @@ -0,0 +1,236 @@ +/* boost integer_traits.hpp header file + * + * Copyright Jens Maurer 2000 + * 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) + * + * $Id: integer_traits.hpp 32576 2006-02-05 10:19:42Z johnmaddock $ + * + * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers + */ + +// See http://www.boost.org/libs/integer for documentation. + + +#ifndef BOOST_INTEGER_TRAITS_HPP +#define BOOST_INTEGER_TRAITS_HPP + +#include +#include + +// These are an implementation detail and not part of the interface +#include +// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it, +// and some may have but not ... +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__)) +#include +#endif + + +namespace boost { +template +class integer_traits : public std::numeric_limits +{ +public: + BOOST_STATIC_CONSTANT(bool, is_integral = false); +}; + +namespace detail { +template +class integer_traits_base +{ +public: + BOOST_STATIC_CONSTANT(bool, is_integral = true); + BOOST_STATIC_CONSTANT(T, const_min = min_val); + BOOST_STATIC_CONSTANT(T, const_max = max_val); +}; + +#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +// A definition is required even for integral static constants +template +const bool integer_traits_base::is_integral; + +template +const T integer_traits_base::const_min; + +template +const T integer_traits_base::const_max; +#endif + +} // namespace detail + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<> +class integer_traits + : public std::numeric_limits, + // Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native + // library: they are wrong! +#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__) + public detail::integer_traits_base +#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__)) + // No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned: + public detail::integer_traits_base +#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400))\ + || (defined __APPLE__)\ + || (defined(__OpenBSD__) && defined(__GNUC__))\ + || (defined(__NetBSD__) && defined(__GNUC__))\ + || (defined(__FreeBSD__) && defined(__GNUC__))\ + || (defined(__DragonFly__) && defined(__GNUC__))\ + || (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT)) + // No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as int. + // - SGI MIPSpro with native library + // - gcc 3.x on HP-UX + // - Mac OS X with native library + // - gcc on FreeBSD, OpenBSD and NetBSD + public detail::integer_traits_base +#elif defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 2) && !defined(__SGI_STL_PORT) + // No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as unsigned int. + // - gcc 2.95.x on HP-UX + // (also, std::numeric_limits appears to return the wrong values). + public detail::integer_traits_base +#else +#error No WCHAR_MIN and WCHAR_MAX present, please adjust integer_traits<> for your compiler. +#endif +{ }; +#endif // BOOST_NO_INTRINSIC_WCHAR_T + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) +#if defined(ULLONG_MAX) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, LLONG_MIN, LLONG_MAX> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULLONG_MAX> +{ }; + +#elif defined(ULONG_LONG_MAX) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, public detail::integer_traits_base< ::boost::long_long_type, LONG_LONG_MIN, LONG_LONG_MAX>{ }; +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONG_LONG_MAX> +{ }; + +#elif defined(ULONGLONG_MAX) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, LONGLONG_MIN, LONGLONG_MAX> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONGLONG_MAX> +{ }; + +#elif defined(_LLONG_MAX) && defined(_C2) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, -_LLONG_MAX - _C2, _LLONG_MAX> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, _ULLONG_MAX> +{ }; + +#elif defined(BOOST_HAS_LONG_LONG) +// +// we have long long but no constants, this happens for example with gcc in -ansi mode, +// we'll just have to work out the values for ourselves (assumes 2's compliment representation): +// +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) - 1)), ~(1LL << (sizeof(::boost::long_long_type) - 1))> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL> +{ }; + +#endif +#endif + +} // namespace boost + +#endif /* BOOST_INTEGER_TRAITS_HPP */ + + + diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/any_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/any_hook.hpp new file mode 100644 index 0000000000..4690cef4e3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/any_hook.hpp @@ -0,0 +1,344 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2008 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_ANY_HOOK_HPP +#define BOOST_INTRUSIVE_ANY_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +template +struct get_any_node_algo +{ + typedef any_algorithms type; +}; +/// @endcond + +//! Helper metafunction to define a \c \c any_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_any_base_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_any_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::AnyBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from this hook in order to store objects of that class +//! in an intrusive container. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<> and +//! \c link_mode<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c any_base_hook, then each \c any_base_hook needs its +//! unique tag. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link). +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class any_base_hook + : public make_any_base_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + public: + //! Effects: If link_mode is or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + any_base_hook(); + + //! Effects: If link_mode is or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + any_base_hook(const any_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + any_base_hook& operator=(const any_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a container an assertion is raised. + //! + //! Throws: Nothing. + ~any_base_hook(); + + //! Precondition: link_mode must be \c safe_link. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c container::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + #endif +}; + +//! Helper metafunction to define a \c \c any_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_any_member_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_any_node_algo + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Store this hook in a class to be inserted +//! in an intrusive container. +//! +//! The hook admits the following options: \c void_pointer<> and +//! \c link_mode<>. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link). +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class any_member_hook + : public make_any_member_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + public: + //! Effects: If link_mode is or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + any_member_hook(); + + //! Effects: If link_mode is or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + any_member_hook(const any_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + any_member_hook& operator=(const any_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a container an assertion is raised. + //! + //! Throws: Nothing. + ~any_member_hook(); + + //! Precondition: link_mode must be \c safe_link. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c container::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + #endif +}; + +/// @cond + +namespace detail{ + +template +struct any_to_get_base_pointer_type +{ + typedef typename pointer_to_other + ::type type; +}; + +template +struct any_to_get_member_pointer_type +{ + typedef typename pointer_to_other + ::type type; +}; + +//!This option setter specifies that the container +//!must use the specified base hook +template class NodeTraits> +struct any_to_some_hook +{ + typedef typename BaseHook::template pack::value_traits old_value_traits; + template + struct pack : public Base + { + struct value_traits : public old_value_traits + { + static const bool is_any_hook = true; + typedef typename detail::eval_if_c + < detail::internal_base_hook_bool_is_true::value + , any_to_get_base_pointer_type + , any_to_get_member_pointer_type + >::type void_pointer; + typedef NodeTraits node_traits; + }; + }; +}; + +} //namespace detail{ + +/// @endcond + +//!This option setter specifies that +//!any hook should behave as an slist hook +template +struct any_to_slist_hook +/// @cond + : public detail::any_to_some_hook +/// @endcond +{}; + +//!This option setter specifies that +//!any hook should behave as an list hook +template +struct any_to_list_hook +/// @cond + : public detail::any_to_some_hook +/// @endcond +{}; + +//!This option setter specifies that +//!any hook should behave as a set hook +template +struct any_to_set_hook +/// @cond + : public detail::any_to_some_hook +/// @endcond +{}; + +//!This option setter specifies that +//!any hook should behave as a set hook +template +struct any_to_avl_set_hook +/// @cond + : public detail::any_to_some_hook +/// @endcond +{}; + +//!This option setter specifies that any +//!hook should behave as a set hook +template +struct any_to_bs_set_hook +/// @cond + : public detail::any_to_some_hook +/// @endcond +{}; + +//!This option setter specifies that any hook +//!should behave as an unordered set hook +template +struct any_to_unordered_set_hook +/// @cond + : public detail::any_to_some_hook +/// @endcond +{}; + + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_ANY_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avl_set.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avl_set.hpp new file mode 100644 index 0000000000..a550232117 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avl_set.hpp @@ -0,0 +1,2183 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_AVL_SET_HPP +#define BOOST_INTRUSIVE_AVL_SET_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! The class template avl_set is an intrusive container, that mimics most of +//! the interface of std::set as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class avl_set_impl +{ + /// @cond + typedef avltree_impl tree_type; + //! This class is + //! non-copyable + avl_set_impl (const avl_set_impl&); + + //! This class is + //! non-assignable + avl_set_impl &operator =(const avl_set_impl&); + + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor of the value_compare object throws. + avl_set_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty avl_set and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is std::distance(last, first). + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + avl_set_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(true, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the avl_set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~avl_set_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of avl_set. + //! + //! Effects: Returns a const reference to the avl_set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static avl_set_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &avl_set_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of avl_set. + //! + //! Effects: Returns a const reference to the set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const avl_set_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &avl_set_impl::tree_); + } + + //! Precondition: it must be a valid iterator of set. + //! + //! Effects: Returns a reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static avl_set_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &avl_set_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of set. + //! + //! Effects: Returns a const reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const avl_set_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &avl_set_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the avl_set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the avl_set. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two sets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(avl_set_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to inserts value into the avl_set. + //! + //! Returns: If the value + //! is not already present inserts it and returns a pair containing the + //! iterator to the new value and true. If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert(reference value) + { return tree_.insert_unique(value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to to insert x into the avl_set, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: An iterator that points to the position where the + //! new element was inserted into the avl_set. + //! + //! Complexity: Logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_unique(hint, value); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an aavlitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the avl_set, using + //! a user provided key instead of the value itself. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that + //! part to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the avl_set. + template + std::pair insert_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(key, key_value_comp, commit_data); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an aavlitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the avl_set, using + //! a user provided key instead of the value itself, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! constructing that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that key + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This can give a total + //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the avl_set. + template + std::pair insert_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(hint, key, key_value_comp, commit_data); } + + //! Requires: value must be an lvalue of type value_type. commit_data + //! must have been obtained from a previous call to "insert_check". + //! No objects should have been inserted or erased from the avl_set between + //! the "insert_check" that filled "commit_data" and the call to "insert_commit". + //! + //! Effects: Inserts the value in the avl_set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Returns: An iterator to the newly inserted object. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + iterator insert_commit(reference value, const insert_commit_data &commit_data) + { return tree_.insert_unique_commit(value, commit_data); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the avl_set. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_unique(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size()) + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If the comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: If the internal value_compare ordering function throws. + //! + //! Complexity: O(log(size() + this->count(value)). Basic guarantee. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) const + { return tree_.find(value) != end(); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp) != end(); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound(const_reference value) const + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound(const_reference value) const + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find(const_reference value) const + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range(const_reference value) const + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range(key, comp); } + + //! Requires: value must be an lvalue and shall be in a avl_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the avl_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a avl_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! avl_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a avl_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the avl_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a avl_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! avl_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a avl_set/avl_multiset. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + /// @cond + friend bool operator==(const avl_set_impl &x, const avl_set_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const avl_set_impl &x, const avl_set_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_set_impl &x, const avl_set_impl &y) +#else +(const avl_set_impl &x, const avl_set_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_set_impl &x, const avl_set_impl &y) +#else +(const avl_set_impl &x, const avl_set_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_set_impl &x, const avl_set_impl &y) +#else +(const avl_set_impl &x, const avl_set_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_set_impl &x, const avl_set_impl &y) +#else +(const avl_set_impl &x, const avl_set_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(avl_set_impl &x, avl_set_impl &y) +#else +(avl_set_impl &x, avl_set_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c avl_set that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_avl_set +{ + /// @cond + typedef avl_set_impl + < typename make_avltree_opt + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class avl_set + : public make_avl_set + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + typedef typename make_avl_set + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + avl_set( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + avl_set( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static avl_set &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const avl_set &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static avl_set &container_from_iterator(iterator end_iterator) + { return static_cast(Base::container_from_iterator(end_iterator)); } + + static const avl_set &container_from_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_iterator(end_iterator)); } +}; + +#endif + +//! The class template avl_multiset is an intrusive container, that mimics most of +//! the interface of std::avl_multiset as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class avl_multiset_impl +{ + /// @cond + typedef avltree_impl tree_type; + + //Non-copyable and non-assignable + avl_multiset_impl (const avl_multiset_impl&); + avl_multiset_impl &operator =(const avl_multiset_impl&); + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + avl_multiset_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty avl_multiset and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is the distance between first and last + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + avl_multiset_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(false, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the avl_multiset + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~avl_multiset_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of avl_multiset. + //! + //! Effects: Returns a const reference to the avl_multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static avl_multiset_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &avl_multiset_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of avl_multiset. + //! + //! Effects: Returns a const reference to the avl_multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const avl_multiset_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &avl_multiset_impl::tree_); + } + + //! Precondition: it must be a valid iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static avl_multiset_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &avl_multiset_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const avl_multiset_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &avl_multiset_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the avl_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the avl_multiset. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two avl_multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(avl_multiset_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the avl_multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(reference value) + { return tree_.insert_equal(value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts x into the avl_multiset, using pos as a hint to + //! where it will be inserted. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_equal(hint, value); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the avl_multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_equal(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) const + { return tree_.count(value); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) const + { return tree_.count(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound(const_reference value) const + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound(const_reference value) const + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find(const_reference value) const + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range(const_reference value) const + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range(key, comp); } + + //! Requires: value must be an lvalue and shall be in a avl_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the avl_multiset + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a avl_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! avl_multiset that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a avl_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the avl_multiset + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a avl_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! avl_multiset that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a avl_multiset/avl_multiset. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + /// @cond + friend bool operator==(const avl_multiset_impl &x, const avl_multiset_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const avl_multiset_impl &x, const avl_multiset_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#else +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#else +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#else +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#else +(const avl_multiset_impl &x, const avl_multiset_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(avl_multiset_impl &x, avl_multiset_impl &y) +#else +(avl_multiset_impl &x, avl_multiset_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c avl_multiset that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_avl_multiset +{ + /// @cond + typedef avl_multiset_impl + < typename make_avltree_opt + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class avl_multiset + : public make_avl_multiset::type +{ + typedef typename make_avl_multiset + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + avl_multiset( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + avl_multiset( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static avl_multiset &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const avl_multiset &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static avl_multiset &container_from_iterator(iterator end_iterator) + { return static_cast(Base::container_from_iterator(end_iterator)); } + + static const avl_multiset &container_from_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_iterator(end_iterator)); } +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_AVL_SET_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avl_set_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avl_set_hook.hpp new file mode 100644 index 0000000000..76fa739da0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avl_set_hook.hpp @@ -0,0 +1,295 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_AVL_SET_HOOK_HPP +#define BOOST_INTRUSIVE_AVL_SET_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +template +struct get_avl_set_node_algo +{ + typedef avltree_algorithms > type; +}; +/// @endcond + +//! Helper metafunction to define a \c avl_set_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_avl_set_base_hook +{ + /// @cond + typedef typename pack_options + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type packed_options; + + typedef detail::generic_hook + < get_avl_set_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::AvlSetBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from avl_set_base_hook in order to store objects in +//! in an avl_set/avl_multiset. avl_set_base_hook holds the data necessary to maintain +//! the avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<>, +//! \c link_mode<> and \c optimize_size<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! unique tag. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c optimize_size<> will tell the hook to optimize the hook for size instead +//! of speed. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class avl_set_base_hook + : public make_avl_set_base_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + avl_set_base_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + avl_set_base_hook(const avl_set_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + avl_set_base_hook& operator=(const avl_set_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~avl_set_base_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(avl_set_base_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +//! Helper metafunction to define a \c avl_set_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_avl_set_member_hook +{ + /// @cond + typedef typename pack_options + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type packed_options; + + typedef detail::generic_hook + < get_avl_set_node_algo + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Put a public data member avl_set_member_hook in order to store objects of this class in +//! an avl_set/avl_multiset. avl_set_member_hook holds the data necessary for maintaining the +//! avl_set/avl_multiset and provides an appropriate value_traits class for avl_set/avl_multiset. +//! +//! The hook admits the following options: \c void_pointer<>, +//! \c link_mode<> and \c optimize_size<>. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c optimize_size<> will tell the hook to optimize the hook for size instead +//! of speed. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class avl_set_member_hook + : public make_avl_set_member_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + avl_set_member_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + avl_set_member_hook(const avl_set_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + avl_set_member_hook& operator=(const avl_set_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~avl_set_member_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(avl_set_member_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_AVL_SET_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avltree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avltree.hpp new file mode 100644 index 0000000000..46038a8622 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avltree.hpp @@ -0,0 +1,1482 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_AVLTREE_HPP +#define BOOST_INTRUSIVE_AVLTREE_HPP + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond + +template +struct avl_setopt +{ + typedef ValueTraits value_traits; + typedef Compare compare; + typedef SizeType size_type; + static const bool constant_time_size = ConstantTimeSize; +}; + +template +struct avl_set_defaults + : pack_options + < none + , base_hook + , constant_time_size + , size_type + , compare > + >::type +{}; + +/// @endcond + +//! The class template avltree is an intrusive AVL tree container, that +//! is used to construct intrusive avl_set and avl_multiset containers. +//! The no-throw guarantee holds only, if the value_compare object +//! doesn't throw. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class avltree_impl +{ + public: + typedef typename Config::value_traits value_traits; + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + /// @endcond + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::const_pointer const_pointer; + typedef typename std::iterator_traits::value_type value_type; + typedef value_type key_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename Config::size_type size_type; + typedef typename Config::compare value_compare; + typedef value_compare key_compare; + typedef tree_iterator iterator; + typedef tree_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef avltree_algorithms node_algorithms; + + static const bool constant_time_size = Config::constant_time_size; + static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; + + /// @cond + private: + typedef detail::size_holder size_traits; + + //noncopyable + avltree_impl (const avltree_impl&); + avltree_impl operator =(const avltree_impl&); + + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + //Constant-time size is incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink))); + + struct header_plus_size : public size_traits + { node header_; }; + + struct node_plus_pred_t : public detail::ebo_functor_holder + { + node_plus_pred_t(const value_compare &comp) + : detail::ebo_functor_holder(comp) + {} + header_plus_size header_plus_size_; + }; + + struct data_t : public avltree_impl::value_traits + { + typedef typename avltree_impl::value_traits value_traits; + data_t(const value_compare & comp, const value_traits &val_traits) + : value_traits(val_traits), node_plus_pred_(comp) + {} + node_plus_pred_t node_plus_pred_; + } data_; + + const value_compare &priv_comp() const + { return data_.node_plus_pred_.get(); } + + value_compare &priv_comp() + { return data_.node_plus_pred_.get(); } + + const node &priv_header() const + { return data_.node_plus_pred_.header_plus_size_.header_; } + + node &priv_header() + { return data_.node_plus_pred_.header_plus_size_.header_; } + + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(detail::get_pointer(ptr))); + } + + size_traits &priv_size_traits() + { return data_.node_plus_pred_.header_plus_size_; } + + const size_traits &priv_size_traits() const + { return data_.node_plus_pred_.header_plus_size_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_.get_value_traits(*this); } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_; } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_.get_value_traits(*this); } + + /// @endcond + + public: + + const real_value_traits &get_real_value_traits() const + { return this->get_real_value_traits(detail::bool_()); } + + real_value_traits &get_real_value_traits() + { return this->get_real_value_traits(detail::bool_()); } + + typedef typename node_algorithms::insert_commit_data insert_commit_data; + + //! Effects: Constructs an empty tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + avltree_impl( value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + } + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty tree and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is the distance between first and last. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + template + avltree_impl( bool unique, Iterator b, Iterator e + , value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + if(unique) + this->insert_unique(b, e); + else + this->insert_equal(b, e); + } + + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called), but the nodes according to + //! the value_traits template parameter are reinitialized and thus can be reused. + //! + //! Complexity: Linear to elements contained in *this. + //! + //! Throws: Nothing. + ~avltree_impl() + { this->clear(); } + + //! Effects: Returns an iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return iterator (node_traits::get_left(node_ptr(&priv_header())), this); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return cbegin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return const_iterator (node_traits::get_left(const_node_ptr(&priv_header())), this); } + + //! Effects: Returns an iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return iterator (node_ptr(&priv_header()), this); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return cend(); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return const_iterator (uncast(const_node_ptr(&priv_header())), this); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return const_reverse_iterator(begin()); } + + //! Precondition: end_iterator must be a valid end iterator + //! of avltree. + //! + //! Effects: Returns a const reference to the avltree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static avltree_impl &container_from_end_iterator(iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of avltree. + //! + //! Effects: Returns a const reference to the avltree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const avltree_impl &container_from_end_iterator(const_iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: it must be a valid iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static avltree_impl &container_from_iterator(iterator it) + { return priv_container_from_iterator(it); } + + //! Precondition: it must be a valid end const_iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const avltree_impl &container_from_iterator(const_iterator it) + { return priv_container_from_iterator(it); } + + //! Effects: Returns the value_compare object used by the tree. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return priv_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return node_algorithms::unique(const_node_ptr(&priv_header())); } + + //! Effects: Returns the number of elements stored in the tree. + //! + //! Complexity: Linear to elements contained in *this. + //! + //! Throws: Nothing. + size_type size() const + { + if(constant_time_size) + return this->priv_size_traits().get_size(); + else{ + return (size_type)node_algorithms::size(const_node_ptr(&priv_header())); + } + } + + //! Effects: Swaps the contents of two multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the comparison functor's swap call throws. + void swap(avltree_impl& other) + { + //This can throw + using std::swap; + swap(priv_comp(), priv_comp()); + //These can't throw + node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header())); + if(constant_time_size){ + size_type backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(other.priv_size_traits().get_size()); + other.priv_size_traits().set_size(backup); + } + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree before the upper bound. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + return iterator(node_algorithms::insert_equal_upper_bound + (node_ptr(&priv_header()), to_insert, key_node_comp), this); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator. + //! + //! Effects: Inserts x into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case) + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(const_iterator hint, reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + return iterator(node_algorithms::insert_equal + (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a each element of a range into the tree + //! before the upper bound of the key of each element. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_equal(Iterator b, Iterator e) + { + iterator end(this->end()); + for (; b != e; ++b) + this->insert_equal(end, *b); + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree if the value + //! is not already present. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert_unique(reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(value, commit_data); + if(!ret.second) + return ret; + return std::pair (insert_unique_commit(value, commit_data), true); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator + //! + //! Effects: Tries to insert x into the tree, using "hint" as a hint + //! to where it will be inserted. + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time (two comparisons in the worst case) + //! if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_unique(const_iterator hint, reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(hint, value, commit_data); + if(!ret.second) + return ret.first; + return insert_unique_commit(value, commit_data); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Tries to insert each element of a range into the tree. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_unique(Iterator b, Iterator e) + { + if(this->empty()){ + iterator end(this->end()); + for (; b != e; ++b) + this->insert_unique(end, *b); + } + else{ + for (; b != e; ++b) + this->insert_unique(*b); + } + } + + std::pair insert_unique_check + (const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + (node_algorithms::insert_unique_check + (node_ptr(&priv_header()), key, comp, commit_data)); + return std::pair(iterator(ret.first, this), ret.second); + } + + std::pair insert_unique_check + (const_iterator hint, const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(hint, value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + (node_algorithms::insert_unique_check + (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data)); + return std::pair(iterator(ret.first, this), ret.second); + } + + iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) + { + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + node_algorithms::insert_unique_commit + (node_ptr(&priv_header()), to_insert, commit_data); + return iterator(to_insert, this); + } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { + iterator ret(i); + ++ret; + node_ptr to_erase(i.pointed_node()); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase)); + node_algorithms::erase(&priv_header(), to_erase); + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + return ret; + } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { size_type n; return private_erase(b, e, n); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return this->erase(value, priv_comp()); } + + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { + node_ptr to_erase(i.pointed_node()); + iterator ret(this->erase(i)); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + return ret; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { size_type n; return private_erase(b, e, n, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { + std::pair p = this->equal_range(value); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { + if(safemode_or_autounlink){ + this->clear_and_dispose(detail::null_disposer()); + } + else{ + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + } + + //! Effects: Erases all of the elements calling disposer(p) for + //! each node to be erased. + //! Complexity: Average complexity for is at most O(log(size() + N)), + //! where N is the number of elements in the container. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. Calls N times to disposer functor. + template + void clear_and_dispose(Disposer disposer) + { + node_algorithms::clear_and_dispose(node_ptr(&priv_header()) + , detail::node_disposer(disposer, this)); + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + + //! Effects: Returns the number of contained elements with the given value + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given value. + //! + //! Throws: Nothing. + size_type count(const_reference value) const + { return this->count(value, priv_comp()); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: Nothing. + template + size_type count(const KeyType &key, KeyValueCompare comp) const + { + std::pair ret = this->equal_range(key, comp); + return std::distance(ret.first, ret.second); + } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator lower_bound(const_reference value) + { return this->lower_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator lower_bound(const_reference value) const + { return this->lower_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator lower_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator upper_bound(const_reference value) + { return this->upper_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator upper_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::upper_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator upper_bound(const_reference value) const + { return this->upper_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::upper_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator find(const_reference value) + { return this->find(value, priv_comp()); } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator find(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator find(const_reference value) const + { return this->find(value, priv_comp()); } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator find(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + std::pair equal_range(const_reference value) + { return this->equal_range(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + std::pair equal_range(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp)); + return std::pair(iterator(ret.first, this), iterator(ret.second, this)); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + std::pair + equal_range(const_reference value) const + { return this->equal_range(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + std::pair + equal_range(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp)); + return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer) + { + this->clear_and_dispose(disposer); + if(!src.empty()){ + detail::exception_disposer + rollback(*this, disposer); + node_algorithms::clone + (const_node_ptr(&src.priv_header()) + ,node_ptr(&this->priv_header()) + ,detail::node_cloner(cloner, this) + ,detail::node_disposer(disposer, this)); + this->priv_size_traits().set_size(src.priv_size_traits().get_size()); + this->priv_comp() = src.priv_comp(); + rollback.release(); + } + } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { + node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance + (node_ptr(&priv_header()))); + if(!to_be_disposed) + return 0; + this->priv_size_traits().decrement(); + if(safemode_or_autounlink)//If this is commented does not work with normal_link + node_algorithms::init(to_be_disposed); + return get_real_value_traits().to_value_ptr(to_be_disposed); + } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { + node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) + , node_ptr(&priv_header()) + , get_real_value_traits().to_node_ptr(with_this)); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return iterator (value_traits::to_node_ptr(value), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return const_iterator (value_traits::to_node_ptr(const_cast (value)), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return iterator (value_traits::to_node_ptr(value), this); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return const_iterator (value_traits::to_node_ptr(const_cast (value)), this); } + + //! Requires: value shall not be in a tree. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { node_algorithms::init(value_traits::to_node_ptr(value)); } + +/* + //! Effects: removes x from a tree of the appropriate type. It has no effect, + //! if x is not in such a tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This static function is only usable with the "safe mode" + //! hook and non-constant time size lists. Otherwise, the user must use + //! the non-static "erase(reference )" member. If the user calls + //! this function with a non "safe mode" or constant time size list + //! a compilation error will be issued. + template + static void remove_node(T& value) + { + //This function is only usable for safe mode hooks and non-constant + //time lists. + //BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size))); + BOOST_STATIC_ASSERT((!constant_time_size)); + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + node_ptr to_remove(value_traits::to_node_ptr(value)); + node_algorithms::unlink_and_rebalance(to_remove); + if(safemode_or_autounlink) + node_algorithms::init(to_remove); + } +*/ + + /// @cond + private: + template + iterator private_erase(iterator b, iterator e, size_type &n, Disposer disposer) + { + for(n = 0; b != e; ++n) + this->erase_and_dispose(b++, disposer); + return b; + } + + iterator private_erase(iterator b, iterator e, size_type &n) + { + for(n = 0; b != e; ++n) + this->erase(b++); + return b; + } + /// @endcond + + private: + static avltree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) + { + header_plus_size *r = detail::parent_from_member + ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + node_plus_pred_t *n = detail::parent_from_member + (r, &node_plus_pred_t::header_plus_size_); + data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); + avltree_impl *avl = detail::parent_from_member(d, &avltree_impl::data_); + return *avl; + } + + static avltree_impl &priv_container_from_iterator(const const_iterator &it) + { return priv_container_from_end_iterator(it.end_iterator_from_it()); } +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator< +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avltree_impl &x, const avltree_impl &y) +#else +(const avltree_impl &x, const avltree_impl &y) +#endif +{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +bool operator== +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avltree_impl &x, const avltree_impl &y) +#else +(const avltree_impl &x, const avltree_impl &y) +#endif +{ + typedef avltree_impl tree_type; + typedef typename tree_type::const_iterator const_iterator; + + if(tree_type::constant_time_size && x.size() != y.size()){ + return false; + } + const_iterator end1 = x.end(); + const_iterator i1 = x.begin(); + const_iterator i2 = y.begin(); + if(tree_type::constant_time_size){ + while (i1 != end1 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1; + } + else{ + const_iterator end2 = y.end(); + while (i1 != end1 && i2 != end2 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1 && i2 == end2; + } +} + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avltree_impl &x, const avltree_impl &y) +#else +(const avltree_impl &x, const avltree_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avltree_impl &x, const avltree_impl &y) +#else +(const avltree_impl &x, const avltree_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avltree_impl &x, const avltree_impl &y) +#else +(const avltree_impl &x, const avltree_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const avltree_impl &x, const avltree_impl &y) +#else +(const avltree_impl &x, const avltree_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(avltree_impl &x, avltree_impl &y) +#else +(avltree_impl &x, avltree_impl &y) +#endif +{ x.swap(y); } + +/// @cond + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_avltree_opt +{ + typedef typename pack_options + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + < avl_set_defaults, O1, O2, O3, O4> + #else + < avl_set_defaults, Options...> + #endif + ::type packed_options; + + typedef typename detail::get_value_traits + ::type value_traits; + + typedef avl_setopt + < value_traits + , typename packed_options::compare + , typename packed_options::size_type + , packed_options::constant_time_size + > type; +}; +/// @endcond + +//! Helper metafunction to define a \c avltree that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_avltree +{ + /// @cond + typedef avltree_impl + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + < typename make_avltree_opt::type + #else + < typename make_avltree_opt::type + #endif + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class avltree + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + : public make_avltree::type + #else + : public make_avltree::type + #endif +{ + typedef typename make_avltree + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::real_value_traits real_value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + avltree( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + avltree( bool unique, Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(unique, b, e, cmp, v_traits) + {} + + static avltree &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const avltree &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static avltree &container_from_iterator(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const avltree &container_from_iterator(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_AVLTREE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avltree_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avltree_algorithms.hpp new file mode 100644 index 0000000000..307dbc8c5b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/avltree_algorithms.hpp @@ -0,0 +1,993 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Daniel K. O. 2005. +// (C) Copyright Ion Gaztanaga 2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_AVLTREE_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_AVLTREE_ALGORITHMS_HPP + +#include + +#include +#include + +#include +#include +#include + + +namespace boost { +namespace intrusive { + +//! avltree_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the circular list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! balance: The type of the balance factor +//! +//! Static functions: +//! +//! static node_ptr get_parent(const_node_ptr n); +//! +//! static void set_parent(node_ptr n, node_ptr parent); +//! +//! static node_ptr get_left(const_node_ptr n); +//! +//! static void set_left(node_ptr n, node_ptr left); +//! +//! static node_ptr get_right(const_node_ptr n); +//! +//! static void set_right(node_ptr n, node_ptr right); +//! +//! static balance get_balance(const_node_ptr n); +//! +//! static void set_balance(node_ptr n, balance b); +//! +//! static balance negative(); +//! +//! static balance zero(); +//! +//! static balance positive(); +template +class avltree_algorithms +{ + public: + typedef typename NodeTraits::node node; + typedef NodeTraits node_traits; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef typename NodeTraits::balance balance; + + /// @cond + private: + typedef detail::tree_algorithms tree_algorithms; + + template + struct avltree_node_cloner + : private detail::ebo_functor_holder + { + typedef detail::ebo_functor_holder base_t; + + avltree_node_cloner(F f) + : base_t(f) + {} + + node_ptr operator()(node_ptr p) + { + node_ptr n = base_t::get()(p); + NodeTraits::set_balance(n, NodeTraits::get_balance(p)); + return n; + } + }; + + struct avltree_erase_fixup + { + void operator()(node_ptr to_erase, node_ptr successor) + { NodeTraits::set_balance(successor, NodeTraits::get_balance(to_erase)); } + }; + + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + } + /// @endcond + + public: + static node_ptr begin_node(const_node_ptr header) + { return tree_algorithms::begin_node(header); } + + static node_ptr end_node(const_node_ptr header) + { return tree_algorithms::end_node(header); } + + //! This type is the information that will be + //! filled by insert_unique_check + typedef typename tree_algorithms::insert_commit_data insert_commit_data; + + //! Requires: header1 and header2 must be the header nodes + //! of two trees. + //! + //! Effects: Swaps two trees. After the function header1 will contain + //! links to the second tree and header2 will have links to the first tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static void swap_tree(node_ptr header1, node_ptr header2) + { return tree_algorithms::swap_tree(header1, header2); } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr node2) + { + if(node1 == node2) + return; + + node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2)); + swap_nodes(node1, header1, node2, header2); + } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees with header header1 and header2. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) + { + if(node1 == node2) return; + + tree_algorithms::swap_nodes(node1, header1, node2, header2); + //Swap balance + balance c = NodeTraits::get_balance(node1); + NodeTraits::set_balance(node1, NodeTraits::get_balance(node2)); + NodeTraits::set_balance(node2, c); + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing and comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) + { + if(node_to_be_replaced == new_node) + return; + replace_node(node_to_be_replaced, tree_algorithms::get_header(node_to_be_replaced), new_node); + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! with header "header" and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) + { + tree_algorithms::replace_node(node_to_be_replaced, header, new_node); + NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced)); + } + + //! Requires: node is a tree node but not the header. + //! + //! Effects: Unlinks the node and rebalances the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + static void unlink(node_ptr node) + { + node_ptr x = NodeTraits::get_parent(node); + if(x){ + while(!is_header(x)) + x = NodeTraits::get_parent(x); + erase(x, node); + } + } + + //! Requires: header is the header of a tree. + //! + //! Effects: Unlinks the leftmost node from the tree, and + //! updates the header link to the new leftmost node. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + static node_ptr unlink_leftmost_without_rebalance(node_ptr header) + { return tree_algorithms::unlink_leftmost_without_rebalance(header); } + + //! Requires: node is a node of the tree or an node initialized + //! by init(...). + //! + //! Effects: Returns true if the node is initialized by init(). + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + static bool unique(const_node_ptr node) + { return tree_algorithms::unique(node); } + + //! Requires: node is a node of the tree but it's not the header. + //! + //! Effects: Returns the number of nodes of the subtree. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr node) + { return tree_algorithms::count(node); } + + //! Requires: header is the header node of the tree. + //! + //! Effects: Returns the number of nodes above the header. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t size(const_node_ptr header) + { return tree_algorithms::size(header); } + + //! Requires: p is a node from the tree except the header. + //! + //! Effects: Returns the next node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr next_node(node_ptr p) + { return tree_algorithms::next_node(p); } + + //! Requires: p is a node from the tree except the leftmost node. + //! + //! Effects: Returns the previous node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr prev_node(node_ptr p) + { return tree_algorithms::prev_node(p); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: After the function unique(node) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init(node_ptr node) + { tree_algorithms::init(node); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: Initializes the header to represent an empty tree. + //! unique(header) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init_header(node_ptr header) + { + tree_algorithms::init_header(header); + NodeTraits::set_balance(header, NodeTraits::zero()); + } + + //! Requires: header must be the header of a tree, z a node + //! of that tree and z != header. + //! + //! Effects: Erases node "z" from the tree with header "header". + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static node_ptr erase(node_ptr header, node_ptr z) + { + typename tree_algorithms::data_for_rebalance info; + tree_algorithms::erase(header, z, avltree_erase_fixup(), info); + node_ptr x = info.x; + node_ptr x_parent = info.x_parent; + + //Rebalance avltree + rebalance_after_erasure(header, x, x_parent); + return z; + } + + //! Requires: "cloner" must be a function + //! object taking a node_ptr and returning a new cloned node of it. "disposer" must + //! take a node_ptr and shouldn't throw. + //! + //! Effects: First empties target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Then, duplicates the entire tree pointed by "source_header" cloning each + //! source node with node_ptr Cloner::operator()(node_ptr) to obtain + //! the nodes of the target tree. If "cloner" throws, the cloned target nodes + //! are disposed using void disposer(node_ptr). + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clone + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer) + { + avltree_node_cloner new_cloner(cloner); + tree_algorithms::clone(source_header, target_header, new_cloner, disposer); + } + + //! Requires: "disposer" must be an object function + //! taking a node_ptr parameter and shouldn't throw. + //! + //! Effects: Empties the target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clear_and_dispose(node_ptr header, Disposer disposer) + { tree_algorithms::clear_and_dispose(header, disposer); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is + //! not less than "key" according to "comp" or "header" if that element does + //! not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr lower_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::lower_bound(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is greater + //! than "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr upper_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::upper_bound(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the element that is equivalent to + //! "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr find + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::find(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an a pair of node_ptr delimiting a range containing + //! all elements that are equivalent to "key" according to "comp" or an + //! empty range that indicates the position where those elements would be + //! if they there are no equivalent elements. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static std::pair equal_range + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::equal_range(header, key, comp); } + + //! Requires: "h" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. + //! + //! Effects: Inserts new_node into the tree before the upper bound + //! according to "comp". + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal_upper_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp) + { + tree_algorithms::insert_equal_upper_bound(h, new_node, comp); + rebalance_after_insertion(h, new_node); + return new_node; + } + + //! Requires: "h" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. + //! + //! Effects: Inserts new_node into the tree before the lower bound + //! according to "comp". + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal_lower_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp) + { + tree_algorithms::insert_equal_lower_bound(h, new_node, comp); + rebalance_after_insertion(h, new_node); + return new_node; + } + + //! Requires: "header" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from + //! the "header"'s tree. + //! + //! Effects: Inserts new_node into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case). + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if new_node is inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp) + { + tree_algorithms::insert_equal(header, hint, new_node, comp); + rebalance_after_insertion(header, new_node); + return new_node; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (const_node_ptr header, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { return tree_algorithms::insert_unique_check(header, key, comp, commit_data); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! "hint" is node from the "header"'s tree. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" using "hint" as a hint to where it should be + //! inserted and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! If "hint" is the upper_bound the function has constant time + //! complexity (two comparisons in the worst case). + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic, but it is + //! amortized constant time if new_node should be inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (const_node_ptr header, node_ptr hint, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data); } + + //! Requires: "header" must be the header node of a tree. + //! "commit_data" must have been obtained from a previous call to + //! "insert_unique_check". No objects should have been inserted or erased + //! from the set between the "insert_unique_check" that filled "commit_data" + //! and the call to "insert_commit". + //! + //! + //! Effects: Inserts new_node in the set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_unique_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + static void insert_unique_commit + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data) + { + tree_algorithms::insert_unique_commit(header, new_value, commit_data); + rebalance_after_insertion(header, new_value); + } + + //! Requires: "n" must be a node inserted in a tree. + //! + //! Effects: Returns a pointer to the header node of the tree. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + static node_ptr get_header(node_ptr n) + { return tree_algorithms::get_header(n); } + + /// @cond + private: + + //! Requires: p is a node of a tree. + //! + //! Effects: Returns true if p is the header of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static bool is_header(const_node_ptr p) + { return NodeTraits::get_balance(p) == NodeTraits::zero() && tree_algorithms::is_header(p); } + + static void rebalance_after_erasure(node_ptr header, node_ptr x, node_ptr x_parent) + { + node_ptr root = NodeTraits::get_parent(header); + while (x != root) { + const balance x_parent_balance = NodeTraits::get_balance(x_parent); + if(x_parent_balance == NodeTraits::zero()){ + NodeTraits::set_balance(x_parent, + (x == NodeTraits::get_right(x_parent) ? NodeTraits::negative() : NodeTraits::positive())); + break; // the height didn't change, let's stop here + } + else if(x_parent_balance == NodeTraits::negative()){ + if (x == NodeTraits::get_left(x_parent)) { + NodeTraits::set_balance(x_parent, NodeTraits::zero()); // balanced + x = x_parent; + x_parent = NodeTraits::get_parent(x_parent); + } + else { + // x is right child + // a is left child + node_ptr a = NodeTraits::get_left(x_parent); + BOOST_INTRUSIVE_INVARIANT_ASSERT(a); + if (NodeTraits::get_balance(a) == NodeTraits::positive()) { + // a MUST have a right child + BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_right(a)); + rotate_left_right(x_parent, root); + + x = NodeTraits::get_parent(x_parent); + x_parent = NodeTraits::get_parent(x); + } + else { + rotate_right(x_parent, root); + x = NodeTraits::get_parent(x_parent); + x_parent = NodeTraits::get_parent(x); + + } + + // if changed from negative to NodeTraits::positive(), no need to check above + if (NodeTraits::get_balance(x) == NodeTraits::positive()){ + break; + } + } + } + else if(x_parent_balance == NodeTraits::positive()){ + if (x == NodeTraits::get_right(x_parent)) { + NodeTraits::set_balance(x_parent, NodeTraits::zero()); // balanced + x = x_parent; + x_parent = NodeTraits::get_parent(x_parent); + } + else { + // x is left child + // a is right child + node_ptr a = NodeTraits::get_right(x_parent); + BOOST_INTRUSIVE_INVARIANT_ASSERT(a); + if (NodeTraits::get_balance(a) == NodeTraits::negative()) { + // a MUST have then a left child + BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_left(a)); + rotate_right_left(x_parent, root); + + x = NodeTraits::get_parent(x_parent); + x_parent = NodeTraits::get_parent(x); + } + else { + rotate_left(x_parent, root); + x = NodeTraits::get_parent(x_parent); + x_parent = NodeTraits::get_parent(x); + } + // if changed from NodeTraits::positive() to negative, no need to check above + if (NodeTraits::get_balance(x) == NodeTraits::negative()){ + break; + } + } + } + else{ + BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached + } + } + NodeTraits::set_parent(header, root); + } + + + static void rebalance_after_insertion(node_ptr header, node_ptr x) + { + node_ptr root = NodeTraits::get_parent(header); + NodeTraits::set_balance(x, NodeTraits::zero()); + + // Rebalance. + while (x != root){ + const balance x_parent_balance = NodeTraits::get_balance(NodeTraits::get_parent(x)); + + if(x_parent_balance == NodeTraits::zero()){ + // if x is left, parent will have parent->bal_factor = negative + // else, parent->bal_factor = NodeTraits::positive() + NodeTraits::set_balance( NodeTraits::get_parent(x) + , x == NodeTraits::get_left(NodeTraits::get_parent(x)) + ? NodeTraits::negative() : NodeTraits::positive() ); + x = NodeTraits::get_parent(x); + } + else if(x_parent_balance == NodeTraits::positive()){ + // if x is a left child, parent->bal_factor = zero + if (x == NodeTraits::get_left(NodeTraits::get_parent(x))) + NodeTraits::set_balance(NodeTraits::get_parent(x), NodeTraits::zero()); + else{ // x is a right child, needs rebalancing + if (NodeTraits::get_balance(x) == NodeTraits::negative()) + rotate_right_left(NodeTraits::get_parent(x), root); + else + rotate_left(NodeTraits::get_parent(x), root); + } + break; + } + else if(x_parent_balance == NodeTraits::negative()){ + // if x is a left child, needs rebalancing + if (x == NodeTraits::get_left(NodeTraits::get_parent(x))) { + if (NodeTraits::get_balance(x) == NodeTraits::positive()) + rotate_left_right(NodeTraits::get_parent(x), root); + else + rotate_right(NodeTraits::get_parent(x), root); + } + else + NodeTraits::set_balance(NodeTraits::get_parent(x), NodeTraits::zero()); + break; + } + else{ + BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached + } + } + NodeTraits::set_parent(header, root); + } + + static void rotate_left_right(node_ptr a, node_ptr &root) + { + // | | // + // a(-2) c // + // / \ / \ // + // / \ ==> / \ // + // (pos)b [g] b a // + // / \ / \ / \ // + // [d] c [d] e f [g] // + // / \ // + // e f // + node_ptr b = NodeTraits::get_left(a), c = NodeTraits::get_right(b); + + // switch + NodeTraits::set_left(a, NodeTraits::get_right(c)); + NodeTraits::set_right(b, NodeTraits::get_left(c)); + + NodeTraits::set_right(c, a); + NodeTraits::set_left(c, b); + + // set the parents + NodeTraits::set_parent(c, NodeTraits::get_parent(a)); + NodeTraits::set_parent(a, c); + NodeTraits::set_parent(b, c); + + if (NodeTraits::get_left(a)) // do we have f? + NodeTraits::set_parent(NodeTraits::get_left(a), a); + if (NodeTraits::get_right(b)) // do we have e? + NodeTraits::set_parent(NodeTraits::get_right(b), b); + + if (a==root) root = c; + else // a had a parent, his child is now c + if (a == NodeTraits::get_left(NodeTraits::get_parent(c))) + NodeTraits::set_left(NodeTraits::get_parent(c), c); + else + NodeTraits::set_right(NodeTraits::get_parent(c), c); + + // balancing... + const balance c_balance = NodeTraits::get_balance(c); + if(c_balance == NodeTraits::negative()){ + NodeTraits::set_balance(a, NodeTraits::positive()); + NodeTraits::set_balance(b, NodeTraits::zero()); + } + else if(c_balance == NodeTraits::zero()){ + NodeTraits::set_balance(a, NodeTraits::zero()); + NodeTraits::set_balance(b, NodeTraits::zero()); + } + else if(c_balance == NodeTraits::positive()){ + NodeTraits::set_balance(a, NodeTraits::zero()); + NodeTraits::set_balance(b, NodeTraits::negative()); + } + else{ + BOOST_INTRUSIVE_INVARIANT_ASSERT(false); // never reached + } + NodeTraits::set_balance(c, NodeTraits::zero()); + } + + static void rotate_right_left(node_ptr a, node_ptr &root) + { + // | | // + // a(pos) c // + // / \ / \ // + // / \ / \ // + // [d] b(neg) ==> a b // + // / \ / \ / \ // + // c [g] [d] e f [g] // + // / \ // + // e f // + node_ptr b = NodeTraits::get_right(a), c = NodeTraits::get_left(b); + + // switch + NodeTraits::set_right(a, NodeTraits::get_left(c)); + NodeTraits::set_left(b, NodeTraits::get_right(c)); + + NodeTraits::set_left(c, a); + NodeTraits::set_right(c, b); + + // set the parents + NodeTraits::set_parent(c, NodeTraits::get_parent(a)); + NodeTraits::set_parent(a, c); + NodeTraits::set_parent(b, c); + + if (NodeTraits::get_right(a)) // do we have e? + NodeTraits::set_parent(NodeTraits::get_right(a), a); + if (NodeTraits::get_left(b)) // do we have f? + NodeTraits::set_parent(NodeTraits::get_left(b), b); + + if (a==root) root = c; + else // a had a parent, his child is now c + if (a == NodeTraits::get_left(NodeTraits::get_parent(c))) + NodeTraits::set_left(NodeTraits::get_parent(c), c); + else + NodeTraits::set_right(NodeTraits::get_parent(c), c); + + // balancing... + const balance c_balance = NodeTraits::get_balance(c); + if(c_balance == NodeTraits::negative()){ + NodeTraits::set_balance(a, NodeTraits::zero()); + NodeTraits::set_balance(b, NodeTraits::positive()); + } + else if(c_balance == NodeTraits::zero()){ + NodeTraits::set_balance(a, NodeTraits::zero()); + NodeTraits::set_balance(b, NodeTraits::zero()); + } + else if(c_balance == NodeTraits::positive()){ + NodeTraits::set_balance(a, NodeTraits::negative()); + NodeTraits::set_balance(b, NodeTraits::zero()); + } + else{ + BOOST_INTRUSIVE_INVARIANT_ASSERT(false); + } + NodeTraits::set_balance(c, NodeTraits::zero()); + } + + static void rotate_left(node_ptr x, node_ptr & root) + { + // | | // + // x(2) y(0) // + // / \ ==> / \ // + // n[a] y(1)n+2 n+1(0)x [c]n+1 // + // / \ / \ // + // n[b] [c]n+1 n[a] [b]n // + node_ptr y = NodeTraits::get_right(x); + + // switch + NodeTraits::set_right(x, NodeTraits::get_left(y)); + NodeTraits::set_left(y, x); + + // rearrange parents + NodeTraits::set_parent(y, NodeTraits::get_parent(x)); + NodeTraits::set_parent(x, y); + + // do we have [b]? + if (NodeTraits::get_right(x)) + NodeTraits::set_parent(NodeTraits::get_right(x), x); + + if (x == root) + root = y; + else + // need to reparent y + if (NodeTraits::get_left(NodeTraits::get_parent(y)) == x) + NodeTraits::set_left(NodeTraits::get_parent(y), y); + else + NodeTraits::set_right(NodeTraits::get_parent(y), y); + + // reset the balancing factor + if (NodeTraits::get_balance(y) == NodeTraits::positive()) { + NodeTraits::set_balance(x, NodeTraits::zero()); + NodeTraits::set_balance(y, NodeTraits::zero()); + } + else { // this doesn't happen during insertions + NodeTraits::set_balance(x, NodeTraits::positive()); + NodeTraits::set_balance(y, NodeTraits::negative()); + } + } + + static void rotate_right(node_ptr x, node_ptr &root) + { + node_ptr y = NodeTraits::get_left(x); + + // switch + NodeTraits::set_left(x, NodeTraits::get_right(y)); + NodeTraits::set_right(y, x); + + // rearrange parents + NodeTraits::set_parent(y, NodeTraits::get_parent(x)); + NodeTraits::set_parent(x, y); + + // do we have [b]? + if (NodeTraits::get_left(x)) + NodeTraits::set_parent(NodeTraits::get_left(x), x); + + if (x == root) + root = y; + else + // need to reparent y + if (NodeTraits::get_left(NodeTraits::get_parent(y)) == x) + NodeTraits::set_left(NodeTraits::get_parent(y), y); + else + NodeTraits::set_right(NodeTraits::get_parent(y), y); + + // reset the balancing factor + if (NodeTraits::get_balance(y) == NodeTraits::negative()) { + NodeTraits::set_balance(x, NodeTraits::zero()); + NodeTraits::set_balance(y, NodeTraits::zero()); + } + else { // this doesn't happen during insertions + NodeTraits::set_balance(x, NodeTraits::negative()); + NodeTraits::set_balance(y, NodeTraits::positive()); + } + } + + /// @endcond +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_AVLTREE_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/bs_set_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/bs_set_hook.hpp new file mode 100644 index 0000000000..d4726b08e4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/bs_set_hook.hpp @@ -0,0 +1,294 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_BS_SET_HOOK_HPP +#define BOOST_INTRUSIVE_BS_SET_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +template +struct get_bs_set_node_algo +{ + typedef detail::tree_algorithms > type; +}; +/// @endcond + +//! Helper metafunction to define a \c bs_set_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_bs_set_base_hook +{ + /// @cond + typedef typename pack_options + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + < hook_defaults, O1, O2, O3> + #else + < hook_defaults, Options...> + #endif + ::type packed_options; + + //Scapegoat trees can't be auto unlink trees + BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink)); + + typedef detail::generic_hook + < get_bs_set_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::BsSetBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from bs_set_base_hook in order to store objects in +//! in a bs_set/bs_multiset. bs_set_base_hook holds the data necessary to maintain +//! the bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<>, +//! \c link_mode<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! unique tag. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class bs_set_base_hook + : public make_bs_set_base_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type + +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + bs_set_base_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + bs_set_base_hook(const bs_set_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + bs_set_base_hook& operator=(const bs_set_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~bs_set_base_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(bs_set_base_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +//! Helper metafunction to define a \c bs_set_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_bs_set_member_hook +{ + /// @cond + typedef typename pack_options + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + < hook_defaults, O1, O2, O3> + #else + < hook_defaults, Options...> + #endif + + ::type packed_options; + + //Scapegoat trees can't be auto unlink trees + BOOST_STATIC_ASSERT(((int)packed_options::link_mode != (int)auto_unlink)); + + typedef detail::generic_hook + < get_bs_set_node_algo + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Put a public data member bs_set_member_hook in order to store objects of this class in +//! a bs_set/bs_multiset. bs_set_member_hook holds the data necessary for maintaining the +//! bs_set/bs_multiset and provides an appropriate value_traits class for bs_set/bs_multiset. +//! +//! The hook admits the following options: \c void_pointer<>, \c link_mode<>. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class bs_set_member_hook + : public make_bs_set_member_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + bs_set_member_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + bs_set_member_hook(const bs_set_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + bs_set_member_hook& operator=(const bs_set_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~bs_set_member_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(bs_set_member_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_BS_SET_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/circular_list_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/circular_list_algorithms.hpp new file mode 100644 index 0000000000..d48fffc076 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/circular_list_algorithms.hpp @@ -0,0 +1,407 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_CIRCULAR_LIST_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_CIRCULAR_LIST_ALGORITHMS_HPP + +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! circular_list_algorithms provides basic algorithms to manipulate nodes +//! forming a circular doubly linked list. An empty circular list is formed by a node +//! whose pointers point to itself. +//! +//! circular_list_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the circular list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! Static functions: +//! +//! static node_ptr get_previous(const_node_ptr n); +//! +//! static void set_previous(node_ptr n, node_ptr prev); +//! +//! static node_ptr get_next(const_node_ptr n); +//! +//! static void set_next(node_ptr n, node_ptr next); +template +class circular_list_algorithms +{ + public: + typedef typename NodeTraits::node node; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef NodeTraits node_traits; + + //! Effects: Constructs an non-used list element, so that + //! inited(this_node) == true + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void init(node_ptr this_node) + { + NodeTraits::set_next(this_node, node_ptr(0)); + NodeTraits::set_previous(this_node, node_ptr(0)); + } + + //! Effects: Returns true is "this_node" is in a non-used state + //! as if it was initialized by the "init" function. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static bool inited(const_node_ptr this_node) + { return !NodeTraits::get_next(this_node); } + + //! Effects: Constructs an empty list, making this_node the only + //! node of the circular list: + //! NodeTraits::get_next(this_node) == NodeTraits::get_previous(this_node) + //! == this_node. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void init_header(node_ptr this_node) + { + NodeTraits::set_next(this_node, this_node); + NodeTraits::set_previous(this_node, this_node); + } + + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Returns true is "this_node" is the only node of a circular list: + //! return NodeTraits::get_next(this_node) == this_node + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static bool unique(const_node_ptr this_node) + { + node_ptr next = NodeTraits::get_next(this_node); + return !next || next == this_node; + } + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Returns the number of nodes in a circular list. If the circular list + //! is empty, returns 1. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr this_node) + { + std::size_t result = 0; + const_node_ptr p = this_node; + do{ + p = NodeTraits::get_next(p); + ++result; + }while (p != this_node); + return result; + } + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Unlinks the node from the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static node_ptr unlink(node_ptr this_node) + { + if(NodeTraits::get_next(this_node)){ + node_ptr next(NodeTraits::get_next(this_node)); + node_ptr prev(NodeTraits::get_previous(this_node)); + NodeTraits::set_next(prev, next); + NodeTraits::set_previous(next, prev); + return next; + } + else{ + return this_node; + } + } + + //! Requires: b and e must be nodes of the same circular list or an empty range. + //! + //! Effects: Unlinks the node [b, e) from the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void unlink(node_ptr b, node_ptr e) + { + if (b != e) { + node_ptr prevb(NodeTraits::get_previous(b)); + NodeTraits::set_previous(e, prevb); + NodeTraits::set_next(prevb, e); + } + } + + //! Requires: nxt_node must be a node of a circular list. + //! + //! Effects: Links this_node before nxt_node in the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void link_before(node_ptr nxt_node, node_ptr this_node) + { + node_ptr prev(NodeTraits::get_previous(nxt_node)); + NodeTraits::set_previous(this_node, prev); + NodeTraits::set_next(prev, this_node); + NodeTraits::set_previous(nxt_node, this_node); + NodeTraits::set_next(this_node, nxt_node); + } + + //! Requires: prev_node must be a node of a circular list. + //! + //! Effects: Links this_node after prev_node in the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void link_after(node_ptr prev_node, node_ptr this_node) + { + node_ptr next(NodeTraits::get_next(prev_node)); + NodeTraits::set_previous(this_node, prev_node); + NodeTraits::set_next(this_node, next); + NodeTraits::set_previous(next, this_node); + NodeTraits::set_next(prev_node, this_node); + } + + //! Requires: this_node and other_node must be nodes inserted + //! in circular lists or be empty circular lists. + //! + //! Effects: Swaps the position of the nodes: this_node is inserted in + //! other_nodes position in the second circular list and the other_node is inserted + //! in this_node's position in the first circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. +/* + static void swap_nodes(node_ptr this_node, node_ptr other_node) + { + + if (other_node == this_node) + return; + bool empty1 = unique(this_node); + bool empty2 = unique(other_node); + + node_ptr next_this(NodeTraits::get_next(this_node)); + node_ptr prev_this(NodeTraits::get_previous(this_node)); + node_ptr next_other(NodeTraits::get_next(other_node)); + node_ptr prev_other(NodeTraits::get_previous(other_node)); + + //Do the swap + NodeTraits::set_next(this_node, next_other); + NodeTraits::set_next(other_node, next_this); + + NodeTraits::set_previous(this_node, prev_other); + NodeTraits::set_previous(other_node, prev_this); + + if (empty2){ + init(this_node); + } + else{ + NodeTraits::set_next(prev_other, this_node); + NodeTraits::set_previous(next_other, this_node); + } + if (empty1){ + init(other_node); + } + else{ + NodeTraits::set_next(prev_this, other_node); + NodeTraits::set_previous(next_this, other_node); + } + } +*/ + + //Watanabe version + private: + static void swap_prev(node_ptr this_node, node_ptr other_node) + { + node_ptr temp(NodeTraits::get_previous(this_node)); + NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node)); + NodeTraits::set_previous(other_node, temp); + } + static void swap_next(node_ptr this_node, node_ptr other_node) + { + node_ptr temp(NodeTraits::get_next(this_node)); + NodeTraits::set_next(this_node, NodeTraits::get_next(other_node)); + NodeTraits::set_next(other_node, temp); + } + + public: + static void swap_nodes(node_ptr this_node, node_ptr other_node) + { + if (other_node == this_node) + return; + bool this_inited = inited(this_node); + bool other_inited = inited(other_node); + if(this_inited){ + init_header(this_node); + } + if(other_inited){ + init_header(other_node); + } + + node_ptr next_this(NodeTraits::get_next(this_node)); + node_ptr prev_this(NodeTraits::get_previous(this_node)); + node_ptr next_other(NodeTraits::get_next(other_node)); + node_ptr prev_other(NodeTraits::get_previous(other_node)); + //these first two swaps must happen before the other two + swap_prev(next_this, next_other); + swap_next(prev_this, prev_other); + swap_next(this_node, other_node); + swap_prev(this_node, other_node); + + if(this_inited){ + init(other_node); + } + if(other_inited){ + init(this_node); + } + } + + //! Requires: b and e must be nodes of the same circular list or an empty range. + //! and p must be a node of a different circular list or may not be an iterator in + // [b, e). + //! + //! Effects: Removes the nodes from [b, e) range from their circular list and inserts + //! them before p in p's circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void transfer(node_ptr p, node_ptr b, node_ptr e) + { + if (b != e) { + node_ptr prev_p(NodeTraits::get_previous(p)); + node_ptr prev_b(NodeTraits::get_previous(b)); + node_ptr prev_e(NodeTraits::get_previous(e)); + NodeTraits::set_next(prev_e, p); + NodeTraits::set_previous(p, prev_e); + NodeTraits::set_next(prev_b, e); + NodeTraits::set_previous(e, prev_b); + NodeTraits::set_next(prev_p, b); + NodeTraits::set_previous(b, prev_p); + } + } + + //! Requires: i must a node of a circular list + //! and p must be a node of a different circular list. + //! + //! Effects: Removes the node i from its circular list and inserts + //! it before p in p's circular list. + //! If p == i or p == NodeTraits::get_next(i), this function is a null operation. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void transfer(node_ptr p, node_ptr i) + { + node_ptr n(NodeTraits::get_next(i)); + if(n != p && i != p){ + node_ptr prev_p(NodeTraits::get_previous(p)); + node_ptr prev_i(NodeTraits::get_previous(i)); + NodeTraits::set_next(prev_p, i); + NodeTraits::set_previous(i, prev_p); + NodeTraits::set_next(i, p); + NodeTraits::set_previous(p, i); + NodeTraits::set_previous(n, prev_i); + NodeTraits::set_next(prev_i, n); + + } + } + + //! Effects: Reverses the order of elements in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: This function is linear time. + static void reverse(node_ptr p) + { + node_ptr f(NodeTraits::get_next(p)); + node_ptr i(NodeTraits::get_next(f)), e(p); + + while(i != e) { + node_ptr n = i; + i = NodeTraits::get_next(i); + transfer(f, n, i); + f = n; + } + } + + //! Effects: Moves the node p n positions towards the end of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of moved positions. + static void move_backwards(node_ptr p, std::size_t n) + { + //Null shift, nothing to do + if(!n) return; + node_ptr first = NodeTraits::get_next(p); + //size() == 0 or 1, nothing to do + if(first == NodeTraits::get_previous(p)) return; + unlink(p); + //Now get the new first node + while(n--){ + first = NodeTraits::get_next(first); + } + link_before(first, p); + } + + //! Effects: Moves the node p n positions towards the beginning of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of moved positions. + static void move_forward(node_ptr p, std::size_t n) + { + //Null shift, nothing to do + if(!n) return; + node_ptr last = NodeTraits::get_previous(p); + //size() == 0 or 1, nothing to do + if(last == NodeTraits::get_next(p)) return; + + unlink(p); + //Now get the new last node + while(n--){ + last = NodeTraits::get_previous(last); + } + link_after(last, p); + } +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_CIRCULAR_LIST_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/circular_slist_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/circular_slist_algorithms.hpp new file mode 100644 index 0000000000..5247f57e87 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/circular_slist_algorithms.hpp @@ -0,0 +1,405 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_CIRCULAR_SLIST_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_CIRCULAR_SLIST_ALGORITHMS_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! circular_slist_algorithms provides basic algorithms to manipulate nodes +//! forming a circular singly linked list. An empty circular list is formed by a node +//! whose pointer to the next node points to itself. +//! +//! circular_slist_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the circular list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! Static functions: +//! +//! static node_ptr get_next(const_node_ptr n); +//! +//! static void set_next(node_ptr n, node_ptr next); +template +class circular_slist_algorithms + /// @cond + : public detail::common_slist_algorithms + /// @endcond +{ + /// @cond + typedef detail::common_slist_algorithms base_t; + /// @endcond + public: + typedef typename NodeTraits::node node; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef NodeTraits node_traits; + + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + + //! Effects: Constructs an non-used list element, putting the next + //! pointer to null: + //! NodeTraits::get_next(this_node) == 0 + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void init(node_ptr this_node); + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Returns true is "this_node" is the only node of a circular list: + //! or it's a not inserted node: + //! return !NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static bool unique(const_node_ptr this_node); + + //! Effects: Returns true is "this_node" has the same state as + //! if it was inited using "init(node_ptr)" + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static bool inited(const_node_ptr this_node); + + //! Requires: prev_node must be in a circular list or be an empty circular list. + //! + //! Effects: Unlinks the next node of prev_node from the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void unlink_after(node_ptr prev_node); + + //! Requires: prev_node and last_node must be in a circular list + //! or be an empty circular list. + //! + //! Effects: Unlinks the range (prev_node, last_node) from the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void unlink_after(node_ptr prev_node, node_ptr last_node); + + //! Requires: prev_node must be a node of a circular list. + //! + //! Effects: Links this_node after prev_node in the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void link_after(node_ptr prev_node, node_ptr this_node); + + //! Requires: b and e must be nodes of the same circular list or an empty range. + //! and p must be a node of a different circular list. + //! + //! Effects: Removes the nodes from (b, e] range from their circular list and inserts + //! them after p in p's circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void transfer_after(node_ptr p, node_ptr b, node_ptr e); + + #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + + //! Effects: Constructs an empty list, making this_node the only + //! node of the circular list: + //! NodeTraits::get_next(this_node) == this_node. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void init_header(node_ptr this_node) + { NodeTraits::set_next(this_node, this_node); } + + //! Requires: this_node and prev_init_node must be in the same circular list. + //! + //! Effects: Returns the previous node of this_node in the circular list starting. + //! the search from prev_init_node. The first node checked for equality + //! is NodeTraits::get_next(prev_init_node). + //! + //! Complexity: Linear to the number of elements between prev_init_node and this_node. + //! + //! Throws: Nothing. + static node_ptr get_previous_node(node_ptr prev_init_node, node_ptr this_node) + { return base_t::get_previous_node(prev_init_node, this_node); } + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Returns the previous node of this_node in the circular list. + //! + //! Complexity: Linear to the number of elements in the circular list. + //! + //! Throws: Nothing. + static node_ptr get_previous_node(node_ptr this_node) + { return base_t::get_previous_node(this_node, this_node); } + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Returns the previous node of the previous node of this_node in the circular list. + //! + //! Complexity: Linear to the number of elements in the circular list. + //! + //! Throws: Nothing. + static node_ptr get_previous_previous_node(node_ptr this_node) + { return get_previous_previous_node(this_node, this_node); } + + //! Requires: this_node and prev_prev_init_node must be in the same circular list. + //! + //! Effects: Returns the previous node of the previous node of this_node in the + //! circular list starting. the search from prev_init_node. The first node checked + //! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)). + //! + //! Complexity: Linear to the number of elements in the circular list. + //! + //! Throws: Nothing. + static node_ptr get_previous_previous_node(node_ptr prev_prev_init_node, node_ptr this_node) + { + node_ptr p = prev_prev_init_node; + node_ptr p_next = NodeTraits::get_next(p); + node_ptr p_next_next = NodeTraits::get_next(p_next); + while (this_node != p_next_next){ + p = p_next; + p_next = p_next_next; + p_next_next = NodeTraits::get_next(p_next); + } + return p; + } + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Returns the number of nodes in a circular list. If the circular list + //! is empty, returns 1. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr this_node) + { + std::size_t result = 0; + const_node_ptr p = this_node; + do{ + p = NodeTraits::get_next(p); + ++result; + } while (p != this_node); + return result; + } + + //! Requires: this_node must be in a circular list, be an empty circular list or be inited. + //! + //! Effects: Unlinks the node from the circular list. + //! + //! Complexity: Linear to the number of elements in the circular list + //! + //! Throws: Nothing. + static void unlink(node_ptr this_node) + { + if(NodeTraits::get_next(this_node)) + base_t::unlink_after(get_previous_node(this_node)); + } + + //! Requires: nxt_node must be a node of a circular list. + //! + //! Effects: Links this_node before nxt_node in the circular list. + //! + //! Complexity: Linear to the number of elements in the circular list. + //! + //! Throws: Nothing. + static void link_before (node_ptr nxt_node, node_ptr this_node) + { base_t::link_after(get_previous_node(nxt_node), this_node); } + + //! Requires: this_node and other_node must be nodes inserted + //! in circular lists or be empty circular lists. + //! + //! Effects: Swaps the position of the nodes: this_node is inserted in + //! other_nodes position in the second circular list and the other_node is inserted + //! in this_node's position in the first circular list. + //! + //! Complexity: Linear to number of elements of both lists + //! + //! Throws: Nothing. + static void swap_nodes(node_ptr this_node, node_ptr other_node) + { + if (other_node == this_node) + return; + bool this_inited = base_t::inited(this_node); + bool other_inited = base_t::inited(other_node); + if(this_inited){ + base_t::init_header(this_node); + } + if(other_inited){ + base_t::init_header(other_node); + } + + bool empty1 = base_t::unique(this_node); + bool empty2 = base_t::unique(other_node); + node_ptr prev_this (get_previous_node(this_node)); + node_ptr prev_other(get_previous_node(other_node)); + + node_ptr this_next (NodeTraits::get_next(this_node)); + node_ptr other_next(NodeTraits::get_next(other_node)); + NodeTraits::set_next(this_node, other_next); + NodeTraits::set_next(other_node, this_next); + NodeTraits::set_next(empty1 ? other_node : prev_this, other_node); + NodeTraits::set_next(empty2 ? this_node : prev_other, this_node); + + if(this_inited){ + base_t::init(other_node); + } + if(other_inited){ + base_t::init(this_node); + } + } + + //! Effects: Reverses the order of elements in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: This function is linear to the contained elements. + static void reverse(node_ptr p) + { + node_ptr i = NodeTraits::get_next(p), e(p); + for (;;) { + node_ptr nxt(NodeTraits::get_next(i)); + if (nxt == e) + break; + base_t::transfer_after(e, i, nxt); + } + } + + //! Effects: Moves the node p n positions towards the end of the list. + //! + //! Returns: The previous node of p after the function if there has been any movement, + //! Null if n leads to no movement. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements plus the number moved positions. + static node_ptr move_backwards(node_ptr p, std::size_t n) + { + //Null shift, nothing to do + if(!n) return node_ptr(0); + node_ptr first = NodeTraits::get_next(p); + + //count() == 1 or 2, nothing to do + if(NodeTraits::get_next(first) == p) + return node_ptr(0); + + bool end_found = false; + node_ptr new_last(0); + + //Now find the new last node according to the shift count. + //If we find p before finding the new last node + //unlink p, shortcut the search now that we know the size of the list + //and continue. + for(std::size_t i = 1; i <= n; ++i){ + new_last = first; + first = NodeTraits::get_next(first); + if(first == p){ + //Shortcut the shift with the modulo of the size of the list + n %= i; + if(!n) + return node_ptr(0); + i = 0; + //Unlink p and continue the new first node search + first = NodeTraits::get_next(p); + base_t::unlink_after(new_last); + end_found = true; + } + } + + //If the p has not been found in the previous loop, find it + //starting in the new first node and unlink it + if(!end_found){ + base_t::unlink_after(base_t::get_previous_node(first, p)); + } + + //Now link p after the new last node + base_t::link_after(new_last, p); + return new_last; + } + + //! Effects: Moves the node p n positions towards the beginning of the list. + //! + //! Returns: The previous node of p after the function if there has been any movement, + //! Null if n leads equals to no movement. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements plus the number moved positions. + static node_ptr move_forward(node_ptr p, std::size_t n) + { + //Null shift, nothing to do + if(!n) return node_ptr(0); + node_ptr first = node_traits::get_next(p); + + //count() == 1 or 2, nothing to do + if(node_traits::get_next(first) == p) return node_ptr(0); + + //Iterate until p is found to know where the current last node is. + //If the shift count is less than the size of the list, we can also obtain + //the position of the new last node after the shift. + node_ptr old_last(first), next_to_it, new_last(p); + std::size_t distance = 1; + while(p != (next_to_it = node_traits::get_next(old_last))){ + if(++distance > n) + new_last = node_traits::get_next(new_last); + old_last = next_to_it; + } + //If the shift was bigger or equal than the size, obtain the equivalent + //forward shifts and find the new last node. + if(distance <= n){ + //Now find the equivalent forward shifts. + //Shortcut the shift with the modulo of the size of the list + std::size_t new_before_last_pos = (distance - (n % distance))% distance; + //If the shift is a multiple of the size there is nothing to do + if(!new_before_last_pos) return node_ptr(0); + + for( new_last = p + ; new_before_last_pos-- + ; new_last = node_traits::get_next(new_last)){ + //empty + } + } + + //Now unlink p and link it after the new last node + base_t::unlink_after(old_last); + base_t::link_after(new_last, p); + return new_last; + } +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_CIRCULAR_SLIST_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/derivation_value_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/derivation_value_traits.hpp new file mode 100644 index 0000000000..2036890105 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/derivation_value_traits.hpp @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP +#define BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP + +#include +#include + +namespace boost { +namespace intrusive { + +//!This value traits template is used to create value traits +//!from user defined node traits where value_traits::value_type will +//!derive from node_traits::node +template +struct derivation_value_traits +{ + public: + typedef NodeTraits node_traits; + typedef T value_type; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename boost::pointer_to_other::type pointer; + typedef typename boost::pointer_to_other::type const_pointer; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + static const link_mode_type link_mode = LinkMode; + + static node_ptr to_node_ptr(reference value) + { return node_ptr(&value); } + + static const_node_ptr to_node_ptr(const_reference value) + { return node_ptr(&value); } + + static pointer to_value_ptr(node_ptr n) + { return pointer(static_cast(detail::get_pointer(n))); } + + static const_pointer to_value_ptr(const_node_ptr n) + { return const_pointer(static_cast(detail::get_pointer(n))); } +}; + +} //namespace intrusive +} //namespace boost + +#endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/any_node_and_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/any_node_and_algorithms.hpp new file mode 100644 index 0000000000..6a3d955a8c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/any_node_and_algorithms.hpp @@ -0,0 +1,296 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2008 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_ANY_NODE_HPP +#define BOOST_INTRUSIVE_ANY_NODE_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +template +struct any_node +{ + typedef typename boost::pointer_to_other + ::type node_ptr; + node_ptr node_ptr_1; + node_ptr node_ptr_2; + node_ptr node_ptr_3; + std::size_t size_t_1; +}; + +template +struct any_list_node_traits +{ + typedef any_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + static node_ptr get_next(const_node_ptr n) + { return n->node_ptr_1; } + + static void set_next(node_ptr n, node_ptr next) + { n->node_ptr_1 = next; } + + static node_ptr get_previous(const_node_ptr n) + { return n->node_ptr_2; } + + static void set_previous(node_ptr n, node_ptr prev) + { n->node_ptr_2 = prev; } +}; + + +template +struct any_slist_node_traits +{ + typedef any_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + static node_ptr get_next(const_node_ptr n) + { return n->node_ptr_1; } + + static void set_next(node_ptr n, node_ptr next) + { n->node_ptr_1 = next; } +}; + + +template +struct any_unordered_node_traits + : public any_slist_node_traits +{ + typedef any_slist_node_traits reduced_slist_node_traits; + typedef typename reduced_slist_node_traits::node node; + typedef typename reduced_slist_node_traits::node_ptr node_ptr; + typedef typename reduced_slist_node_traits::const_node_ptr const_node_ptr; + + static const bool store_hash = true; + static const bool optimize_multikey = true; + + static node_ptr get_next(const_node_ptr n) + { return node_ptr(&static_cast(*n->node_ptr_1)); } + + static void set_next(node_ptr n, node_ptr next) + { n->node_ptr_1 = next; } + + static node_ptr get_prev_in_group(const_node_ptr n) + { return n->node_ptr_2; } + + static void set_prev_in_group(node_ptr n, node_ptr prev) + { n->node_ptr_2 = prev; } + + static std::size_t get_hash(const_node_ptr n) + { return n->size_t_1; } + + static void set_hash(node_ptr n, std::size_t h) + { n->size_t_1 = h; } +}; + + +template +struct any_rbtree_node_traits +{ + typedef any_node node; + + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + typedef std::size_t color; + + static node_ptr get_parent(const_node_ptr n) + { return n->node_ptr_1; } + + static void set_parent(node_ptr n, node_ptr p) + { n->node_ptr_1 = p; } + + static node_ptr get_left(const_node_ptr n) + { return n->node_ptr_2; } + + static void set_left(node_ptr n, node_ptr l) + { n->node_ptr_2 = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->node_ptr_3; } + + static void set_right(node_ptr n, node_ptr r) + { n->node_ptr_3 = r; } + + static color get_color(const_node_ptr n) + { return n->size_t_1; } + + static void set_color(node_ptr n, color c) + { n->size_t_1 = c; } + + static color black() + { return 0u; } + + static color red() + { return 1u; } +}; + + +template +struct any_avltree_node_traits +{ + typedef any_node node; + + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef std::size_t balance; + + static node_ptr get_parent(const_node_ptr n) + { return n->node_ptr_1; } + + static void set_parent(node_ptr n, node_ptr p) + { n->node_ptr_1 = p; } + + static node_ptr get_left(const_node_ptr n) + { return n->node_ptr_2; } + + static void set_left(node_ptr n, node_ptr l) + { n->node_ptr_2 = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->node_ptr_3; } + + static void set_right(node_ptr n, node_ptr r) + { n->node_ptr_3 = r; } + + static balance get_balance(const_node_ptr n) + { return n->size_t_1; } + + static void set_balance(node_ptr n, balance b) + { n->size_t_1 = b; } + + static balance negative() + { return 0u; } + + static balance zero() + { return 1u; } + + static balance positive() + { return 2u; } +}; + + +template +struct any_tree_node_traits +{ + typedef any_node node; + + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + static node_ptr get_parent(const_node_ptr n) + { return n->node_ptr_1; } + + static void set_parent(node_ptr n, node_ptr p) + { n->node_ptr_1 = p; } + + static node_ptr get_left(const_node_ptr n) + { return n->node_ptr_2; } + + static void set_left(node_ptr n, node_ptr l) + { n->node_ptr_2 = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->node_ptr_3; } + + static void set_right(node_ptr n, node_ptr r) + { n->node_ptr_3 = r; } +}; + +template +class any_node_traits +{ + public: + typedef any_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; +}; + +template +class any_algorithms +{ + template + static void function_not_available_for_any_hooks(typename detail::enable_if >::type) + {} + + public: + typedef any_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef any_node_traits node_traits; + + //! Requires: node must not be part of any tree. + //! + //! Effects: After the function unique(node) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init(node_ptr node) + { node->node_ptr_1 = 0; }; + + //! Effects: Returns true if node is in the same state as if called init(node) + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static bool inited(const_node_ptr node) + { return !node->node_ptr_1; }; + + static bool unique(const_node_ptr node) + { return 0 == node->node_ptr_1; } + + static void unlink(node_ptr) + { + //Auto-unlink hooks and unlink() are not available for any hooks + any_algorithms::template function_not_available_for_any_hooks(); + } + + static void swap_nodes(node_ptr l, node_ptr r) + { + //Any nodes have no swap_nodes capability because they don't know + //what algorithm they must use to unlink the node from the container + any_algorithms::template function_not_available_for_any_hooks(); + } +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_ANY_NODE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/assert.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/assert.hpp new file mode 100644 index 0000000000..e742b7e97e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/assert.hpp @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_ASSERT_HPP +#define BOOST_INTRUSIVE_DETAIL_ASSERT_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#if !defined(BOOST_INTRUSIVE_INVARIANT_ASSERT) + #include + #define BOOST_INTRUSIVE_INVARIANT_ASSERT BOOST_ASSERT +#elif defined(BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE) + #include BOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDE +#endif + +#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT) + #include + #define BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT BOOST_ASSERT +#elif defined(BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE) + #include BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT_INCLUDE +#endif + +#if !defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT) + #include + #define BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT BOOST_ASSERT +#elif defined(BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE) + #include BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT_INCLUDE +#endif + +#endif //BOOST_INTRUSIVE_DETAIL_ASSERT_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/avltree_node.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/avltree_node.hpp new file mode 100644 index 0000000000..92458a4371 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/avltree_node.hpp @@ -0,0 +1,179 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_AVLTREE_NODE_HPP +#define BOOST_INTRUSIVE_AVLTREE_NODE_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +///////////////////////////////////////////////////////////////////////////// +// // +// Generic node_traits for any pointer type // +// // +///////////////////////////////////////////////////////////////////////////// + +//This is the compact representation: 3 pointers +template +struct compact_avltree_node +{ + typedef typename pointer_to_other + >::type node_ptr; + enum balance { negative_t, zero_t, positive_t }; + node_ptr parent_, left_, right_; +}; + +//This is the normal representation: 3 pointers + enum +template +struct avltree_node +{ + typedef typename pointer_to_other + >::type node_ptr; + enum balance { negative_t, zero_t, positive_t }; + node_ptr parent_, left_, right_; + balance balance_; +}; + +//This is the default node traits implementation +//using a node with 3 generic pointers plus an enum +template +struct default_avltree_node_traits_impl +{ + typedef avltree_node node; + + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef typename node::balance balance; + + static node_ptr get_parent(const_node_ptr n) + { return n->parent_; } + + static void set_parent(node_ptr n, node_ptr p) + { n->parent_ = p; } + + static node_ptr get_left(const_node_ptr n) + { return n->left_; } + + static void set_left(node_ptr n, node_ptr l) + { n->left_ = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->right_; } + + static void set_right(node_ptr n, node_ptr r) + { n->right_ = r; } + + static balance get_balance(const_node_ptr n) + { return n->balance_; } + + static void set_balance(node_ptr n, balance b) + { n->balance_ = b; } + + static balance negative() + { return node::negative_t; } + + static balance zero() + { return node::zero_t; } + + static balance positive() + { return node::positive_t; } +}; + +//This is the compact node traits implementation +//using a node with 3 generic pointers +template +struct compact_avltree_node_traits_impl +{ + typedef compact_avltree_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef typename node::balance balance; + + typedef pointer_plus_bits ptr_bit; + + static node_ptr get_parent(const_node_ptr n) + { return ptr_bit::get_pointer(n->parent_); } + + static void set_parent(node_ptr n, node_ptr p) + { ptr_bit::set_pointer(n->parent_, p); } + + static node_ptr get_left(const_node_ptr n) + { return n->left_; } + + static void set_left(node_ptr n, node_ptr l) + { n->left_ = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->right_; } + + static void set_right(node_ptr n, node_ptr r) + { n->right_ = r; } + + static balance get_balance(const_node_ptr n) + { return (balance)ptr_bit::get_bits(n->parent_); } + + static void set_balance(node_ptr n, balance b) + { ptr_bit::set_bits(n->parent_, (std::size_t)b); } + + static balance negative() + { return node::negative_t; } + + static balance zero() + { return node::zero_t; } + + static balance positive() + { return node::positive_t; } +}; + +//Dispatches the implementation based on the boolean +template +struct avltree_node_traits_dispatch + : public default_avltree_node_traits_impl +{}; + +template +struct avltree_node_traits_dispatch + : public compact_avltree_node_traits_impl +{}; + +//Inherit from the detail::link_dispatch depending on the embedding capabilities +template +struct avltree_node_traits + : public avltree_node_traits_dispatch + < VoidPointer + , OptimizeSize && + max_pointer_plus_bits + < VoidPointer + , detail::alignment_of >::value + >::value >= 2u + > +{}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_AVLTREE_NODE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/common_slist_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/common_slist_algorithms.hpp new file mode 100644 index 0000000000..d837ad0a0d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/common_slist_algorithms.hpp @@ -0,0 +1,96 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007-2008 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { +namespace detail { + +template +class common_slist_algorithms +{ + public: + typedef typename NodeTraits::node node; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef NodeTraits node_traits; + + static node_ptr get_previous_node(node_ptr prev_init_node, node_ptr this_node) + { + node_ptr p = prev_init_node; + for( node_ptr p_next + ; this_node != (p_next = NodeTraits::get_next(p)) + ; p = p_next){ + //Logic error: possible use of linear lists with + //operations only permitted with lists + BOOST_INTRUSIVE_INVARIANT_ASSERT(p); + } + return p; + } + + static void init_header(node_ptr this_node) + { NodeTraits::set_next(this_node, this_node); } + + static void init(node_ptr this_node) + { NodeTraits::set_next(this_node, node_ptr(0)); } + + static bool unique(const_node_ptr this_node) + { + node_ptr next = NodeTraits::get_next(this_node); + return !next || next == this_node; + } + + static bool inited(const_node_ptr this_node) + { return !NodeTraits::get_next(this_node); } + + static void unlink_after(node_ptr prev_node) + { + node_ptr this_node(NodeTraits::get_next(prev_node)); + NodeTraits::set_next(prev_node, NodeTraits::get_next(this_node)); + } + + static void unlink_after(node_ptr prev_node, node_ptr last_node) + { NodeTraits::set_next(prev_node, last_node); } + + static void link_after(node_ptr prev_node, node_ptr this_node) + { + NodeTraits::set_next(this_node, NodeTraits::get_next(prev_node)); + NodeTraits::set_next(prev_node, this_node); + } + + static void transfer_after(node_ptr p, node_ptr b, node_ptr e) + { + if (p != b && p != e && b != e) { + node_ptr next_b = NodeTraits::get_next(b); + node_ptr next_e = NodeTraits::get_next(e); + node_ptr next_p = NodeTraits::get_next(p); + NodeTraits::set_next(b, next_e); + NodeTraits::set_next(e, next_p); + NodeTraits::set_next(p, next_b); + } + } +}; + +} //namespace detail +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_COMMON_SLIST_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/config_begin.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/config_begin.hpp new file mode 100644 index 0000000000..411b8aec70 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/config_begin.hpp @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_CONFIG_INCLUDED +#define BOOST_INTRUSIVE_CONFIG_INCLUDED +#include +#endif + +#ifdef BOOST_MSVC + + #pragma warning (push) + // + //'function' : resolved overload was found by argument-dependent lookup + //A function found by argument-dependent lookup (Koenig lookup) was eventually + //chosen by overload resolution. + // + //In Visual C++ .NET and earlier compilers, a different function would have + //been called. To pick the original function, use an explicitly qualified name. + // + + //warning C4275: non dll-interface class 'x' used as base for + //dll-interface class 'Y' + #pragma warning (disable : 4275) + //warning C4251: 'x' : class 'y' needs to have dll-interface to + //be used by clients of class 'z' + #pragma warning (disable : 4251) + #pragma warning (disable : 4675) + #pragma warning (disable : 4996) + #pragma warning (disable : 4503) + #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4244) // possible loss of data + #pragma warning (disable : 4521) ////Disable "multiple copy constructors specified" + #pragma warning (disable : 4522) + #pragma warning (disable : 4146) + #pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data + #pragma warning (disable : 4127) //conditional expression is constant + #pragma warning (disable : 4706) //assignment within conditional expression +#endif + +//#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE +//#define BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/config_end.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/config_end.hpp new file mode 100644 index 0000000000..703d038225 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/config_end.hpp @@ -0,0 +1,15 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#if defined BOOST_MSVC + #pragma warning (pop) +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/ebo_functor_holder.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/ebo_functor_holder.hpp new file mode 100644 index 0000000000..369d2ca939 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/ebo_functor_holder.hpp @@ -0,0 +1,92 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Joaquin M Lopez Munoz 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP +#define BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP + +#include + +namespace boost { +namespace intrusive { +namespace detail { + +template +class ebo_functor_holder_impl +{ + public: + ebo_functor_holder_impl() + {} + ebo_functor_holder_impl(const T& t) + : t(t) + {} + template + ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2) + : t(arg1, arg2) + {} + + T& get(){return t;} + const T& get()const{return t;} + + private: + T t; +}; + +template +class ebo_functor_holder_impl + : public T +{ + public: + ebo_functor_holder_impl() + {} + ebo_functor_holder_impl(const T& t) + : T(t) + {} + template + ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2) + : T(arg1, arg2) + {} + + T& get(){return *this;} + const T& get()const{return *this;} +}; + +template +class ebo_functor_holder + : public ebo_functor_holder_impl::value> +{ + private: + typedef ebo_functor_holder_impl::value> super; + + public: + ebo_functor_holder(){} + ebo_functor_holder(const T& t) + : super(t) + {} + + template + ebo_functor_holder(const Arg1& arg1, const Arg2& arg2) + : super(arg1, arg2) + {} + + ebo_functor_holder& operator=(const ebo_functor_holder& x) + { + this->get()=x.get(); + return *this; + } +}; + + +} //namespace detail { +} //namespace intrusive { +} //namespace boost { + +#endif //#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/generic_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/generic_hook.hpp new file mode 100644 index 0000000000..837f928080 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/generic_hook.hpp @@ -0,0 +1,203 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_GENERIC_HOOK_HPP +#define BOOST_INTRUSIVE_GENERIC_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { +namespace detail { + +/// @cond + +enum +{ NoBaseHook +, ListBaseHook +, SlistBaseHook +, SetBaseHook +, UsetBaseHook +, SplaySetBaseHook +, AvlSetBaseHook +, BsSetBaseHook +, AnyBaseHook +}; + +struct no_default_definer{}; + +template +struct default_definer; + +template +struct default_definer +{ typedef Hook default_list_hook; }; + +template +struct default_definer +{ typedef Hook default_slist_hook; }; + +template +struct default_definer +{ typedef Hook default_set_hook; }; + +template +struct default_definer +{ typedef Hook default_uset_hook; }; + +template +struct default_definer +{ typedef Hook default_splay_set_hook; }; + +template +struct default_definer +{ typedef Hook default_avl_set_hook; }; + +template +struct default_definer +{ typedef Hook default_bs_set_hook; }; + +template +struct default_definer +{ typedef Hook default_any_hook; }; + +template +struct make_default_definer +{ + typedef typename detail::if_c + < BaseHookType != 0 + , default_definer + , no_default_definer>::type type; +}; + +template + < class GetNodeAlgorithms + , class Tag + , link_mode_type LinkMode + , int HookType + > +struct make_node_holder +{ + typedef typename detail::if_c + ::value + , detail::node_holder + < typename GetNodeAlgorithms::type::node + , Tag + , LinkMode + , HookType> + , typename GetNodeAlgorithms::type::node + >::type type; +}; + +/// @endcond + +template + < class GetNodeAlgorithms + , class Tag + , link_mode_type LinkMode + , int HookType + > +class generic_hook + /// @cond + + //If the hook is a base hook, derive generic hook from detail::node_holder + //so that a unique base class is created to convert from the node + //to the type. This mechanism will be used by base_hook_traits. + // + //If the hook is a member hook, generic hook will directly derive + //from the hook. + : public make_default_definer + < generic_hook + , detail::is_same::value*HookType + >::type + , public make_node_holder::type + /// @endcond +{ + /// @cond + typedef typename GetNodeAlgorithms::type node_algorithms; + typedef typename node_algorithms::node node; + typedef typename node_algorithms::node_ptr node_ptr; + typedef typename node_algorithms::const_node_ptr const_node_ptr; + + public: + struct boost_intrusive_tags + { + static const int hook_type = HookType; + static const link_mode_type link_mode = LinkMode; + typedef Tag tag; + typedef typename GetNodeAlgorithms::type::node_traits node_traits; + static const bool is_base_hook = !detail::is_same::value; + static const bool safemode_or_autounlink = + (int)link_mode == (int)auto_unlink || (int)link_mode == (int)safe_link; + }; + + public: + /// @endcond + + generic_hook() + { + if(boost_intrusive_tags::safemode_or_autounlink){ + node_algorithms::init(static_cast(this)); + } + } + + generic_hook(const generic_hook& ) + { + if(boost_intrusive_tags::safemode_or_autounlink){ + node_algorithms::init(static_cast(this)); + } + } + + generic_hook& operator=(const generic_hook& ) + { return *this; } + + ~generic_hook() + { + destructor_impl + (*this, detail::link_dispatch()); + } + + void swap_nodes(generic_hook &other) + { + node_algorithms::swap_nodes + ( static_cast(this), static_cast(&other)); + } + + bool is_linked() const + { + //is_linked() can be only used in safe-mode or auto-unlink + BOOST_STATIC_ASSERT(( boost_intrusive_tags::safemode_or_autounlink )); + return !node_algorithms::unique + (static_cast(this)); + } + + void unlink() + { + BOOST_STATIC_ASSERT(( (int)boost_intrusive_tags::link_mode == (int)auto_unlink )); + node_algorithms::unlink(static_cast(this)); + node_algorithms::init(static_cast(this)); + } +}; + +} //namespace detail +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_GENERIC_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/hashtable_node.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/hashtable_node.hpp new file mode 100644 index 0000000000..44a5f5a90f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/hashtable_node.hpp @@ -0,0 +1,200 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_HASHTABLE_NODE_HPP +#define BOOST_INTRUSIVE_HASHTABLE_NODE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include //remove-me +#include + +namespace boost { +namespace intrusive { +namespace detail { + +template +struct prime_list_holder +{ + static const std::size_t prime_list[]; + static const std::size_t prime_list_size; +}; + +template +const std::size_t prime_list_holder::prime_list[] = { + 53ul, 97ul, 193ul, 389ul, 769ul, + 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, + 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, + 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, + 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, + 1610612741ul, 3221225473ul, 4294967291ul }; + +template +const std::size_t prime_list_holder::prime_list_size + = sizeof(prime_list)/sizeof(std::size_t); + +template +struct bucket_impl : public Slist +{ + typedef Slist slist_type; + bucket_impl() + {} + + bucket_impl(const bucket_impl &) + {} + + ~bucket_impl() + { + //This bucket is still being used! + BOOST_INTRUSIVE_INVARIANT_ASSERT(Slist::empty()); + } + + bucket_impl &operator=(const bucket_impl&) + { + //This bucket is still in use! + BOOST_INTRUSIVE_INVARIANT_ASSERT(Slist::empty()); + //Slist::clear(); + return *this; + } +}; + +template +struct bucket_traits_impl +{ + /// @cond + typedef typename boost::pointer_to_other + < typename Slist::pointer, bucket_impl >::type bucket_ptr; + typedef typename Slist::size_type size_type; + /// @endcond + + bucket_traits_impl(bucket_ptr buckets, size_type len) + : buckets_(buckets), buckets_len_(len) + {} + + bucket_ptr bucket_begin() const + { return buckets_; } + + size_type bucket_count() const + { return buckets_len_; } + + private: + bucket_ptr buckets_; + size_type buckets_len_; +}; + +template +class hashtable_iterator + : public std::iterator + < std::forward_iterator_tag + , typename detail::add_const_if_c + ::type + > +{ + typedef typename Container::real_value_traits real_value_traits; + typedef typename Container::siterator siterator; + typedef typename Container::const_siterator const_siterator; + typedef typename Container::bucket_type bucket_type; + typedef typename boost::pointer_to_other + < typename Container::pointer, const Container>::type const_cont_ptr; + typedef typename Container::size_type size_type; + + static typename Container::node_ptr downcast_bucket(typename bucket_type::node_ptr p) + { return typename Container::node_ptr(&static_cast(*p)); } + + public: + typedef typename detail::add_const_if_c + ::type value_type; + + hashtable_iterator () + {} + + explicit hashtable_iterator(siterator ptr, const Container *cont) + : slist_it_ (ptr), cont_ (cont) + {} + + hashtable_iterator(const hashtable_iterator &other) + : slist_it_(other.slist_it()), cont_(other.get_container()) + {} + + const siterator &slist_it() const + { return slist_it_; } + + public: + hashtable_iterator& operator++() + { this->increment(); return *this; } + + hashtable_iterator operator++(int) + { + hashtable_iterator result (*this); + this->increment(); + return result; + } + + friend bool operator== (const hashtable_iterator& i, const hashtable_iterator& i2) + { return i.slist_it_ == i2.slist_it_; } + + friend bool operator!= (const hashtable_iterator& i, const hashtable_iterator& i2) + { return !(i == i2); } + + value_type& operator*() const + { return *this->operator ->(); } + + value_type* operator->() const + { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(downcast_bucket(slist_it_.pointed_node()))); } + + const Container *get_container() const + { return detail::get_pointer(cont_); } + + const real_value_traits *get_real_value_traits() const + { return &this->get_container()->get_real_value_traits(); } + + private: + void increment() + { + const Container *cont = detail::get_pointer(cont_); + bucket_type* buckets = detail::get_pointer(cont->bucket_pointer()); + size_type buckets_len = cont->bucket_count(); + + ++slist_it_; + if(buckets[0].cend().pointed_node() <= slist_it_.pointed_node() && + slist_it_.pointed_node()<= buckets[buckets_len].cend().pointed_node() ){ + //Now get the bucket_impl from the iterator + const bucket_type &b = static_cast + (bucket_type::slist_type::container_from_end_iterator(slist_it_)); + + //Now just calculate the index b has in the bucket array + size_type n_bucket = static_cast(&b - &buckets[0]); + do{ + if (++n_bucket == buckets_len){ + slist_it_ = (&buckets[0] + buckets_len)->end(); + break; + } + slist_it_ = buckets[n_bucket].begin(); + } + while (slist_it_ == buckets[n_bucket].end()); + } + } + + siterator slist_it_; + const_cont_ptr cont_; +}; + +} //namespace detail { +} //namespace intrusive { +} //namespace boost { + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/list_node.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/list_node.hpp new file mode 100644 index 0000000000..a0bc8ba84f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/list_node.hpp @@ -0,0 +1,188 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_LIST_NODE_HPP +#define BOOST_INTRUSIVE_LIST_NODE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +// list_node_traits can be used with circular_list_algorithms and supplies +// a list_node holding the pointers needed for a double-linked list +// it is used by list_derived_node and list_member_node + +template +struct list_node +{ + typedef typename boost::pointer_to_other + ::type node_ptr; + node_ptr next_; + node_ptr prev_; +}; + +template +struct list_node_traits +{ + typedef list_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + static node_ptr get_previous(const_node_ptr n) + { return n->prev_; } + + static void set_previous(node_ptr n, node_ptr prev) + { n->prev_ = prev; } + + static node_ptr get_next(const_node_ptr n) + { return n->next_; } + + static void set_next(node_ptr n, node_ptr next) + { n->next_ = next; } +}; + +// list_iterator provides some basic functions for a +// node oriented bidirectional iterator: +template +class list_iterator + : public std::iterator + < std::bidirectional_iterator_tag + , typename detail::add_const_if_c + ::type + > +{ + protected: + typedef typename Container::real_value_traits real_value_traits; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + typedef typename boost::pointer_to_other + ::type void_pointer; + static const bool store_container_ptr = + detail::store_cont_ptr_on_it::value; + + public: + typedef typename detail::add_const_if_c + + ::type value_type; + typedef value_type & reference; + typedef value_type * pointer; + + list_iterator() + : members_ (node_ptr(0), 0) + {} + + explicit list_iterator(node_ptr node, const Container *cont_ptr) + : members_ (node, cont_ptr) + {} + + list_iterator(list_iterator const& other) + : members_(other.pointed_node(), other.get_container()) + {} + + const node_ptr &pointed_node() const + { return members_.nodeptr_; } + + list_iterator &operator=(const node_ptr &node) + { members_.nodeptr_ = node; return static_cast(*this); } + + public: + list_iterator& operator++() + { + members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); + return static_cast (*this); + } + + list_iterator operator++(int) + { + list_iterator result (*this); + members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); + return result; + } + + list_iterator& operator--() + { + members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); + return static_cast (*this); + } + + list_iterator operator--(int) + { + list_iterator result (*this); + members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); + return result; + } + + bool operator== (const list_iterator& i) const + { return members_.nodeptr_ == i.pointed_node(); } + + bool operator!= (const list_iterator& i) const + { return !operator== (i); } + + value_type& operator*() const + { return *operator->(); } + + pointer operator->() const + { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } + + const Container *get_container() const + { + if(store_container_ptr){ + const Container* c = static_cast(members_.get_ptr()); + BOOST_INTRUSIVE_INVARIANT_ASSERT(c != 0); + return c; + } + else{ + return 0; + } + } + + const real_value_traits *get_real_value_traits() const + { + if(store_container_ptr) + return &this->get_container()->get_real_value_traits(); + else + return 0; + } + + list_iterator unconst() const + { return list_iterator(this->pointed_node(), this->get_container()); } + + private: + struct members + : public detail::select_constptr + ::type + { + typedef typename detail::select_constptr + ::type Base; + + members(const node_ptr &n_ptr, const void *cont) + : Base(cont), nodeptr_(n_ptr) + {} + + node_ptr nodeptr_; + } members_; +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_LIST_NODE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/mpl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/mpl.hpp new file mode 100644 index 0000000000..27e7f375a9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/mpl.hpp @@ -0,0 +1,367 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_MPL_HPP +#define BOOST_INTRUSIVE_DETAIL_MPL_HPP + +#include + +namespace boost { +namespace intrusive { +namespace detail { + +typedef char one; +struct two {one _[2];}; + +template< bool C_ > +struct bool_ +{ + static const bool value = C_; +}; + +typedef bool_ true_; +typedef bool_ false_; + +typedef true_ true_type; +typedef false_ false_type; + +typedef char yes_type; +struct no_type +{ + char padding[8]; +}; + +template +struct enable_if_c { + typedef T type; +}; + +template +struct enable_if_c {}; + +template +struct enable_if : public enable_if_c{}; + +template +struct apply +{ + typedef typename F::template apply::type type; +}; + +template +class is_convertible +{ + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static T trigger(); + public: + static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t); +}; + +template< + bool C + , typename T1 + , typename T2 + > +struct if_c +{ + typedef T1 type; +}; + +template< + typename T1 + , typename T2 + > +struct if_c +{ + typedef T2 type; +}; + +template< + typename C + , typename T1 + , typename T2 + > +struct if_ +{ + typedef typename if_c<0 != C::value, T1, T2>::type type; +}; + +template< + bool C + , typename F1 + , typename F2 + > +struct eval_if_c + : if_c::type +{}; + +template< + typename C + , typename T1 + , typename T2 + > +struct eval_if + : if_::type +{}; + +// identity is an extension: it is not part of the standard. +template +struct identity +{ + typedef T type; +}; + +#if defined(BOOST_MSVC) || defined(__BORLANDC_) +#define BOOST_INTRUSIVE_TT_DECL __cdecl +#else +#define BOOST_INTRUSIVE_TT_DECL +#endif + +#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) +#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS +#endif + +template +struct is_unary_or_binary_function_impl +{ static const bool value = false; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; +/* +#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; +#endif +*/ +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; +/* +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; +*/ +#endif + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; +/* +#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; + +template +struct is_unary_or_binary_function_impl +{ static const bool value = true; }; +#endif +*/ +template +struct is_unary_or_binary_function_impl +{ static const bool value = false; }; + +template +struct is_unary_or_binary_function +{ static const bool value = is_unary_or_binary_function_impl::value; }; + +//boost::alignment_of yields to 10K lines of preprocessed code, so we +//need an alternative +template struct alignment_of; + +template +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + +template +struct alignment_logic +{ + static const std::size_t value = A < S ? A : S; +}; + +template< typename T > +struct alignment_of +{ + static const std::size_t value = alignment_logic + < sizeof(alignment_of_hack) - sizeof(T) + , sizeof(T) + >::value; +}; + +template +struct is_same +{ + typedef char yes_type; + struct no_type + { + char padding[8]; + }; + + template + static yes_type is_same_tester(V*, V*); + static no_type is_same_tester(...); + + static T *t; + static U *u; + + static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); +}; + +template +struct add_const +{ typedef const T type; }; + +template +struct remove_const +{ typedef T type; }; + +template +struct remove_const +{ typedef T type; }; + +template +struct remove_reference +{ + typedef T type; +}; + +template +struct remove_reference +{ + typedef T type; +}; + +template +class is_empty_class +{ + template + struct empty_helper_t1 : public T + { + empty_helper_t1(); + int i[256]; + }; + + struct empty_helper_t2 + { int i[256]; }; + + public: + static const bool value = sizeof(empty_helper_t1) == sizeof(empty_helper_t2); +}; + +template +struct ls_zeros +{ + static const std::size_t value = (S & std::size_t(1)) ? 0 : (1 + ls_zeros<(S>>1u)>::value); +}; + +template<> +struct ls_zeros<0> +{ + static const std::size_t value = 0; +}; + +template<> +struct ls_zeros<1> +{ + static const std::size_t value = 0; +}; + +} //namespace detail +} //namespace intrusive +} //namespace boost + +#endif //BOOST_INTRUSIVE_DETAIL_MPL_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/parent_from_member.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/parent_from_member.hpp new file mode 100644 index 0000000000..d5fc96aae6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/parent_from_member.hpp @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP +#define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP + +#include +#include + +#if defined(BOOST_MSVC) || (defined (BOOST_WINDOWS) && defined(BOOST_INTEL)) +#define BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER +#include +#endif + +namespace boost { +namespace intrusive { +namespace detail { + +template +inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member) +{ + //The implementation of a pointer to member is compiler dependent. + #if defined(BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER) + //msvc compliant compilers use their the first 32 bits as offset (even in 64 bit mode) + return *(const boost::int32_t*)(void*)&ptr_to_member; + //This works with gcc, msvc, ac++, ibmcpp + #elif defined(__GNUC__) || defined(__HP_aCC) || defined(BOOST_INTEL) || \ + defined(__IBMCPP__) || defined(__DECCXX) + const Parent * const parent = 0; + const char *const member = reinterpret_cast(&(parent->*ptr_to_member)); + return std::ptrdiff_t(member - reinterpret_cast(parent)); + #else + //This is the traditional C-front approach: __MWERKS__, __DMC__, __SUNPRO_CC + return (*(const std::ptrdiff_t*)(void*)&ptr_to_member) - 1; + #endif +} + +template +inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member) +{ + return (Parent*)((char*)member - + offset_from_pointer_to_member(ptr_to_member)); +} + +template +inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member) +{ + return (const Parent*)((const char*)member - + offset_from_pointer_to_member(ptr_to_member)); +} + +} //namespace detail { +} //namespace intrusive { +} //namespace boost { + +#ifdef BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER +#undef BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER +#endif + +#include + +#endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/pointer_to_other.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/pointer_to_other.hpp new file mode 100644 index 0000000000..36a192e2cc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/pointer_to_other.hpp @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP +#define BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP + +#include +#include + +#if (BOOST_VERSION < 103400) + +#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED +#define BOOST_POINTER_TO_OTHER_HPP_INCLUDED + +namespace boost { + +template + struct pointer_to_other; + +template class Sp> + struct pointer_to_other< Sp, U > +{ + typedef Sp type; +}; + +template class Sp> + struct pointer_to_other< Sp, U > +{ + typedef Sp type; +}; + +template class Sp> +struct pointer_to_other< Sp, U > +{ + typedef Sp type; +}; + +template +struct pointer_to_other< T*, U > +{ + typedef U* type; +}; + +} // namespace boost + +#endif + +#else + +#include + +#endif //#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED + +#include + +#endif //#ifndef BOOST_INTRUSIVE_POINTER_TO_OTHER_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/rbtree_node.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/rbtree_node.hpp new file mode 100644 index 0000000000..5345209d5c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/rbtree_node.hpp @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_RBTREE_NODE_HPP +#define BOOST_INTRUSIVE_RBTREE_NODE_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +///////////////////////////////////////////////////////////////////////////// +// // +// Generic node_traits for any pointer type // +// // +///////////////////////////////////////////////////////////////////////////// + +//This is the compact representation: 3 pointers +template +struct compact_rbtree_node +{ + typedef typename pointer_to_other + >::type node_ptr; + enum color { red_t, black_t }; + node_ptr parent_, left_, right_; +}; + +//This is the normal representation: 3 pointers + enum +template +struct rbtree_node +{ + typedef typename pointer_to_other + >::type node_ptr; + + enum color { red_t, black_t }; + node_ptr parent_, left_, right_; + color color_; +}; + +//This is the default node traits implementation +//using a node with 3 generic pointers plus an enum +template +struct default_rbtree_node_traits_impl +{ + typedef rbtree_node node; + + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + typedef typename node::color color; + + static node_ptr get_parent(const_node_ptr n) + { return n->parent_; } + + static void set_parent(node_ptr n, node_ptr p) + { n->parent_ = p; } + + static node_ptr get_left(const_node_ptr n) + { return n->left_; } + + static void set_left(node_ptr n, node_ptr l) + { n->left_ = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->right_; } + + static void set_right(node_ptr n, node_ptr r) + { n->right_ = r; } + + static color get_color(const_node_ptr n) + { return n->color_; } + + static void set_color(node_ptr n, color c) + { n->color_ = c; } + + static color black() + { return node::black_t; } + + static color red() + { return node::red_t; } +}; + +//This is the compact node traits implementation +//using a node with 3 generic pointers +template +struct compact_rbtree_node_traits_impl +{ + typedef compact_rbtree_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + typedef pointer_plus_bits ptr_bit; + + typedef typename node::color color; + + static node_ptr get_parent(const_node_ptr n) + { return ptr_bit::get_pointer(n->parent_); } + + static void set_parent(node_ptr n, node_ptr p) + { ptr_bit::set_pointer(n->parent_, p); } + + static node_ptr get_left(const_node_ptr n) + { return n->left_; } + + static void set_left(node_ptr n, node_ptr l) + { n->left_ = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->right_; } + + static void set_right(node_ptr n, node_ptr r) + { n->right_ = r; } + + static color get_color(const_node_ptr n) + { return (color)ptr_bit::get_bits(n->parent_); } + + static void set_color(node_ptr n, color c) + { ptr_bit::set_bits(n->parent_, c != 0); } + + static color black() + { return node::black_t; } + + static color red() + { return node::red_t; } +}; + +//Dispatches the implementation based on the boolean +template +struct rbtree_node_traits_dispatch + : public default_rbtree_node_traits_impl +{}; + +template +struct rbtree_node_traits_dispatch + : public compact_rbtree_node_traits_impl +{}; + +//Inherit from the detail::link_dispatch depending on the embedding capabilities +template +struct rbtree_node_traits + : public rbtree_node_traits_dispatch + < VoidPointer + , OptimizeSize && + (max_pointer_plus_bits + < VoidPointer + , detail::alignment_of >::value + >::value >= 1) + > +{}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_RBTREE_NODE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/slist_node.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/slist_node.hpp new file mode 100644 index 0000000000..c0636e189a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/slist_node.hpp @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_SLIST_NODE_HPP +#define BOOST_INTRUSIVE_SLIST_NODE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +template +struct slist_node +{ + typedef typename boost::pointer_to_other + ::type node_ptr; + node_ptr next_; +}; + +// slist_node_traits can be used with circular_slist_algorithms and supplies +// a slist_node holding the pointers needed for a singly-linked list +// it is used by slist_base_hook and slist_member_hook +template +struct slist_node_traits +{ + typedef slist_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + static node_ptr get_next(const_node_ptr n) + { return n->next_; } + + static void set_next(node_ptr n, node_ptr next) + { n->next_ = next; } +}; + +// slist_iterator provides some basic functions for a +// node oriented bidirectional iterator: +template +class slist_iterator + : public std::iterator + < std::forward_iterator_tag + , typename detail::add_const_if_c + ::type + > +{ + protected: + typedef typename Container::real_value_traits real_value_traits; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + typedef typename boost::pointer_to_other + ::type void_pointer; + static const bool store_container_ptr = + detail::store_cont_ptr_on_it::value; + + public: + typedef typename detail::add_const_if_c + + ::type value_type; + typedef value_type & reference; + typedef value_type * pointer; + + slist_iterator() + : members_ (node_ptr(0), 0) + {} + + explicit slist_iterator(node_ptr node, const Container *cont_ptr) + : members_ (node, cont_ptr) + {} + + slist_iterator(slist_iterator const& other) + : members_(other.pointed_node(), other.get_container()) + {} + + const node_ptr &pointed_node() const + { return members_.nodeptr_; } + + slist_iterator &operator=(const node_ptr &node) + { members_.nodeptr_ = node; return static_cast(*this); } + + public: + slist_iterator& operator++() + { + members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); + return static_cast (*this); + } + + slist_iterator operator++(int) + { + slist_iterator result (*this); + members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); + return result; + } + + bool operator== (const slist_iterator& i) const + { return members_.nodeptr_ == i.pointed_node(); } + + bool operator!= (const slist_iterator& i) const + { return !operator== (i); } + + value_type& operator*() const + { return *operator->(); } + + pointer operator->() const + { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } + + const Container *get_container() const + { + if(store_container_ptr) + return static_cast(members_.get_ptr()); + else + return 0; + } + + slist_iterator unconst() const + { return slist_iterator(this->pointed_node(), this->get_container()); } + + const real_value_traits *get_real_value_traits() const + { + if(store_container_ptr) + return &this->get_container()->get_real_value_traits(); + else + return 0; + } + + private: + struct members + : public detail::select_constptr + ::type + { + typedef typename detail::select_constptr + ::type Base; + + members(const node_ptr &n_ptr, const void *cont) + : Base(cont), nodeptr_(n_ptr) + {} + + node_ptr nodeptr_; + } members_; +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SLIST_NODE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/transform_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/transform_iterator.hpp new file mode 100644 index 0000000000..f5fe05c6b2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/transform_iterator.hpp @@ -0,0 +1,173 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_TRANSFORM_ITERATOR_HPP +#define BOOST_INTRUSIVE_DETAIL_TRANSFORM_ITERATOR_HPP + +#include +#include +#include + +namespace boost { +namespace intrusive { +namespace detail { + +template +struct operator_arrow_proxy +{ + operator_arrow_proxy(const PseudoReference &px) + : m_value(px) + {} + + PseudoReference* operator->() const { return &m_value; } + // This function is needed for MWCW and BCC, which won't call operator-> + // again automatically per 13.3.1.2 para 8 +// operator T*() const { return &m_value; } + mutable PseudoReference m_value; +}; + +template +struct operator_arrow_proxy +{ + operator_arrow_proxy(T &px) + : m_value(px) + {} + + T* operator->() const { return &m_value; } + // This function is needed for MWCW and BCC, which won't call operator-> + // again automatically per 13.3.1.2 para 8 +// operator T*() const { return &m_value; } + mutable T &m_value; +}; + +template +class transform_iterator + : public std::iterator + < typename Iterator::iterator_category + , typename detail::remove_reference::type + , typename Iterator::difference_type + , operator_arrow_proxy + , typename UnaryFunction::result_type> +{ + public: + explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction()) + : members_(it, f) + {} + + explicit transform_iterator() + : members_() + {} + + Iterator get_it() const + { return members_.m_it; } + + //Constructors + transform_iterator& operator++() + { increment(); return *this; } + + transform_iterator operator++(int) + { + transform_iterator result (*this); + increment(); + return result; + } + + friend bool operator== (const transform_iterator& i, const transform_iterator& i2) + { return i.equal(i2); } + + friend bool operator!= (const transform_iterator& i, const transform_iterator& i2) + { return !(i == i2); } + +/* + friend bool operator> (const transform_iterator& i, const transform_iterator& i2) + { return i2 < i; } + + friend bool operator<= (const transform_iterator& i, const transform_iterator& i2) + { return !(i > i2); } + + friend bool operator>= (const transform_iterator& i, const transform_iterator& i2) + { return !(i < i2); } +*/ + friend typename Iterator::difference_type operator- (const transform_iterator& i, const transform_iterator& i2) + { return i2.distance_to(i); } + + //Arithmetic + transform_iterator& operator+=(typename Iterator::difference_type off) + { this->advance(off); return *this; } + + transform_iterator operator+(typename Iterator::difference_type off) const + { + transform_iterator other(*this); + other.advance(off); + return other; + } + + friend transform_iterator operator+(typename Iterator::difference_type off, const transform_iterator& right) + { return right + off; } + + transform_iterator& operator-=(typename Iterator::difference_type off) + { this->advance(-off); return *this; } + + transform_iterator operator-(typename Iterator::difference_type off) const + { return *this + (-off); } + + typename UnaryFunction::result_type operator*() const + { return dereference(); } + + operator_arrow_proxy + operator->() const + { return operator_arrow_proxy(dereference()); } + + private: + struct members + : UnaryFunction + { + members(const Iterator &it, const UnaryFunction &f) + : UnaryFunction(f), m_it(it) + {} + + members() + {} + + Iterator m_it; + } members_; + + + void increment() + { ++members_.m_it; } + + void decrement() + { --members_.m_it; } + + bool equal(const transform_iterator &other) const + { return members_.m_it == other.members_.m_it; } + + bool less(const transform_iterator &other) const + { return other.members_.m_it < members_.m_it; } + + typename UnaryFunction::result_type dereference() const + { return members_(*members_.m_it); } + + void advance(typename Iterator::difference_type n) + { std::advance(members_.m_it, n); } + + typename Iterator::difference_type distance_to(const transform_iterator &other)const + { return std::distance(other.members_.m_it, members_.m_it); } +}; + +} //namespace detail +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_DETAIL_TRANSFORM_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/tree_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/tree_algorithms.hpp new file mode 100644 index 0000000000..0aa06f72cb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/tree_algorithms.hpp @@ -0,0 +1,1625 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_TREE_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_TREE_ALGORITHMS_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { +namespace detail { + +//! This is an implementation of a binary search tree. +//! A node in the search tree has references to its children and its parent. This +//! is to allow traversal of the whole tree from a given node making the +//! implementation of iterator a pointer to a node. +//! At the top of the tree a node is used specially. This node's parent pointer +//! is pointing to the root of the tree. Its left pointer points to the +//! leftmost node in the tree and the right pointer to the rightmost one. +//! This node is used to represent the end-iterator. +//! +//! +---------+ +//! header------------------------------>| | +//! | | +//! +----------(left)--------| |--------(right)---------+ +//! | +---------+ | +//! | | | +//! | | (parent) | +//! | | | +//! | | | +//! | +---------+ | +//! root of tree ..|......................> | | | +//! | | D | | +//! | | | | +//! | +-------+---------+-------+ | +//! | | | | +//! | | | | +//! | | | | +//! | | | | +//! | | | | +//! | +---------+ +---------+ | +//! | | | | | | +//! | | B | | F | | +//! | | | | | | +//! | +--+---------+--+ +--+---------+--+ | +//! | | | | | | +//! | | | | | | +//! | | | | | | +//! | +---+-----+ +-----+---+ +---+-----+ +-----+---+ | +//! +-->| | | | | | | |<--+ +//! | A | | C | | E | | G | +//! | | | | | | | | +//! +---------+ +---------+ +---------+ +---------+ +//! + +//! tree_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the circular list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! Static functions: +//! +//! static node_ptr get_parent(const_node_ptr n); +//! +//! static void set_parent(node_ptr n, node_ptr parent); +//! +//! static node_ptr get_left(const_node_ptr n); +//! +//! static void set_left(node_ptr n, node_ptr left); +//! +//! static node_ptr get_right(const_node_ptr n); +//! +//! static void set_right(node_ptr n, node_ptr right); +template +class tree_algorithms +{ + public: + typedef typename NodeTraits::node node; + typedef NodeTraits node_traits; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + + //! This type is the information that will be filled by insert_unique_check + struct insert_commit_data + { + insert_commit_data() + : link_left(false) + , node(0) + {} + bool link_left; + node_ptr node; + }; + + struct nop_erase_fixup + { + void operator()(node_ptr, node_ptr){} + }; + + /// @cond + private: + template + struct dispose_subtree_disposer + { + dispose_subtree_disposer(Disposer &disp, node_ptr subtree) + : disposer_(&disp), subtree_(subtree) + {} + + void release() + { disposer_ = 0; } + + ~dispose_subtree_disposer() + { + if(disposer_){ + dispose_subtree(subtree_, *disposer_); + } + } + Disposer *disposer_; + node_ptr subtree_; + }; + + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + } + /// @endcond + + public: + static node_ptr begin_node(const_node_ptr header) + { return node_traits::get_left(header); } + + static node_ptr end_node(const_node_ptr header) + { return uncast(header); } + + //! Requires: node is a node of the tree or an node initialized + //! by init(...) or init_node. + //! + //! Effects: Returns true if the node is initialized by init() or init_node(). + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + static bool unique(const_node_ptr node) + { return NodeTraits::get_parent(node) == 0; } + + static node_ptr get_header(const_node_ptr node) + { + node_ptr h = uncast(node); + if(NodeTraits::get_parent(node)){ + h = NodeTraits::get_parent(node); + while(!is_header(h)) + h = NodeTraits::get_parent(h); + } + return h; + } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr node2) + { + if(node1 == node2) + return; + + node_ptr header1(get_header(node1)), header2(get_header(node2)); + swap_nodes(node1, header1, node2, header2); + } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees with header header1 and header2. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) + { + if(node1 == node2) + return; + + //node1 and node2 must not be header nodes + //BOOST_INTRUSIVE_INVARIANT_ASSERT((header1 != node1 && header2 != node2)); + if(header1 != header2){ + //Update header1 if necessary + if(node1 == NodeTraits::get_left(header1)){ + NodeTraits::set_left(header1, node2); + } + + if(node1 == NodeTraits::get_right(header1)){ + NodeTraits::set_right(header1, node2); + } + + if(node1 == NodeTraits::get_parent(header1)){ + NodeTraits::set_parent(header1, node2); + } + + //Update header2 if necessary + if(node2 == NodeTraits::get_left(header2)){ + NodeTraits::set_left(header2, node1); + } + + if(node2 == NodeTraits::get_right(header2)){ + NodeTraits::set_right(header2, node1); + } + + if(node2 == NodeTraits::get_parent(header2)){ + NodeTraits::set_parent(header2, node1); + } + } + else{ + //If both nodes are from the same tree + //Update header if necessary + if(node1 == NodeTraits::get_left(header1)){ + NodeTraits::set_left(header1, node2); + } + else if(node2 == NodeTraits::get_left(header2)){ + NodeTraits::set_left(header2, node1); + } + + if(node1 == NodeTraits::get_right(header1)){ + NodeTraits::set_right(header1, node2); + } + else if(node2 == NodeTraits::get_right(header2)){ + NodeTraits::set_right(header2, node1); + } + + if(node1 == NodeTraits::get_parent(header1)){ + NodeTraits::set_parent(header1, node2); + } + else if(node2 == NodeTraits::get_parent(header2)){ + NodeTraits::set_parent(header2, node1); + } + + //Adjust data in nodes to be swapped + //so that final link swap works as expected + if(node1 == NodeTraits::get_parent(node2)){ + NodeTraits::set_parent(node2, node2); + + if(node2 == NodeTraits::get_right(node1)){ + NodeTraits::set_right(node1, node1); + } + else{ + NodeTraits::set_left(node1, node1); + } + } + else if(node2 == NodeTraits::get_parent(node1)){ + NodeTraits::set_parent(node1, node1); + + if(node1 == NodeTraits::get_right(node2)){ + NodeTraits::set_right(node2, node2); + } + else{ + NodeTraits::set_left(node2, node2); + } + } + } + + //Now swap all the links + node_ptr temp; + //swap left link + temp = NodeTraits::get_left(node1); + NodeTraits::set_left(node1, NodeTraits::get_left(node2)); + NodeTraits::set_left(node2, temp); + //swap right link + temp = NodeTraits::get_right(node1); + NodeTraits::set_right(node1, NodeTraits::get_right(node2)); + NodeTraits::set_right(node2, temp); + //swap parent link + temp = NodeTraits::get_parent(node1); + NodeTraits::set_parent(node1, NodeTraits::get_parent(node2)); + NodeTraits::set_parent(node2, temp); + + //Now adjust adjacent nodes for newly inserted node 1 + if((temp = NodeTraits::get_left(node1))){ + NodeTraits::set_parent(temp, node1); + } + if((temp = NodeTraits::get_right(node1))){ + NodeTraits::set_parent(temp, node1); + } + if((temp = NodeTraits::get_parent(node1)) && + //The header has been already updated so avoid it + temp != header2){ + if(NodeTraits::get_left(temp) == node2){ + NodeTraits::set_left(temp, node1); + } + if(NodeTraits::get_right(temp) == node2){ + NodeTraits::set_right(temp, node1); + } + } + //Now adjust adjacent nodes for newly inserted node 2 + if((temp = NodeTraits::get_left(node2))){ + NodeTraits::set_parent(temp, node2); + } + if((temp = NodeTraits::get_right(node2))){ + NodeTraits::set_parent(temp, node2); + } + if((temp = NodeTraits::get_parent(node2)) && + //The header has been already updated so avoid it + temp != header1){ + if(NodeTraits::get_left(temp) == node1){ + NodeTraits::set_left(temp, node2); + } + if(NodeTraits::get_right(temp) == node1){ + NodeTraits::set_right(temp, node2); + } + } + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing and comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) + { + if(node_to_be_replaced == new_node) + return; + replace_node(node_to_be_replaced, get_header(node_to_be_replaced), new_node); + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! with header "header" and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) + { + if(node_to_be_replaced == new_node) + return; + + //Update header if necessary + if(node_to_be_replaced == NodeTraits::get_left(header)){ + NodeTraits::set_left(header, new_node); + } + + if(node_to_be_replaced == NodeTraits::get_right(header)){ + NodeTraits::set_right(header, new_node); + } + + if(node_to_be_replaced == NodeTraits::get_parent(header)){ + NodeTraits::set_parent(header, new_node); + } + + //Now set data from the original node + node_ptr temp; + NodeTraits::set_left(new_node, NodeTraits::get_left(node_to_be_replaced)); + NodeTraits::set_right(new_node, NodeTraits::get_right(node_to_be_replaced)); + NodeTraits::set_parent(new_node, NodeTraits::get_parent(node_to_be_replaced)); + + //Now adjust adjacent nodes for newly inserted node + if((temp = NodeTraits::get_left(new_node))){ + NodeTraits::set_parent(temp, new_node); + } + if((temp = NodeTraits::get_right(new_node))){ + NodeTraits::set_parent(temp, new_node); + } + if((temp = NodeTraits::get_parent(new_node)) && + //The header has been already updated so avoid it + temp != header){ + if(NodeTraits::get_left(temp) == node_to_be_replaced){ + NodeTraits::set_left(temp, new_node); + } + if(NodeTraits::get_right(temp) == node_to_be_replaced){ + NodeTraits::set_right(temp, new_node); + } + } + } + + //! Requires: p is a node from the tree except the header. + //! + //! Effects: Returns the next node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr next_node(node_ptr p) + { + node_ptr p_right(NodeTraits::get_right(p)); + if(p_right){ + return minimum(p_right); + } + else { + node_ptr x = NodeTraits::get_parent(p); + while(p == NodeTraits::get_right(x)){ + p = x; + x = NodeTraits::get_parent(x); + } + return NodeTraits::get_right(p) != x ? x : uncast(p); + } + } + + //! Requires: p is a node from the tree except the leftmost node. + //! + //! Effects: Returns the previous node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr prev_node(node_ptr p) + { + if(is_header(p)){ + return maximum(NodeTraits::get_parent(p)); + } + else if(NodeTraits::get_left(p)){ + return maximum(NodeTraits::get_left(p)); + } + else { + node_ptr x = NodeTraits::get_parent(p); + while(p == NodeTraits::get_left(x)){ + p = x; + x = NodeTraits::get_parent(x); + } + return x; + } + } + + //! Requires: p is a node of a tree but not the header. + //! + //! Effects: Returns the minimum node of the subtree starting at p. + //! + //! Complexity: Logarithmic to the size of the subtree. + //! + //! Throws: Nothing. + static node_ptr minimum (node_ptr p) + { + for(node_ptr p_left = NodeTraits::get_left(p) + ;p_left + ;p_left = NodeTraits::get_left(p)){ + p = p_left; + } + return p; + } + + //! Requires: p is a node of a tree but not the header. + //! + //! Effects: Returns the maximum node of the subtree starting at p. + //! + //! Complexity: Logarithmic to the size of the subtree. + //! + //! Throws: Nothing. + static node_ptr maximum(node_ptr p) + { + for(node_ptr p_right = NodeTraits::get_right(p) + ;p_right + ;p_right = NodeTraits::get_right(p)){ + p = p_right; + } + return p; + } + + //! Requires: node must not be part of any tree. + //! + //! Effects: After the function unique(node) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init(node_ptr node) + { + NodeTraits::set_parent(node, node_ptr(0)); + NodeTraits::set_left(node, node_ptr(0)); + NodeTraits::set_right(node, node_ptr(0)); + }; + + //! Effects: Returns true if node is in the same state as if called init(node) + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static bool inited(const_node_ptr node) + { + return !NodeTraits::get_parent(node) && + !NodeTraits::get_left(node) && + !NodeTraits::get_right(node) ; + }; + + //! Requires: node must not be part of any tree. + //! + //! Effects: Initializes the header to represent an empty tree. + //! unique(header) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init_header(node_ptr header) + { + NodeTraits::set_parent(header, node_ptr(0)); + NodeTraits::set_left(header, header); + NodeTraits::set_right(header, header); + } + + //! Requires: "disposer" must be an object function + //! taking a node_ptr parameter and shouldn't throw. + //! + //! Effects: Empties the target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clear_and_dispose(node_ptr header, Disposer disposer) + { + node_ptr source_root = NodeTraits::get_parent(header); + if(!source_root) + return; + dispose_subtree(source_root, disposer); + init_header(header); + } + + //! Requires: header is the header of a tree. + //! + //! Effects: Unlinks the leftmost node from the tree, and + //! updates the header link to the new leftmost node. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + static node_ptr unlink_leftmost_without_rebalance(node_ptr header) + { + node_ptr leftmost = NodeTraits::get_left(header); + if (leftmost == header) + return node_ptr(0); + node_ptr leftmost_parent(NodeTraits::get_parent(leftmost)); + node_ptr leftmost_right (NodeTraits::get_right(leftmost)); + bool is_root = leftmost_parent == header; + + if (leftmost_right){ + NodeTraits::set_parent(leftmost_right, leftmost_parent); + NodeTraits::set_left(header, tree_algorithms::minimum(leftmost_right)); + + if (is_root) + NodeTraits::set_parent(header, leftmost_right); + else + NodeTraits::set_left(NodeTraits::get_parent(header), leftmost_right); + } + else if (is_root){ + NodeTraits::set_parent(header, node_ptr(0)); + NodeTraits::set_left(header, header); + NodeTraits::set_right(header, header); + } + else{ + NodeTraits::set_left(leftmost_parent, node_ptr(0)); + NodeTraits::set_left(header, leftmost_parent); + } + return leftmost; + } + + //! Requires: node is a node of the tree but it's not the header. + //! + //! Effects: Returns the number of nodes of the subtree. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr subtree) + { + if(!subtree) return 0; + std::size_t count = 0; + node_ptr p = minimum(uncast(subtree)); + bool continue_looping = true; + while(continue_looping){ + ++count; + node_ptr p_right(NodeTraits::get_right(p)); + if(p_right){ + p = minimum(p_right); + } + else { + for(;;){ + node_ptr q; + if (p == subtree){ + continue_looping = false; + break; + } + q = p; + p = NodeTraits::get_parent(p); + if (NodeTraits::get_left(p) == q) + break; + } + } + } + return count; + } + + //! Requires: node is a node of the tree but it's not the header. + //! + //! Effects: Returns the number of nodes of the subtree. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t size(const_node_ptr header) + { + node_ptr beg(begin_node(header)); + node_ptr end(end_node(header)); + std::size_t i = 0; + for(;beg != end; beg = next_node(beg)) ++i; + return i; + } + + //! Requires: header1 and header2 must be the header nodes + //! of two trees. + //! + //! Effects: Swaps two trees. After the function header1 will contain + //! links to the second tree and header2 will have links to the first tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static void swap_tree(node_ptr header1, node_ptr header2) + { + if(header1 == header2) + return; + + node_ptr tmp; + + //Parent swap + tmp = NodeTraits::get_parent(header1); + NodeTraits::set_parent(header1, NodeTraits::get_parent(header2)); + NodeTraits::set_parent(header2, tmp); + //Left swap + tmp = NodeTraits::get_left(header1); + NodeTraits::set_left(header1, NodeTraits::get_left(header2)); + NodeTraits::set_left(header2, tmp); + //Right swap + tmp = NodeTraits::get_right(header1); + NodeTraits::set_right(header1, NodeTraits::get_right(header2)); + NodeTraits::set_right(header2, tmp); + + //Now test parent + node_ptr h1_parent(NodeTraits::get_parent(header1)); + if(h1_parent){ + NodeTraits::set_parent(h1_parent, header1); + } + else{ + NodeTraits::set_left(header1, header1); + NodeTraits::set_right(header1, header1); + } + + node_ptr h2_parent(NodeTraits::get_parent(header2)); + if(h2_parent){ + NodeTraits::set_parent(h2_parent, header2); + } + else{ + NodeTraits::set_left(header2, header2); + NodeTraits::set_right(header2, header2); + } + } + + static bool is_header(const_node_ptr p) + { +/* + node_ptr p_parent = NodeTraits::get_parent(p); + if(!p_parent) + return true; + if(!NodeTraits::get_parent(p_parent) != p) + return false; + if(NodeTraits::get_left(p) != 0){ + if(NodeTraits::get_parent(NodeTraits::get_left(p)) != p){ + is_header = true; + } + if(NodeTraits::get_parent(p) == NodeTraits::get_left(p)){ + is_header = true; + } + } +*/ + + bool is_header = false; + if(NodeTraits::get_parent(p) == p){ + is_header = true; + } + else if(NodeTraits::get_parent(NodeTraits::get_parent(p)) == p){ + if(NodeTraits::get_left(p) != 0){ + if(NodeTraits::get_parent(NodeTraits::get_left(p)) != p){ + is_header = true; + } + if(NodeTraits::get_parent(p) == NodeTraits::get_left(p)){ + is_header = true; + } + } + } + return is_header; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the element that is equivalent to + //! "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr find + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { + node_ptr end = uncast(header); + node_ptr y = lower_bound(header, key, comp); + return (y == end || comp(key, y)) ? end : y; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an a pair of node_ptr delimiting a range containing + //! all elements that are equivalent to "key" according to "comp" or an + //! empty range that indicates the position where those elements would be + //! if they there are no equivalent elements. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static std::pair equal_range + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { + node_ptr y = uncast(header); + node_ptr x = NodeTraits::get_parent(header); + + while(x){ + if(comp(x, key)){ + x = NodeTraits::get_right(x); + } + else if(comp(key, x)){ + y = x; + x = NodeTraits::get_left(x); + } + else{ + node_ptr xu(x), yu(y); + y = x, x = NodeTraits::get_left(x); + xu = NodeTraits::get_right(xu); + + while(x){ + if(comp(x, key)){ + x = NodeTraits::get_right(x); + } + else { + y = x; + x = NodeTraits::get_left(x); + } + } + + while(xu){ + if(comp(key, xu)){ + yu = xu; + xu = NodeTraits::get_left(xu); + } + else { + xu = NodeTraits::get_right(xu); + } + } + return std::pair (y, yu); + } + } + return std::pair (y, y); + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is + //! not less than "key" according to "comp" or "header" if that element does + //! not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr lower_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { + node_ptr y = uncast(header); + node_ptr x = NodeTraits::get_parent(header); + while(x){ + if(comp(x, key)){ + x = NodeTraits::get_right(x); + } + else { + y = x; + x = NodeTraits::get_left(x); + } + } + return y; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is greater + //! than "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr upper_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { + node_ptr y = uncast(header); + node_ptr x = NodeTraits::get_parent(header); + while(x){ + if(comp(key, x)){ + y = x; + x = NodeTraits::get_left(x); + } + else { + x = NodeTraits::get_right(x); + } + } + return y; + } + + //! Requires: "header" must be the header node of a tree. + //! "commit_data" must have been obtained from a previous call to + //! "insert_unique_check". No objects should have been inserted or erased + //! from the set between the "insert_unique_check" that filled "commit_data" + //! and the call to "insert_commit". + //! + //! + //! Effects: Inserts new_node in the set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_unique_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + static void insert_unique_commit + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data) + { + //Check if commit_data has not been initialized by a insert_unique_check call. + BOOST_INTRUSIVE_INVARIANT_ASSERT(commit_data.node != 0); + link(header, new_value, commit_data.node, commit_data.link_left); + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (const_node_ptr header, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data, std::size_t *pdepth = 0) + { + std::size_t depth = 0; + node_ptr h(uncast(header)); + node_ptr y(h); + node_ptr x(NodeTraits::get_parent(y)); + node_ptr prev(0); + + //Find the upper bound, cache the previous value and if we should + //store it in the left or right node + bool left_child = true; + while(x){ + ++depth; + y = x; + x = (left_child = comp(key, x)) ? + NodeTraits::get_left(x) : (prev = y, NodeTraits::get_right(x)); + } + + if(pdepth) *pdepth = depth; + + //Since we've found the upper bound there is no other value with the same key if: + // - There is no previous node + // - The previous node is less than the key + if(!prev || comp(prev, key)){ + commit_data.link_left = left_child; + commit_data.node = y; + return std::pair(node_ptr(), true); + } + //If the previous value was not less than key, it means that it's equal + //(because we've checked the upper bound) + else{ + return std::pair(prev, false); + } + } + + template + static std::pair insert_unique_check + (const_node_ptr header, node_ptr hint, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data, std::size_t *pdepth = 0) + { + //hint must be bigger than the key + if(hint == header || comp(key, hint)){ + node_ptr prev = hint; + //The previous value should be less than the key + if(prev == NodeTraits::get_left(header) || comp((prev = prev_node(hint)), key)){ + commit_data.link_left = unique(header) || !NodeTraits::get_left(hint); + commit_data.node = commit_data.link_left ? hint : prev; + if(pdepth){ + *pdepth = commit_data.node == header ? 0 : depth(commit_data.node) + 1; + } + return std::pair(node_ptr(), true); + } + else{ + return insert_unique_check(header, key, comp, commit_data, pdepth); + } + } + //The hint was wrong, use hintless insert + else{ + return insert_unique_check(header, key, comp, commit_data, pdepth); + } + } + + //! Requires: "header" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from + //! the "header"'s tree. + //! + //! Effects: Inserts new_node into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case). + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if new_node is inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp, std::size_t *pdepth = 0) + { + if(hint == header || !comp(hint, new_node)){ + node_ptr prev(hint); + if(hint == NodeTraits::get_left(header) || + !comp(new_node, (prev = prev_node(hint)))){ + bool link_left = unique(header) || !NodeTraits::get_left(hint); + link(header, new_node, link_left ? hint : prev, link_left); + if(pdepth) *pdepth = depth(new_node) + 1; + return new_node; + } + else{ + return insert_equal_upper_bound(header, new_node, comp, pdepth); + } + } + else{ + return insert_equal_lower_bound(header, new_node, comp, pdepth); + } + } + + //! Requires: p can't be a header node. + //! + //! Effects: Calculates the depth of a node: the depth of a + //! node is the length (number of edges) of the path from the root + //! to that node. (The root node is at depth 0.) + //! + //! Complexity: Logarithmic to the number of nodes in the tree. + //! + //! Throws: Nothing. + static std::size_t depth(const_node_ptr p) + { + std::size_t depth = 0; + node_ptr p_parent; + while(p != NodeTraits::get_parent(p_parent = NodeTraits::get_parent(p))){ + ++depth; + p = p_parent; + } + return depth; + } + + template + static node_ptr insert_equal_upper_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp, std::size_t *pdepth = 0) + { + std::size_t depth = 0; + node_ptr y(h); + node_ptr x(NodeTraits::get_parent(y)); + + while(x){ + ++depth; + y = x; + x = comp(new_node, x) ? + NodeTraits::get_left(x) : NodeTraits::get_right(x); + } + + bool link_left = (y == h) || comp(new_node, y); + link(h, new_node, y, link_left); + if(pdepth) *pdepth = depth; + return new_node; + } + + template + static node_ptr insert_equal_lower_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp, std::size_t *pdepth = 0) + { + std::size_t depth = 0; + node_ptr y(h); + node_ptr x(NodeTraits::get_parent(y)); + + while(x){ + ++depth; + y = x; + x = !comp(x, new_node) ? + NodeTraits::get_left(x) : NodeTraits::get_right(x); + } + + bool link_left = (y == h) || !comp(y, new_node); + link(h, new_node, y, link_left); + if(pdepth) *pdepth = depth; + return new_node; + } + + //! Requires: "cloner" must be a function + //! object taking a node_ptr and returning a new cloned node of it. "disposer" must + //! take a node_ptr and shouldn't throw. + //! + //! Effects: First empties target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Then, duplicates the entire tree pointed by "source_header" cloning each + //! source node with node_ptr Cloner::operator()(node_ptr) to obtain + //! the nodes of the target tree. If "cloner" throws, the cloned target nodes + //! are disposed using void disposer(node_ptr). + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clone + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer) + { + if(!unique(target_header)){ + clear_and_dispose(target_header, disposer); + } + + node_ptr leftmost, rightmost; + node_ptr new_root = clone_subtree + (source_header, target_header, cloner, disposer, leftmost, rightmost); + + //Now update header node + NodeTraits::set_parent(target_header, new_root); + NodeTraits::set_left (target_header, leftmost); + NodeTraits::set_right (target_header, rightmost); + } + + template + static node_ptr clone_subtree + ( const_node_ptr source_parent, node_ptr target_parent + , Cloner cloner, Disposer disposer + , node_ptr &leftmost_out, node_ptr &rightmost_out + ) + { + node_ptr target_sub_root = target_parent; + node_ptr source_root = NodeTraits::get_parent(source_parent); + if(!source_root){ + leftmost_out = rightmost_out = source_root; + } + else{ + //We'll calculate leftmost and rightmost nodes while iterating + node_ptr current = source_root; + node_ptr insertion_point = target_sub_root = cloner(current); + + //We'll calculate leftmost and rightmost nodes while iterating + node_ptr leftmost = target_sub_root; + node_ptr rightmost = target_sub_root; + + //First set the subroot + NodeTraits::set_left(target_sub_root, node_ptr(0)); + NodeTraits::set_right(target_sub_root, node_ptr(0)); + NodeTraits::set_parent(target_sub_root, target_parent); + + dispose_subtree_disposer rollback(disposer, target_sub_root); + while(true) { + //First clone left nodes + if( NodeTraits::get_left(current) && + !NodeTraits::get_left(insertion_point)) { + current = NodeTraits::get_left(current); + node_ptr temp = insertion_point; + //Clone and mark as leaf + insertion_point = cloner(current); + NodeTraits::set_left (insertion_point, node_ptr(0)); + NodeTraits::set_right (insertion_point, node_ptr(0)); + //Insert left + NodeTraits::set_parent(insertion_point, temp); + NodeTraits::set_left (temp, insertion_point); + //Update leftmost + if(rightmost == target_sub_root) + leftmost = insertion_point; + } + //Then clone right nodes + else if( NodeTraits::get_right(current) && + !NodeTraits::get_right(insertion_point)){ + current = NodeTraits::get_right(current); + node_ptr temp = insertion_point; + //Clone and mark as leaf + insertion_point = cloner(current); + NodeTraits::set_left (insertion_point, node_ptr(0)); + NodeTraits::set_right (insertion_point, node_ptr(0)); + //Insert right + NodeTraits::set_parent(insertion_point, temp); + NodeTraits::set_right (temp, insertion_point); + //Update rightmost + rightmost = insertion_point; + } + //If not, go up + else if(current == source_root){ + break; + } + else{ + //Branch completed, go up searching more nodes to clone + current = NodeTraits::get_parent(current); + insertion_point = NodeTraits::get_parent(insertion_point); + } + } + rollback.release(); + leftmost_out = leftmost; + rightmost_out = rightmost; + } + return target_sub_root; + } + + template + static void dispose_subtree(node_ptr x, Disposer disposer) + { + node_ptr save; + while (x){ + save = NodeTraits::get_left(x); + if (save) { + // Right rotation + NodeTraits::set_left(x, NodeTraits::get_right(save)); + NodeTraits::set_right(save, x); + } + else { + save = NodeTraits::get_right(x); + init(x); + disposer(x); + } + x = save; + } + } + + //! Requires: p is a node of a tree. + //! + //! Effects: Returns true if p is a left child. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static bool is_left_child(node_ptr p) + { return NodeTraits::get_left(NodeTraits::get_parent(p)) == p; } + + //! Requires: p is a node of a tree. + //! + //! Effects: Returns true if p is a right child. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static bool is_right_child (node_ptr p) + { return NodeTraits::get_right(NodeTraits::get_parent(p)) == p; } + + static void replace_own (node_ptr own, node_ptr x, node_ptr header) + { + if(NodeTraits::get_parent(header) == own) + NodeTraits::set_parent(header, x); + else if(is_left_child(own)) + NodeTraits::set_left(NodeTraits::get_parent(own), x); + else + NodeTraits::set_right(NodeTraits::get_parent(own), x); + } + + static void rotate_left(node_ptr p, node_ptr header) + { + node_ptr x = NodeTraits::get_right(p); + NodeTraits::set_right(p, NodeTraits::get_left(x)); + if(NodeTraits::get_left(x) != 0) + NodeTraits::set_parent(NodeTraits::get_left(x), p); + NodeTraits::set_parent(x, NodeTraits::get_parent(p)); + replace_own (p, x, header); + NodeTraits::set_left(x, p); + NodeTraits::set_parent(p, x); + } + + static void rotate_right(node_ptr p, node_ptr header) + { + node_ptr x(NodeTraits::get_left(p)); + node_ptr x_right(NodeTraits::get_right(x)); + NodeTraits::set_left(p, x_right); + if(x_right) + NodeTraits::set_parent(x_right, p); + NodeTraits::set_parent(x, NodeTraits::get_parent(p)); + replace_own (p, x, header); + NodeTraits::set_right(x, p); + NodeTraits::set_parent(p, x); + } + + // rotate node t with left child | complexity : constant | exception : nothrow + static node_ptr rotate_left(node_ptr t) + { + node_ptr x = NodeTraits::get_right(t); + NodeTraits::set_right(t, NodeTraits::get_left(x)); + + if( NodeTraits::get_right(t) != 0 ){ + NodeTraits::set_parent(NodeTraits::get_right(t), t ); + } + NodeTraits::set_left(x, t); + NodeTraits::set_parent(t, x); + return x; + } + + // rotate node t with right child | complexity : constant | exception : nothrow + static node_ptr rotate_right(node_ptr t) + { + node_ptr x = NodeTraits::get_left(t); + NodeTraits::set_left(t, NodeTraits::get_right(x)); + if( NodeTraits::get_left(t) != 0 ){ + NodeTraits::set_parent(NodeTraits::get_left(t), t); + } + NodeTraits::set_right(x, t); + NodeTraits::set_parent(t, x); + return x; + } + + static void link(node_ptr header, node_ptr z, node_ptr par, bool left) + { + if(par == header){ + NodeTraits::set_parent(header, z); + NodeTraits::set_right(header, z); + NodeTraits::set_left(header, z); + } + else if(left){ + NodeTraits::set_left(par, z); + if(par == NodeTraits::get_left(header)) + NodeTraits::set_left(header, z); + } + else{ + NodeTraits::set_right(par, z); + if(par == NodeTraits::get_right(header)) + NodeTraits::set_right(header, z); + } + NodeTraits::set_parent(z, par); + NodeTraits::set_right(z, node_ptr(0)); + NodeTraits::set_left(z, node_ptr(0)); + } + + static void erase(node_ptr header, node_ptr z) + { + data_for_rebalance ignored; + erase(header, z, nop_erase_fixup(), ignored); + } + + struct data_for_rebalance + { + node_ptr x; + node_ptr x_parent; + node_ptr y; + }; + + template + static void erase(node_ptr header, node_ptr z, F z_and_successor_fixup, data_for_rebalance &info) + { + erase_impl(header, z, info); + if(info.y != z){ + z_and_successor_fixup(z, info.y); + } + } + + static void unlink(node_ptr node) + { + node_ptr x = NodeTraits::get_parent(node); + if(x){ + while(!is_header(x)) + x = NodeTraits::get_parent(x); + erase(x, node); + } + } + + static void tree_to_vine(node_ptr header) + { subtree_to_vine(NodeTraits::get_parent(header)); } + + static void vine_to_tree(node_ptr header, std::size_t count) + { vine_to_subtree(NodeTraits::get_parent(header), count); } + + static void rebalance(node_ptr header) + { + //Taken from: + //"Tree rebalancing in optimal time and space" + //Quentin F. Stout and Bette L. Warren + std::size_t len = 0; + subtree_to_vine(NodeTraits::get_parent(header), &len); + vine_to_subtree(NodeTraits::get_parent(header), len); + } + + static node_ptr rebalance_subtree(node_ptr old_root) + { + std::size_t len = 0; + node_ptr new_root = subtree_to_vine(old_root, &len); + return vine_to_subtree(new_root, len); + } + + static node_ptr subtree_to_vine(node_ptr old_root, std::size_t *plen = 0) + { + std::size_t len; + len = 0; + if(!old_root) return node_ptr(0); + + //To avoid irregularities in the algorithm (old_root can be a + //left or right child or even the root of the tree) just put the + //root as the right child of its parent. Before doing this backup + //information to restore the original relationship after + //the algorithm is applied. + node_ptr super_root = NodeTraits::get_parent(old_root); + BOOST_INTRUSIVE_INVARIANT_ASSERT(super_root); + + //Get info + node_ptr super_root_right_backup = NodeTraits::get_right(super_root); + bool super_root_is_header = is_header(super_root); + bool old_root_is_right = is_right_child(old_root); + + node_ptr x(old_root); + node_ptr new_root(x); + node_ptr save; + bool moved_to_right = false; + for( ; x; x = save){ + save = NodeTraits::get_left(x); + if(save){ + // Right rotation + node_ptr save_right = NodeTraits::get_right(save); + node_ptr x_parent = NodeTraits::get_parent(x); + NodeTraits::set_parent(save, x_parent); + NodeTraits::set_right (x_parent, save); + NodeTraits::set_parent(x, save); + NodeTraits::set_right (save, x); + NodeTraits::set_left(x, save_right); + if(save_right) + NodeTraits::set_parent(save_right, x); + if(!moved_to_right) + new_root = save; + } + else{ + moved_to_right = true; + save = NodeTraits::get_right(x); + ++len; + } + } + + if(super_root_is_header){ + NodeTraits::set_right(super_root, super_root_right_backup); + NodeTraits::set_parent(super_root, new_root); + } + else if(old_root_is_right){ + NodeTraits::set_right(super_root, new_root); + } + else{ + NodeTraits::set_right(super_root, super_root_right_backup); + NodeTraits::set_left(super_root, new_root); + } + if(plen) *plen = len; + return new_root; + } + + static node_ptr vine_to_subtree(node_ptr old_root, std::size_t count) + { + std::size_t leaf_nodes = count + 1 - ((size_t) 1 << floor_log2 (count + 1)); + std::size_t vine_nodes = count - leaf_nodes; + + node_ptr new_root = compress_subtree(old_root, leaf_nodes); + while(vine_nodes > 1){ + vine_nodes /= 2; + new_root = compress_subtree(new_root, vine_nodes); + } + return new_root; + } + + static node_ptr compress_subtree(node_ptr old_root, std::size_t count) + { + if(!old_root) return old_root; + + //To avoid irregularities in the algorithm (old_root can be + //left or right child or even the root of the tree) just put the + //root as the right child of its parent. First obtain + //information to restore the original relationship after + //the algorithm is applied. + node_ptr super_root = NodeTraits::get_parent(old_root); + BOOST_INTRUSIVE_INVARIANT_ASSERT(super_root); + + //Get info + node_ptr super_root_right_backup = NodeTraits::get_right(super_root); + bool super_root_is_header = is_header(super_root); + bool old_root_is_right = is_right_child(old_root); + + //Put old_root as right child + NodeTraits::set_right(super_root, old_root); + + //Start the compression algorithm + node_ptr even_parent = super_root; + node_ptr new_root = old_root; + + while(count--){ + node_ptr even = NodeTraits::get_right(even_parent); + node_ptr odd = NodeTraits::get_right(even); + + if(new_root == old_root) + new_root = odd; + + node_ptr even_right = NodeTraits::get_left(odd); + NodeTraits::set_right(even, even_right); + if (even_right) + NodeTraits::set_parent(even_right, even); + + NodeTraits::set_right(even_parent, odd); + NodeTraits::set_parent(odd, even_parent); + NodeTraits::set_left(odd, even); + NodeTraits::set_parent(even, odd); + even_parent = odd; + } + + if(super_root_is_header){ + NodeTraits::set_parent(super_root, new_root); + NodeTraits::set_right(super_root, super_root_right_backup); + } + else if(old_root_is_right){ + NodeTraits::set_right(super_root, new_root); + } + else{ + NodeTraits::set_left(super_root, new_root); + NodeTraits::set_right(super_root, super_root_right_backup); + } + return new_root; + } + + //! Requires: "n" must be a node inserted in a tree. + //! + //! Effects: Returns a pointer to the header node of the tree. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + static node_ptr get_root(node_ptr node) + { + BOOST_INTRUSIVE_INVARIANT_ASSERT((!inited(node))); + node_ptr x = NodeTraits::get_parent(node); + if(x){ + while(!is_header(x)){ + x = NodeTraits::get_parent(x); + } + return x; + } + else{ + return node; + } + } + + private: + static void erase_impl(node_ptr header, node_ptr z, data_for_rebalance &info) + { + node_ptr y(z); + node_ptr x; + node_ptr x_parent(0); + node_ptr z_left(NodeTraits::get_left(z)); + node_ptr z_right(NodeTraits::get_right(z)); + if(!z_left){ + x = z_right; // x might be null. + } + else if(!z_right){ // z has exactly one non-null child. y == z. + x = z_left; // x is not null. + } + else{ + // find z's successor + y = tree_algorithms::minimum (z_right); + x = NodeTraits::get_right(y); // x might be null. + } + + if(y != z){ + // relink y in place of z. y is z's successor + NodeTraits::set_parent(NodeTraits::get_left(z), y); + NodeTraits::set_left(y, NodeTraits::get_left(z)); + if(y != NodeTraits::get_right(z)){ + x_parent = NodeTraits::get_parent(y); + if(x) + NodeTraits::set_parent(x, x_parent); + NodeTraits::set_left(x_parent, x); // y must be a child of left_ + NodeTraits::set_right(y, NodeTraits::get_right(z)); + NodeTraits::set_parent(NodeTraits::get_right(z), y); + } + else + x_parent = y; + tree_algorithms::replace_own (z, y, header); + NodeTraits::set_parent(y, NodeTraits::get_parent(z)); + } + else { // y == z --> z has only one child, or none + x_parent = NodeTraits::get_parent(z); + if(x) + NodeTraits::set_parent(x, x_parent); + tree_algorithms::replace_own (z, x, header); + if(NodeTraits::get_left(header) == z){ + NodeTraits::set_left(header, NodeTraits::get_right(z) == 0 ? // z->get_left() must be null also + NodeTraits::get_parent(z) : // makes leftmost == header if z == root + tree_algorithms::minimum (x)); + } + if(NodeTraits::get_right(header) == z){ + NodeTraits::set_right(header, NodeTraits::get_left(z) == 0 ? // z->get_right() must be null also + NodeTraits::get_parent(z) : // makes rightmost == header if z == root + tree_algorithms::maximum(x)); + } + } + + info.x = x; + info.x_parent = x_parent; + info.y = y; + } +}; + +} //namespace detail { +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_TREE_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/tree_node.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/tree_node.hpp new file mode 100644 index 0000000000..a375cbae56 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/tree_node.hpp @@ -0,0 +1,197 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_TREE_NODE_HPP +#define BOOST_INTRUSIVE_TREE_NODE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +template +struct tree_node +{ + typedef typename pointer_to_other + >::type node_ptr; + + node_ptr parent_, left_, right_; +}; + +template +struct tree_node_traits +{ + typedef tree_node node; + + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + static node_ptr get_parent(const_node_ptr n) + { return n->parent_; } + + static void set_parent(node_ptr n, node_ptr p) + { n->parent_ = p; } + + static node_ptr get_left(const_node_ptr n) + { return n->left_; } + + static void set_left(node_ptr n, node_ptr l) + { n->left_ = l; } + + static node_ptr get_right(const_node_ptr n) + { return n->right_; } + + static void set_right(node_ptr n, node_ptr r) + { n->right_ = r; } +}; + +///////////////////////////////////////////////////////////////////////////// +// // +// Implementation of the tree iterator // +// // +///////////////////////////////////////////////////////////////////////////// + +// tree_iterator provides some basic functions for a +// node oriented bidirectional iterator: +template +class tree_iterator + : public std::iterator + < std::bidirectional_iterator_tag + , typename detail::add_const_if_c + ::type + > +{ + protected: + typedef typename Container::real_value_traits real_value_traits; + typedef typename Container::node_algorithms node_algorithms; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + typedef typename boost::pointer_to_other + ::type void_pointer; + static const bool store_container_ptr = + detail::store_cont_ptr_on_it::value; + + public: + public: + typedef typename detail::add_const_if_c + + ::type value_type; + typedef value_type & reference; + typedef value_type * pointer; + + tree_iterator() + : members_ (0, 0) + {} + + explicit tree_iterator(node_ptr node, const Container *cont_ptr) + : members_ (node, cont_ptr) + {} + + tree_iterator(tree_iterator const& other) + : members_(other.pointed_node(), other.get_container()) + {} + + const node_ptr &pointed_node() const + { return members_.nodeptr_; } + + tree_iterator &operator=(const node_ptr &node) + { members_.nodeptr_ = node; return static_cast(*this); } + + public: + tree_iterator& operator++() + { + members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_); + return static_cast (*this); + } + + tree_iterator operator++(int) + { + tree_iterator result (*this); + members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_); + return result; + } + + tree_iterator& operator--() + { + members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_); + return static_cast (*this); + } + + tree_iterator operator--(int) + { + tree_iterator result (*this); + members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_); + return result; + } + + bool operator== (const tree_iterator& i) const + { return members_.nodeptr_ == i.pointed_node(); } + + bool operator!= (const tree_iterator& i) const + { return !operator== (i); } + + value_type& operator*() const + { return *operator->(); } + + pointer operator->() const + { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } + + const Container *get_container() const + { + if(store_container_ptr) + return static_cast(members_.get_ptr()); + else + return 0; + } + + const real_value_traits *get_real_value_traits() const + { + if(store_container_ptr) + return &this->get_container()->get_real_value_traits(); + else + return 0; + } + + tree_iterator end_iterator_from_it() const + { + return tree_iterator(node_algorithms::get_header(this->pointed_node()), this->get_container()); + } + + private: + struct members + : public detail::select_constptr + ::type + { + typedef typename detail::select_constptr + ::type Base; + + members(const node_ptr &n_ptr, const void *cont) + : Base(cont), nodeptr_(n_ptr) + {} + + node_ptr nodeptr_; + } members_; +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_TREE_NODE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/utilities.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/utilities.hpp new file mode 100644 index 0000000000..7a92449b9c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/utilities.hpp @@ -0,0 +1,629 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP +#define BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { +namespace detail { + +template +struct internal_member_value_traits +{ + template static detail::one test(...); + template static detail::two test(typename U::member_value_traits* = 0); + static const bool value = sizeof(test(0)) == sizeof(detail::two); +}; + +template +struct internal_base_hook_bool +{ + template + struct two_or_three {one _[2 + Add];}; + template static one test(...); + template static two_or_three + test (detail::bool_* = 0); + static const std::size_t value = sizeof(test(0)); +}; + +template +struct internal_base_hook_bool_is_true +{ + static const bool value = internal_base_hook_bool::value > sizeof(one)*2; +}; + +template +struct internal_any_hook_bool +{ + template + struct two_or_three {one _[2 + Add];}; + template static one test(...); + template static two_or_three + test (detail::bool_* = 0); + static const std::size_t value = sizeof(test(0)); +}; + +template +struct internal_any_hook_bool_is_true +{ + static const bool value = internal_any_hook_bool::value > sizeof(one)*2; +}; + + +template +struct external_value_traits_bool +{ + template + struct two_or_three {one _[2 + Add];}; + template static one test(...); + template static two_or_three + test (detail::bool_* = 0); + static const std::size_t value = sizeof(test(0)); +}; + +template +struct external_bucket_traits_bool +{ + template + struct two_or_three {one _[2 + Add];}; + template static one test(...); + template static two_or_three + test (detail::bool_* = 0); + static const std::size_t value = sizeof(test(0)); +}; + +template +struct external_value_traits_is_true +{ + static const bool value = external_value_traits_bool::value > sizeof(one)*2; +}; + +template +struct node_holder + : public Node +{}; + +template +struct smart_ptr_type +{ + typedef typename SmartPtr::value_type value_type; + typedef value_type *pointer; + static pointer get (const SmartPtr &smartptr) + { return smartptr.get();} +}; + +template +struct smart_ptr_type +{ + typedef T value_type; + typedef value_type *pointer; + static pointer get (pointer ptr) + { return ptr;} +}; + +//!Overload for smart pointers to avoid ADL problems with get_pointer +template +inline typename smart_ptr_type::pointer +get_pointer(const Ptr &ptr) +{ return smart_ptr_type::get(ptr); } + +//This functor compares a stored value +//and the one passed as an argument +template +class equal_to_value +{ + ConstReference t_; + + public: + equal_to_value(ConstReference t) + : t_(t) + {} + + bool operator()(ConstReference t)const + { return t_ == t; } +}; + +class null_disposer +{ + public: + template + void operator()(Pointer) + {} +}; + +template +class init_disposer +{ + typedef typename NodeAlgorithms::node_ptr node_ptr; + + public: + void operator()(node_ptr p) + { NodeAlgorithms::init(p); } +}; + +template +struct size_holder +{ + static const bool constant_time_size = ConstantSize; + typedef SizeType size_type; + + SizeType get_size() const + { return size_; } + + void set_size(SizeType size) + { size_ = size; } + + void decrement() + { --size_; } + + void increment() + { ++size_; } + + SizeType size_; +}; + +template +struct size_holder +{ + static const bool constant_time_size = false; + typedef SizeType size_type; + + size_type get_size() const + { return 0; } + + void set_size(size_type) + {} + + void decrement() + {} + + void increment() + {} +}; + +template +struct key_nodeptr_comp + : private detail::ebo_functor_holder +{ + typedef typename Container::real_value_traits real_value_traits; + typedef typename real_value_traits::node_ptr node_ptr; + typedef detail::ebo_functor_holder base_t; + key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont) + : base_t(kcomp), cont_(cont) + {} + + template + bool operator()(node_ptr node, const KeyType &key) const + { return base_t::get()(*cont_->get_real_value_traits().to_value_ptr(node), key); } + + template + bool operator()(const KeyType &key, node_ptr node) const + { return base_t::get()(key, *cont_->get_real_value_traits().to_value_ptr(node)); } + + bool operator()(node_ptr node1, node_ptr node2) const + { + return base_t::get() + ( *cont_->get_real_value_traits().to_value_ptr(node1) + , *cont_->get_real_value_traits().to_value_ptr(node2) + ); + } + + const Container *cont_; +}; + +template +struct node_cloner + : private detail::ebo_functor_holder +{ + typedef typename Container::real_value_traits real_value_traits; + typedef typename Container::node_algorithms node_algorithms; + typedef typename real_value_traits::value_type value_type; + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::node_traits::node node; + typedef typename real_value_traits::node_ptr node_ptr; + typedef typename real_value_traits::const_node_ptr const_node_ptr; + typedef detail::ebo_functor_holder base_t; + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + node_cloner(F f, const Container *cont) + : base_t(f), cont_(cont) + {} + + node_ptr operator()(node_ptr p) + { return this->operator()(*p); } + + node_ptr operator()(const node &to_clone) + { + const value_type &v = + *cont_->get_real_value_traits().to_value_ptr(const_node_ptr(&to_clone)); + node_ptr n = cont_->get_real_value_traits().to_node_ptr(*base_t::get()(v)); + //Cloned node must be in default mode if the linking mode requires it + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n)); + return n; + } + + const Container *cont_; +}; + +template +struct node_disposer + : private detail::ebo_functor_holder +{ + typedef typename Container::real_value_traits real_value_traits; + typedef typename real_value_traits::node_ptr node_ptr; + typedef detail::ebo_functor_holder base_t; + typedef typename Container::node_algorithms node_algorithms; + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + node_disposer(F f, const Container *cont) + : base_t(f), cont_(cont) + {} + + void operator()(node_ptr p) + { + if(safemode_or_autounlink) + node_algorithms::init(p); + base_t::get()(cont_->get_real_value_traits().to_value_ptr(p)); + } + const Container *cont_; +}; + +struct dummy_constptr +{ + dummy_constptr(const void *) + {} + + const void *get_ptr() const + { return 0; } +}; + +template +struct constptr +{ + typedef typename boost::pointer_to_other + ::type ConstVoidPtr; + + constptr(const void *ptr) + : const_void_ptr_(ptr) + {} + + const void *get_ptr() const + { return detail::get_pointer(const_void_ptr_); } + + ConstVoidPtr const_void_ptr_; +}; + +template +struct select_constptr +{ + typedef typename detail::if_c + < store_ptr + , constptr + , dummy_constptr + >::type type; +}; + +template +struct store_cont_ptr_on_it +{ + typedef typename Container::value_traits value_traits; + static const bool value = + !detail::is_empty_class::value + || detail::external_value_traits_is_true::value + ; +}; + +template +struct add_const_if_c +{ + typedef typename detail::if_c + < Add + , typename detail::add_const::type + , T + >::type type; +}; + +template +struct node_to_value + : public detail::select_constptr + < typename boost::pointer_to_other + ::type + , detail::store_cont_ptr_on_it::value + >::type +{ + static const bool store_container_ptr = + detail::store_cont_ptr_on_it::value; + + typedef typename Container::real_value_traits real_value_traits; + typedef typename real_value_traits::value_type value_type; + typedef typename detail::select_constptr + < typename boost::pointer_to_other + ::type + , store_container_ptr >::type Base; + typedef typename real_value_traits::node_traits::node node; + typedef typename detail::add_const_if_c + ::type vtype; + typedef typename detail::add_const_if_c + ::type ntype; + typedef typename boost::pointer_to_other + ::type npointer; + + node_to_value(const Container *cont) + : Base(cont) + {} + + typedef vtype & result_type; + typedef ntype & first_argument_type; + + const Container *get_container() const + { + if(store_container_ptr) + return static_cast(Base::get_ptr()); + else + return 0; + } + + const real_value_traits *get_real_value_traits() const + { + if(store_container_ptr) + return &this->get_container()->get_real_value_traits(); + else + return 0; + } + + result_type operator()(first_argument_type arg) const + { return *(this->get_real_value_traits()->to_value_ptr(npointer(&arg))); } +}; + +template +struct link_dispatch +{}; + +template +void destructor_impl(Hook &hook, detail::link_dispatch) +{ //If this assertion raises, you might have destroyed an object + //while it was still inserted in a container that is alive. + //If so, remove the object from the container before destroying it. + (void)hook; BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT(!hook.is_linked()); +} + +template +void destructor_impl(Hook &hook, detail::link_dispatch) +{ hook.unlink(); } + +template +void destructor_impl(Hook &, detail::link_dispatch) +{} + +template +struct base_hook_traits +{ + public: + typedef detail::node_holder + node_holder; + typedef NodeTraits node_traits; + typedef T value_type; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename boost::pointer_to_other::type pointer; + typedef typename boost::pointer_to_other::type const_pointer; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + static const link_mode_type link_mode = LinkMode; + + static node_ptr to_node_ptr(reference value) + { return static_cast(&value); } + + static const_node_ptr to_node_ptr(const_reference value) + { return static_cast(&value); } + + static pointer to_value_ptr(node_ptr n) + { return static_cast(static_cast(&*n)); } + + static const_pointer to_value_ptr(const_node_ptr n) + { return static_cast(static_cast(&*n)); } +}; + +template +struct member_hook_traits +{ + public: + typedef Hook hook_type; + typedef typename hook_type::boost_intrusive_tags::node_traits node_traits; + typedef typename node_traits::node node; + typedef T value_type; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename boost::pointer_to_other::type pointer; + typedef typename boost::pointer_to_other::type const_pointer; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + static const link_mode_type link_mode = Hook::boost_intrusive_tags::link_mode; + + static node_ptr to_node_ptr(reference value) + { + return reinterpret_cast(&(value.*P)); + } + + static const_node_ptr to_node_ptr(const_reference value) + { + return static_cast(&(value.*P)); + } + + static pointer to_value_ptr(node_ptr n) + { + return detail::parent_from_member + (static_cast(detail::get_pointer(n)), P); + } + + static const_pointer to_value_ptr(const_node_ptr n) + { + return detail::parent_from_member + (static_cast(detail::get_pointer(n)), P); + } +}; + +//This function uses binary search to discover the +//highest set bit of the integer +inline std::size_t floor_log2 (std::size_t x) +{ + const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT; + const bool Size_t_Bits_Power_2= !(Bits & (Bits-1)); + BOOST_STATIC_ASSERT(Size_t_Bits_Power_2); + + std::size_t n = x; + std::size_t log2 = 0; + + for(std::size_t shift = Bits >> 1; shift; shift >>= 1){ + std::size_t tmp = n >> shift; + if (tmp) + log2 += shift, n = tmp; + } + + return log2; +} + +inline float fast_log2 (float val) +{ + boost::uint32_t * exp_ptr = + static_cast(static_cast(&val)); + boost::uint32_t x = *exp_ptr; + const int log_2 = (int)(((x >> 23) & 255) - 128); + x &= ~(255 << 23); + x += 127 << 23; + *exp_ptr = x; + + val = ((-1.0f/3) * val + 2) * val - 2.0f/3; + + return (val + log_2); +} + +inline std::size_t ceil_log2 (std::size_t x) +{ + return ((x & (x-1))!= 0) + floor_log2(x); +} + +template +struct numbits_eq +{ + static const bool value = sizeof(SizeType)*CHAR_BIT == N; +}; + +template +struct sqrt2_pow_max; + +template +struct sqrt2_pow_max >::type> +{ + static const boost::uint32_t value = 0xb504f334; + static const std::size_t pow = 31; +}; + +template +struct sqrt2_pow_max >::type> +{ + static const boost::uint64_t value = 0xb504f333f9de6484ull; + static const std::size_t pow = 63; +}; + +// Returns floor(pow(sqrt(2), x * 2 + 1)). +// Defined for X from 0 up to the number of bits in size_t minus 1. +inline std::size_t sqrt2_pow_2xplus1 (std::size_t x) +{ + const std::size_t value = (std::size_t)sqrt2_pow_max::value; + const std::size_t pow = (std::size_t)sqrt2_pow_max::pow; + return (value >> (pow - x)) + 1; +} + +template +class exception_disposer +{ + Container *cont_; + Disposer &disp_; + + exception_disposer(const exception_disposer&); + exception_disposer &operator=(const exception_disposer&); + + public: + exception_disposer(Container &cont, Disposer &disp) + : cont_(&cont), disp_(disp) + {} + + void release() + { cont_ = 0; } + + ~exception_disposer() + { + if(cont_){ + cont_->clear_and_dispose(disp_); + } + } +}; + +template +class exception_array_disposer +{ + Container *cont_; + Disposer &disp_; + typename Container::size_type &constructed_; + + exception_array_disposer(const exception_array_disposer&); + exception_array_disposer &operator=(const exception_array_disposer&); + + public: + typedef typename Container::size_type size_type; + exception_array_disposer + (Container &cont, Disposer &disp, size_type &constructed) + : cont_(&cont), disp_(disp), constructed_(constructed) + {} + + void release() + { cont_ = 0; } + + ~exception_array_disposer() + { + size_type n = constructed_; + if(cont_){ + while(n--){ + cont_[n].clear_and_dispose(disp_); + } + } + } +}; + +} //namespace detail +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_DETAIL_UTILITIES_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/workaround.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/workaround.hpp new file mode 100644 index 0000000000..a4c0974893 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/detail/workaround.hpp @@ -0,0 +1,30 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2008. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP +#define BOOST_INTRUSIVE_DETAIL_WRKRND_HPP + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) +// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are +// passed on the command line, which in turn defines +// __GXX_EXPERIMENTAL_CXX0X__. Note: __GXX_EXPERIMENTAL_CPP0X__ is +// defined by some very early development versions of GCC 4.3; we will +// remove this part of the check in the near future. +# if defined(__GXX_EXPERIMENTAL_CPP0X__) || defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_INTRUSIVE_RVALUE_REFERENCE +# define BOOST_INTRUSIVE_VARIADIC_TEMPLATES +# endif +#endif + +#if defined(BOOST_INTRUSIVE_RVALUE_REFERENCE) && defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +#define BOOST_INTRUSIVE_PERFECT_FORWARDING +#endif + +#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/hashtable.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/hashtable.hpp new file mode 100644 index 0000000000..c0ef630e6a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/hashtable.hpp @@ -0,0 +1,2986 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_HASHTABLE_HPP +#define BOOST_INTRUSIVE_HASHTABLE_HPP + +#include +//std C++ +#include //std::equal_to +#include //std::pair +#include //std::swap, std::lower_bound, std::upper_bound +#include //std::size_t +#include //std::iterator_traits +//boost +#include +#include +#include +//General intrusive utilities +#include +#include +#include +#include +#include +#include +//Implementation utilities +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond + +namespace detail { + +struct hash_bool_flags +{ + static const std::size_t unique_keys_pos = 1u; + static const std::size_t constant_time_size_pos = 2u; + static const std::size_t power_2_buckets_pos = 4u; + static const std::size_t cache_begin_pos = 8u; + static const std::size_t compare_hash_pos = 16u; + static const std::size_t incremental_pos = 32u; +}; + +template + < class ValueTraits + , class Hash + , class Equal + , class SizeType + , class BucketTraits + , std::size_t BoolFlags + > +struct usetopt +{ + typedef ValueTraits value_traits; + typedef Hash hash; + typedef Equal equal; + typedef SizeType size_type; + typedef BucketTraits bucket_traits; + static const std::size_t bool_flags = BoolFlags; +}; + +template + < class UsetOpt + , std::size_t BoolMask + > +struct usetopt_mask +{ + typedef usetopt + type; +}; + +template +struct hash_reduced_slist_node_traits +{ + template static detail::one test(...); + template static detail::two test(typename U::reduced_slist_node_traits* = 0); + static const bool value = sizeof(test(0)) == sizeof(detail::two); +}; + +template +struct apply_reduced_slist_node_traits +{ + typedef typename NodeTraits::reduced_slist_node_traits type; +}; + +template +struct reduced_slist_node_traits +{ + typedef typename detail::eval_if_c + < hash_reduced_slist_node_traits::value + , apply_reduced_slist_node_traits + , detail::identity + >::type type; +}; + +template +struct get_slist_impl +{ + typedef trivial_value_traits trivial_traits; + + //Reducing symbol length + struct type : make_slist + < typename NodeTraits::node + , boost::intrusive::value_traits + , boost::intrusive::constant_time_size + , boost::intrusive::size_type + >::type + {}; +}; + +template +struct real_from_supposed_value_traits +{ + typedef typename detail::eval_if_c + < detail::external_value_traits_is_true + ::value + , detail::eval_value_traits + + , detail::identity + + >::type type; +}; + +template +struct get_slist_impl_from_supposed_value_traits +{ + typedef typename + real_from_supposed_value_traits + < SupposedValueTraits>::type real_value_traits; + typedef typename detail::get_node_traits + ::type node_traits; + typedef typename get_slist_impl + ::type + >::type type; +}; + +template +struct unordered_bucket_impl +{ + /// @cond + typedef typename + get_slist_impl_from_supposed_value_traits + ::type slist_impl; + typedef detail::bucket_impl implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +template +struct unordered_bucket_ptr_impl +{ + /// @cond + typedef typename detail::get_node_traits + ::type::node_ptr node_ptr; + typedef typename unordered_bucket_impl + ::type bucket_type; + typedef typename boost::pointer_to_other + ::type implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +template +struct store_hash_bool +{ + template + struct two_or_three {one _[2 + Add];}; + template static one test(...); + template static two_or_three + test (detail::bool_* = 0); + static const std::size_t value = sizeof(test(0)); +}; + +template +struct store_hash_is_true +{ + static const bool value = store_hash_bool::value > sizeof(one)*2; +}; + +template +struct optimize_multikey_bool +{ + template + struct two_or_three {one _[2 + Add];}; + template static one test(...); + template static two_or_three + test (detail::bool_* = 0); + static const std::size_t value = sizeof(test(0)); +}; + +template +struct optimize_multikey_is_true +{ + static const bool value = optimize_multikey_bool::value > sizeof(one)*2; +}; + +template +struct bucket_plus_size + : public detail::size_holder + < 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos) + , typename Config::size_type> +{ + typedef detail::size_holder + < 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos) + , typename Config::size_type> size_traits; + typedef typename Config::bucket_traits bucket_traits; + + bucket_plus_size(const bucket_traits &b_traits) + : bucket_traits_(b_traits) + {} + bucket_traits bucket_traits_; +}; + +template +struct bucket_hash_t + : public detail::ebo_functor_holder +{ + typedef typename Config::hash hasher; + typedef detail::size_holder + < 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos) + , typename Config::size_type> size_traits; + typedef typename Config::bucket_traits bucket_traits; + + bucket_hash_t(const bucket_traits &b_traits, const hasher & h) + : detail::ebo_functor_holder(h), bucket_plus_size_(b_traits) + {} + + bucket_plus_size bucket_plus_size_; +}; + +template +struct bucket_hash_equal_t : public detail::ebo_functor_holder +{ + typedef typename Config::equal equal; + typedef typename Config::hash hasher; + typedef typename Config::bucket_traits bucket_traits; + + bucket_hash_equal_t(const bucket_traits &b_traits, const hasher & h, const equal &e) + : detail::ebo_functor_holder(e), bucket_hash(b_traits, h) + {} + bucket_hash_t bucket_hash; +}; + +template //cache_begin == true version +struct bucket_hash_equal_t + : public detail::ebo_functor_holder +{ + typedef typename Config::equal equal; + typedef typename Config::hash hasher; + typedef typename Config::bucket_traits bucket_traits; + typedef typename unordered_bucket_ptr_impl + ::type bucket_ptr; + + bucket_hash_equal_t(const bucket_traits &b_traits, const hasher & h, const equal &e) + : detail::ebo_functor_holder(e), bucket_hash(b_traits, h) + {} + bucket_hash_t bucket_hash; + bucket_ptr cached_begin_; +}; + +template +struct hashtable_data_t : public Config::value_traits +{ + static const std::size_t bool_flags = Config::bool_flags; + typedef typename Config::value_traits value_traits; + typedef typename Config::equal equal; + typedef typename Config::hash hasher; + typedef typename Config::bucket_traits bucket_traits; + + hashtable_data_t( const bucket_traits &b_traits, const hasher & h + , const equal &e, const value_traits &val_traits) + : Config::value_traits(val_traits), internal_(b_traits, h, e) + {} + typedef typename detail::usetopt_mask + < Config + , detail::hash_bool_flags::constant_time_size_pos + | detail::hash_bool_flags::incremental_pos + >::type masked_config_t; + struct internal + : public detail::size_holder + < 0 != (Config::bool_flags & hash_bool_flags::incremental_pos) + , typename Config::size_type> + { + internal(const bucket_traits &b_traits, const hasher & h, const equal &e) + : bucket_hash_equal_(b_traits, h, e) + {} + + bucket_hash_equal_t + < masked_config_t + , 0 != (bool_flags & hash_bool_flags::cache_begin_pos) + > bucket_hash_equal_; + } internal_; +}; + +struct insert_commit_data_impl +{ + std::size_t hash; +}; + +template +struct group_functions +{ + typedef NodeTraits node_traits; + typedef unordered_group_adapter group_traits; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::node node; + typedef typename reduced_slist_node_traits + ::type reduced_node_traits; + typedef typename reduced_node_traits::node_ptr slist_node_ptr; + typedef typename reduced_node_traits::node slist_node; + typedef circular_slist_algorithms group_algorithms; + + static node_ptr dcast_bucket_ptr(slist_node_ptr p) + { return node_ptr(&static_cast(*p)); } + + static slist_node_ptr priv_get_bucket_before_begin + (slist_node_ptr bucket_beg, slist_node_ptr bucket_end, node_ptr p) + { + //First find the last node of p's group. + //This requires checking the first node of the next group or + //the bucket node. + node_ptr prev_node = p; + node_ptr nxt(node_traits::get_next(p)); + while(!(bucket_beg <= nxt && nxt <= bucket_end) && + (group_traits::get_next(nxt) == prev_node)){ + prev_node = nxt; + nxt = node_traits::get_next(nxt); + } + + //If we've reached the bucket node just return it. + if(bucket_beg <= nxt && nxt <= bucket_end){ + return nxt; + } + + //Otherwise, iterate using group links until the bucket node + node_ptr first_node_of_group = nxt; + node_ptr last_node_group = group_traits::get_next(first_node_of_group); + slist_node_ptr possible_end = node_traits::get_next(last_node_group); + + while(!(bucket_beg <= possible_end && possible_end <= bucket_end)){ + first_node_of_group = dcast_bucket_ptr(possible_end); + last_node_group = group_traits::get_next(first_node_of_group); + possible_end = node_traits::get_next(last_node_group); + } + return possible_end; + } + + static node_ptr priv_get_prev_to_first_in_group(slist_node_ptr bucket_node, node_ptr first_in_group) + { + //Just iterate using group links and obtain the node + //before "first_in_group)" + node_ptr prev_node = dcast_bucket_ptr(bucket_node); + node_ptr nxt(node_traits::get_next(prev_node)); + while(nxt != first_in_group){ + prev_node = group_traits::get_next(nxt); + nxt = node_traits::get_next(prev_node); + } + return prev_node; + } + + static node_ptr priv_get_first_in_group_of_last_in_group(node_ptr last_in_group) + { + //Just iterate using group links and obtain the node + //before "last_in_group" + node_ptr possible_first = group_traits::get_next(last_in_group); + node_ptr possible_first_prev = group_traits::get_next(possible_first); + // The deleted node is at the end of the group, so the + // node in the group pointing to it is at the beginning + // of the group. Find that to change its pointer. + while(possible_first_prev != last_in_group){ + possible_first = possible_first_prev; + possible_first_prev = group_traits::get_next(possible_first); + } + return possible_first; + } + + + static void priv_erase_from_group(slist_node_ptr end_ptr, node_ptr to_erase_ptr, detail::true_) + { + node_ptr nxt_ptr(node_traits::get_next(to_erase_ptr)); + node_ptr prev_in_group_ptr(group_traits::get_next(to_erase_ptr)); + bool last_in_group = (end_ptr == nxt_ptr) || + (group_traits::get_next(nxt_ptr) != to_erase_ptr); + bool first_in_group = node_traits::get_next(prev_in_group_ptr) != to_erase_ptr; + + if(first_in_group && last_in_group){ + group_algorithms::init(to_erase_ptr); + } + else if(first_in_group){ + group_algorithms::unlink_after(nxt_ptr); + } + else if(last_in_group){ + node_ptr first_in_group = + priv_get_first_in_group_of_last_in_group(to_erase_ptr); + group_algorithms::unlink_after(first_in_group); + } + else{ + group_algorithms::unlink_after(nxt_ptr); + } + } + + static void priv_erase_from_group(slist_node_ptr, node_ptr, detail::false_) + {} + + static node_ptr priv_get_last_in_group(node_ptr first_in_group, detail::true_) + { return group_traits::get_next(first_in_group); } + + static node_ptr priv_get_last_in_group(node_ptr n, detail::false_) + { return n; } +}; + +template +class incremental_rehash_rollback +{ + private: + typedef BucketType bucket_type; + typedef SplitTraits split_traits; + + incremental_rehash_rollback(); + incremental_rehash_rollback & operator=(const incremental_rehash_rollback &); + incremental_rehash_rollback (const incremental_rehash_rollback &); + + public: + incremental_rehash_rollback + (bucket_type &source_bucket, bucket_type &destiny_bucket, split_traits &split_traits) + : source_bucket_(source_bucket), destiny_bucket_(destiny_bucket) + , split_traits_(split_traits), released_(false) + {} + + void release() + { released_ = true; } + + ~incremental_rehash_rollback() + { + if(!released_){ + //If an exception is thrown, just put all moved nodes back in the old bucket + //and move back the split mark. + destiny_bucket_.splice_after(destiny_bucket_.before_begin(), source_bucket_); + split_traits_.decrement(); + } + } + + private: + bucket_type &source_bucket_; + bucket_type &destiny_bucket_; + split_traits &split_traits_; + bool released_; +}; + +} //namespace detail { + +//!This metafunction will obtain the type of a bucket +//!from the value_traits or hook option to be used with +//!a hash container. +template +struct unordered_bucket + : public detail::unordered_bucket_impl + ::value_traits + > +{}; + +//!This metafunction will obtain the type of a bucket pointer +//!from the value_traits or hook option to be used with +//!a hash container. +template +struct unordered_bucket_ptr + : public detail::unordered_bucket_ptr_impl + ::value_traits + > +{}; + +//!This metafunction will obtain the type of the default bucket traits +//!(when the user does not specify the bucket_traits<> option) from the +//!value_traits or hook option to be used with +//!a hash container. +template +struct unordered_default_bucket_traits +{ + /// @cond + typedef typename ValueTraitsOrHookOption:: + template pack::value_traits supposed_value_traits; + typedef typename detail:: + get_slist_impl_from_supposed_value_traits + ::type slist_impl; + typedef detail::bucket_traits_impl + implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +struct default_bucket_traits; + +template +struct uset_defaults + : pack_options + < none + , base_hook + , constant_time_size + , size_type + , equal > + , hash > + , bucket_traits + , power_2_buckets + , cache_begin + , compare_hash + , incremental + >::type +{}; + +/// @endcond + +//! The class template hashtable is an intrusive hash table container, that +//! is used to construct intrusive unordered_set and unordered_multiset containers. The +//! no-throw guarantee holds only, if the Equal object and Hasher don't throw. +//! +//! hashtable is a semi-intrusive container: each object to be stored in the +//! container must contain a proper hook, but the container also needs +//! additional auxiliary memory to work: hashtable needs a pointer to an array +//! of type `bucket_type` to be passed in the constructor. This bucket array must +//! have at least the same lifetime as the container. This makes the use of +//! hashtable more complicated than purely intrusive containers. +//! `bucket_type` is default-constructible, copyable and assignable +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<> +//! \c bucket_traits<>, power_2_buckets<>, cache_begin<> and incremental<>. +//! +//! hashtable only provides forward iterators but it provides 4 iterator types: +//! iterator and const_iterator to navigate through the whole container and +//! local_iterator and const_local_iterator to navigate through the values +//! stored in a single bucket. Local iterators are faster and smaller. +//! +//! It's not recommended to use non constant-time size hashtables because several +//! key functions, like "empty()", become non-constant time functions. Non +//! constant_time size hashtables are mainly provided to support auto-unlink hooks. +//! +//! hashtables, does not make automatic rehashings nor +//! offers functions related to a load factor. Rehashing can be explicitly requested +//! and the user must provide a new bucket array that will be used from that moment. +//! +//! Since no automatic rehashing is done, iterators are never invalidated when +//! inserting or erasing elements. Iterators are only invalidated when rehashing. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class hashtable_impl +{ + public: + typedef typename Config::value_traits value_traits; + + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + typedef typename Config::bucket_traits bucket_traits; + static const bool external_bucket_traits = + detail::external_bucket_traits_is_true::value; + typedef typename detail::eval_if_c + < external_bucket_traits + , detail::eval_bucket_traits + , detail::identity + >::type real_bucket_traits; + typedef typename detail::get_slist_impl + ::type + >::type slist_impl; + /// @endcond + + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::const_pointer const_pointer; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename Config::size_type size_type; + typedef value_type key_type; + typedef typename Config::equal key_equal; + typedef typename Config::hash hasher; + typedef detail::bucket_impl bucket_type; + typedef typename boost::pointer_to_other + ::type bucket_ptr; + typedef typename slist_impl::iterator siterator; + typedef typename slist_impl::const_iterator const_siterator; + typedef detail::hashtable_iterator iterator; + typedef detail::hashtable_iterator const_iterator; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef typename slist_impl::node_algorithms node_algorithms; + + static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; + static const bool store_hash = detail::store_hash_is_true::value; + + static const bool unique_keys = 0 != (Config::bool_flags & detail::hash_bool_flags::unique_keys_pos); + static const bool constant_time_size = 0 != (Config::bool_flags & detail::hash_bool_flags::constant_time_size_pos); + static const bool cache_begin = 0 != (Config::bool_flags & detail::hash_bool_flags::cache_begin_pos); + static const bool compare_hash = 0 != (Config::bool_flags & detail::hash_bool_flags::compare_hash_pos); + static const bool incremental = 0 != (Config::bool_flags & detail::hash_bool_flags::incremental_pos); + static const bool power_2_buckets = incremental || (0 != (Config::bool_flags & detail::hash_bool_flags::power_2_buckets_pos)); + + static const bool optimize_multikey + = detail::optimize_multikey_is_true::value && !unique_keys; + + /// @cond + private: + + //Configuration error: compare_hash<> can't be specified without store_hash<> + //See documentation for more explanations + BOOST_STATIC_ASSERT((!compare_hash || store_hash)); + + typedef typename slist_impl::node_ptr slist_node_ptr; + typedef typename boost::pointer_to_other + ::type void_pointer; + //We'll define group traits, but these won't be instantiated if + //optimize_multikey is not true + typedef unordered_group_adapter group_traits; + typedef circular_slist_algorithms group_algorithms; + typedef detail::bool_ store_hash_t; + typedef detail::bool_ optimize_multikey_t; + typedef detail::bool_ cache_begin_t; + typedef detail::bool_ power_2_buckets_t; + typedef detail::size_holder size_traits; + typedef detail::size_holder split_traits; + typedef detail::group_functions group_functions_t; + + static const std::size_t hashtable_data_bool_flags_mask = + ( detail::hash_bool_flags::cache_begin_pos + | detail::hash_bool_flags::constant_time_size_pos + | detail::hash_bool_flags::incremental_pos + ); + typedef typename detail::usetopt_mask + ::type masked_config_t; + detail::hashtable_data_t data_; + + template + struct downcast_node_to_value + : public detail::node_to_value + { + typedef detail::node_to_value base_t; + typedef typename base_t::result_type result_type; + typedef typename detail::add_const_if_c + ::type &first_argument_type; + typedef typename detail::add_const_if_c + ::type &intermediate_argument_type; + + downcast_node_to_value(const hashtable_impl *cont) + : base_t(cont) + {} + + result_type operator()(first_argument_type arg) const + { return this->base_t::operator()(static_cast(arg)); } + }; + + template + struct node_cast_adaptor + : private detail::ebo_functor_holder + { + typedef detail::ebo_functor_holder base_t; + + template + node_cast_adaptor(const ConvertibleToF &c2f, const hashtable_impl *cont) + : base_t(base_t(c2f, cont)) + {} + + typename base_t::node_ptr operator()(const typename slist_impl::node &to_clone) + { return base_t::operator()(static_cast(to_clone)); } + + void operator()(typename slist_impl::node_ptr to_clone) + { base_t::operator()(node_ptr(&static_cast(*to_clone))); } + }; + + private: + //noncopyable + hashtable_impl (const hashtable_impl&); + hashtable_impl operator =(const hashtable_impl&); + + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + //Constant-time size is incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink))); + + template + node_cast_adaptor > + make_node_disposer(const Disposer &disposer) const + { return node_cast_adaptor >(disposer, this); } + + /// @endcond + + public: + typedef detail::insert_commit_data_impl insert_commit_data; + + typedef detail::transform_iterator + < typename slist_impl::iterator + , downcast_node_to_value > local_iterator; + + typedef detail::transform_iterator + < typename slist_impl::iterator + , downcast_node_to_value > const_local_iterator; + + /// @cond + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return this->data_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_.get_value_traits(*this); } + + real_value_traits &get_real_value_traits(detail::bool_) + { return this->data_; } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_.get_value_traits(*this); } + + /// @endcond + + public: + + const real_value_traits &get_real_value_traits() const + { return this->get_real_value_traits(detail::bool_()); } + + real_value_traits &get_real_value_traits() + { return this->get_real_value_traits(detail::bool_()); } + + //! Requires: buckets must not be being used by any other resource. + //! + //! Effects: Constructs an empty unordered_set, storing a reference + //! to the bucket array and copies of the key_hasher and equal_func functors. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor or invocation of hash_func or equal_func throws. + //! + //! Notes: buckets array must be disposed only after + //! *this is disposed. + hashtable_impl ( const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : data_(b_traits, hash_func, equal_func, v_traits) + { + priv_initialize_buckets(); + this->priv_size_traits().set_size(size_type(0)); + size_type bucket_size = this->priv_buckets_len(); + BOOST_INTRUSIVE_INVARIANT_ASSERT(bucket_size != 0); + //Check power of two bucket array if the option is activated + BOOST_INTRUSIVE_INVARIANT_ASSERT + (!power_2_buckets || (0 == (bucket_size & (bucket_size-1)))); + priv_split_traits().set_size(bucket_size>>1); + } + + //! Effects: Detaches all elements from this. The objects in the unordered_set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements in the unordered_set, if + //! it's a safe-mode or auto-unlink value. Otherwise constant. + //! + //! Throws: Nothing. + ~hashtable_impl() + { this->clear(); } + + //! Effects: Returns an iterator pointing to the beginning of the unordered_set. + //! + //! Complexity: Amortized constant time. + //! Worst case (empty unordered_set): O(this->bucket_count()) + //! + //! Throws: Nothing. + iterator begin() + { return iterator(this->priv_begin(), this); } + + //! Effects: Returns a const_iterator pointing to the beginning + //! of the unordered_set. + //! + //! Complexity: Amortized constant time. + //! Worst case (empty unordered_set): O(this->bucket_count()) + //! + //! Throws: Nothing. + const_iterator begin() const + { return this->cbegin(); } + + //! Effects: Returns a const_iterator pointing to the beginning + //! of the unordered_set. + //! + //! Complexity: Amortized constant time. + //! Worst case (empty unordered_set): O(this->bucket_count()) + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return const_iterator(this->priv_begin(), this); } + + //! Effects: Returns an iterator pointing to the end of the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return iterator(priv_invalid_local_it(), 0); } + + //! Effects: Returns a const_iterator pointing to the end of the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return this->cend(); } + + //! Effects: Returns a const_iterator pointing to the end of the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return const_iterator(priv_invalid_local_it(), 0); } + + //! Effects: Returns the hasher object used by the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: If hasher copy-constructor throws. + hasher hash_function() const + { return this->priv_hasher(); } + + //! Effects: Returns the key_equal object used by the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: If key_equal copy-constructor throws. + key_equal key_eq() const + { return this->priv_equal(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: if constant-time size and cache_last options are disabled, + //! average constant time (worst case, with empty() == true: O(this->bucket_count()). + //! Otherwise constant. + //! + //! Throws: Nothing. + bool empty() const + { + if(constant_time_size){ + return !this->size(); + } + else if(cache_begin){ + return this->begin() == this->end(); + } + else{ + size_type buckets_len = this->priv_buckets_len(); + const bucket_type *b = detail::get_pointer(this->priv_buckets()); + for (size_type n = 0; n < buckets_len; ++n, ++b){ + if(!b->empty()){ + return false; + } + } + return true; + } + } + + //! Effects: Returns the number of elements stored in the unordered_set. + //! + //! Complexity: Linear to elements contained in *this if + //! constant_time_size is false. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { + if(constant_time_size) + return this->priv_size_traits().get_size(); + else{ + size_type len = 0; + size_type buckets_len = this->priv_buckets_len(); + const bucket_type *b = detail::get_pointer(this->priv_buckets()); + for (size_type n = 0; n < buckets_len; ++n, ++b){ + len += b->size(); + } + return len; + } + } + + //! Requires: the hasher and the equality function unqualified swap + //! call should not throw. + //! + //! Effects: Swaps the contents of two unordered_sets. + //! Swaps also the contained bucket array and equality and hasher functors. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison or hash functors + //! found using ADL throw. Basic guarantee. + void swap(hashtable_impl& other) + { + using std::swap; + //These can throw + swap(this->priv_equal(), other.priv_equal()); + swap(this->priv_hasher(), other.priv_hasher()); + //These can't throw + swap(this->priv_real_bucket_traits(), other.priv_real_bucket_traits()); + priv_swap_cache(cache_begin_t(), other); + if(constant_time_size){ + size_type backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(other.priv_size_traits().get_size()); + other.priv_size_traits().set_size(backup); + } + else if(incremental){ + size_type backup = this->priv_split_traits().get_size(); + this->priv_split_traits().set_size(other.priv_split_traits().get_size()); + other.priv_split_traits().set_size(backup); + } + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw + //! Cloner should yield to nodes that compare equal and produce the same + //! hash than the original node. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. The hash function and the equality + //! predicate are copied from the source. + //! + //! If store_hash option is true, this method does not use the hash function. + //! + //! If any operation throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner or hasher throw or hash or equality predicate copying + //! throws. Basic guarantee. + template + void clone_from(const hashtable_impl &src, Cloner cloner, Disposer disposer) + { + this->clear_and_dispose(disposer); + if(!constant_time_size || !src.empty()){ + const size_type src_bucket_count = src.bucket_count(); + const size_type dst_bucket_count = this->bucket_count(); + //Check power of two bucket array if the option is activated + BOOST_INTRUSIVE_INVARIANT_ASSERT + (!power_2_buckets || (0 == (src_bucket_count & (src_bucket_count-1)))); + BOOST_INTRUSIVE_INVARIANT_ASSERT + (!power_2_buckets || (0 == (dst_bucket_count & (dst_bucket_count-1)))); + + //If src bucket count is bigger or equal, structural copy is possible + if(!incremental && (src_bucket_count >= dst_bucket_count)){ + //First clone the first ones + const bucket_ptr src_buckets = src.priv_buckets(); + const bucket_ptr dst_buckets = this->priv_buckets(); + size_type constructed; + typedef node_cast_adaptor > NodeDisposer; + typedef node_cast_adaptor > NodeCloner; + NodeDisposer node_disp(disposer, this); + + detail::exception_array_disposer + rollback(dst_buckets[0], node_disp, constructed); + for( constructed = 0 + ; constructed < dst_bucket_count + ; ++constructed){ + dst_buckets[constructed].clone_from + ( src_buckets[constructed] + , NodeCloner(cloner, this), node_disp); + } + if(src_bucket_count != dst_bucket_count){ + //Now insert the remaining ones using the modulo trick + for(//"constructed" comes from the previous loop + ; constructed < src_bucket_count + ; ++constructed){ + bucket_type &dst_b = + dst_buckets[priv_hash_to_bucket(constructed, dst_bucket_count, dst_bucket_count)]; + bucket_type &src_b = src_buckets[constructed]; + for( siterator b(src_b.begin()), e(src_b.end()) + ; b != e + ; ++b){ + dst_b.push_front(*(NodeCloner(cloner, this)(*b.pointed_node()))); + } + } + } + this->priv_hasher() = src.priv_hasher(); + this->priv_equal() = src.priv_equal(); + rollback.release(); + this->priv_size_traits().set_size(src.priv_size_traits().get_size()); + this->priv_split_traits().set_size(dst_bucket_count); + priv_insertion_update_cache(0u); + priv_erasure_update_cache(); + } + else if(store_hash){ + //Unlike previous cloning algorithm, this can throw + //if cloner, hasher or comparison functor throw + const_iterator b(src.begin()), e(src.end()); + detail::exception_disposer + rollback(*this, disposer); + for(; b != e; ++b){ + std::size_t hash_value = this->priv_stored_or_compute_hash(*b, store_hash_t());; + this->priv_insert_equal_with_hash(*cloner(*b), hash_value); + } + rollback.release(); + } + else{ + //Unlike previous cloning algorithm, this can throw + //if cloner, hasher or comparison functor throw + const_iterator b(src.begin()), e(src.end()); + detail::exception_disposer + rollback(*this, disposer); + for(; b != e; ++b){ + this->insert_equal(*cloner(*b)); + } + rollback.release(); + } + } + } + + iterator insert_equal(reference value) + { + size_type bucket_num; + std::size_t hash_value; + siterator prev; + siterator it = this->priv_find + (value, this->priv_hasher(), this->priv_equal(), bucket_num, hash_value, prev); + return priv_insert_equal_find(value, bucket_num, hash_value, it); + } + + template + void insert_equal(Iterator b, Iterator e) + { + for (; b != e; ++b) + this->insert_equal(*b); + } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to inserts value into the unordered_set. + //! + //! Returns: If the value + //! is not already present inserts it and returns a pair containing the + //! iterator to the new value and true. If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert_unique(reference value) + { + insert_commit_data commit_data; + std::pair ret = this->insert_unique_check + (value, this->priv_hasher(), this->priv_equal(), commit_data); + if(!ret.second) + return ret; + return std::pair + (this->insert_unique_commit(value, commit_data), true); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Equivalent to this->insert(t) for each element in [b, e). + //! + //! Complexity: Average case O(N), where N is std::distance(b, e). + //! Worst case O(N*this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_unique(Iterator b, Iterator e) + { + for (; b != e; ++b) + this->insert_unique(*b); + } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the unordered_set, using + //! a user provided key instead of the value itself. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the hash or the equality is much cheaper to + //! construct than the value_type and this function offers the possibility to + //! use that the part to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the unordered_set. + //! + //! After a successful rehashing insert_commit_data remains valid. + template + std::pair insert_unique_check + ( const KeyType &key + , KeyHasher hash_func + , KeyValueEqual equal_func + , insert_commit_data &commit_data) + { + size_type bucket_num; + siterator prev; + siterator prev_pos = + this->priv_find(key, hash_func, equal_func, bucket_num, commit_data.hash, prev); + bool success = prev_pos == priv_invalid_local_it(); + if(success){ + prev_pos = prev; + } + return std::pair(iterator(prev_pos, this),success); + } + + //! Requires: value must be an lvalue of type value_type. commit_data + //! must have been obtained from a previous call to "insert_check". + //! No objects should have been inserted or erased from the unordered_set between + //! the "insert_check" that filled "commit_data" and the call to "insert_commit". + //! + //! Effects: Inserts the value in the unordered_set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Returns: An iterator to the newly inserted object. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + //! + //! After a successful rehashing insert_commit_data remains valid. + iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) + { + size_type bucket_num = priv_hash_to_bucket(commit_data.hash); + bucket_type &b = this->priv_buckets()[bucket_num]; + this->priv_size_traits().increment(); + node_ptr n = node_ptr(&priv_value_to_node(value)); + this->priv_store_hash(n, commit_data.hash, store_hash_t()); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n)); + priv_insertion_update_cache(bucket_num); + this->priv_insert_in_group(node_ptr(0), n, optimize_multikey_t()); + return iterator(b.insert_after(b.before_begin(), *n), this); + } + + //! Effects: Erases the element pointed to by i. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased element. No destructors are called. + void erase(const_iterator i) + { this->erase_and_dispose(i, detail::null_disposer()); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average case O(std::distance(b, e)), + //! worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void erase(const_iterator b, const_iterator e) + { this->erase_and_dispose(b, e, detail::null_disposer()); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + //! Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return this->erase(value, this->priv_hasher(), this->priv_equal()); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Erases all the elements that have the same hash and + //! compare equal with the given key. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) + { return this->erase_and_dispose(key, hash_func, equal_func, detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by i. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + void erase_and_dispose(const_iterator i, Disposer disposer) + { + priv_erase(i, disposer, optimize_multikey_t()); + this->priv_size_traits().decrement(); + priv_erasure_update_cache(); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average case O(std::distance(b, e)), + //! worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) + { + if(b == e) return; + + //Get the bucket number and local iterator for both iterators + siterator first_local_it(b.slist_it()); + size_type first_bucket_num = this->priv_get_bucket_num(first_local_it); + + siterator before_first_local_it + = priv_get_previous(priv_buckets()[first_bucket_num], first_local_it); + size_type last_bucket_num; + siterator last_local_it; + + //For the end iterator, we will assign the end iterator + //of the last bucket + if(e == this->end()){ + last_bucket_num = this->bucket_count() - 1; + last_local_it = priv_buckets()[last_bucket_num].end(); + } + else{ + last_local_it = e.slist_it(); + last_bucket_num = this->priv_get_bucket_num(last_local_it); + } + priv_erase_range(before_first_local_it, first_bucket_num, last_local_it, last_bucket_num, disposer); + priv_erasure_update_cache(first_bucket_num, last_bucket_num); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + //! Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return this->erase_and_dispose(value, priv_hasher(), priv_equal(), disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "equal_func". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func + ,KeyValueEqual equal_func, Disposer disposer) + { + size_type bucket_num; + std::size_t h; + siterator prev; + siterator it = + this->priv_find(key, hash_func, equal_func, bucket_num, h, prev); + bool success = it != priv_invalid_local_it(); + size_type count(0); + if(!success){ + return 0; + } + else if(optimize_multikey){ + siterator last = bucket_type::s_iterator_to + (*node_traits::get_next(group_functions_t::priv_get_last_in_group + (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()))); + this->priv_erase_range_impl(bucket_num, prev, last, disposer, count); + } + else{ + //If found erase all equal values + bucket_type &b = this->priv_buckets()[bucket_num]; + for(siterator end = b.end(); it != end; ++count, ++it){ + slist_node_ptr n(it.pointed_node()); + const value_type &v = priv_value_from_slist_node(n); + if(compare_hash){ + std::size_t vh = this->priv_stored_or_compute_hash(v, store_hash_t()); + if(h != vh || !equal_func(key, v)){ + break; + } + } + else if(!equal_func(key, v)){ + break; + } + this->priv_size_traits().decrement(); + } + b.erase_after_and_dispose(prev, it, make_node_disposer(disposer)); + } + priv_erasure_update_cache(); + return count; + } + + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { + priv_clear_buckets(); + this->priv_size_traits().set_size(size_type(0)); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { + if(!constant_time_size || !this->empty()){ + size_type num_buckets = this->bucket_count(); + bucket_ptr b = this->priv_buckets(); + for(; num_buckets--; ++b){ + b->clear_and_dispose(make_node_disposer(disposer)); + } + this->priv_size_traits().set_size(size_type(0)); + } + priv_initialize_cache(); + } + + //! Effects: Returns the number of contained elements with the given value + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + size_type count(const_reference value) const + { return this->count(value, this->priv_hasher(), this->priv_equal()); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hash_func or equal throw. + template + size_type count(const KeyType &key, const KeyHasher &hash_func, const KeyValueEqual &equal_func) const + { + size_type bucket_n1, bucket_n2, count; + this->priv_equal_range(key, hash_func, equal_func, bucket_n1, bucket_n2, count); + return count; + } + + //! Effects: Finds an iterator to the first element is equal to + //! "value" or end() if that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + iterator find(const_reference value) + { return this->find(value, this->priv_hasher(), this->priv_equal()); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the given hash and equality functor or end() if + //! that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType &key, KeyHasher hash_func, KeyValueEqual equal_func) + { + size_type bucket_n; + std::size_t hash; + siterator prev; + siterator local_it = this->priv_find(key, hash_func, equal_func, bucket_n, hash, prev); + return iterator(local_it, this); + } + + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" or end() if that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + const_iterator find(const_reference value) const + { return this->find(value, this->priv_hasher(), this->priv_equal()); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the given hasher and equality functor or end() if + //! that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find + (const KeyType &key, KeyHasher hash_func, KeyValueEqual equal_func) const + { + size_type bucket_n; + std::size_t hash_value; + siterator prev; + siterator sit = this->priv_find(key, hash_func, equal_func, bucket_n, hash_value, prev); + return const_iterator(sit, this); + } + + //! Effects: Returns a range containing all elements with values equivalent + //! to value. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(value)). Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + std::pair equal_range(const_reference value) + { return this->equal_range(value, this->priv_hasher(), this->priv_equal()); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Returns a range containing all elements with equivalent + //! keys. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(key, hash_func, equal_func)). + //! Worst case O(this->size()). + //! + //! Throws: If hash_func or the equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range + (const KeyType &key, KeyHasher hash_func, KeyValueEqual equal_func) + { + size_type bucket_n1, bucket_n2, count; + std::pair ret = this->priv_equal_range + (key, hash_func, equal_func, bucket_n1, bucket_n2, count); + return std::pair + (iterator(ret.first, this), iterator(ret.second, this)); + } + + //! Effects: Returns a range containing all elements with values equivalent + //! to value. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(value)). Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + std::pair + equal_range(const_reference value) const + { return this->equal_range(value, this->priv_hasher(), this->priv_equal()); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Returns a range containing all elements with equivalent + //! keys. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(key, hash_func, equal_func)). + //! Worst case O(this->size()). + //! + //! Throws: If the hasher or equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range + (const KeyType &key, KeyHasher hash_func, KeyValueEqual equal_func) const + { + size_type bucket_n1, bucket_n2, count; + std::pair ret = + this->priv_equal_range(key, hash_func, equal_func, bucket_n1, bucket_n2, count); + return std::pair + (const_iterator(ret.first, this), const_iterator(ret.second, this)); + } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: If the internal hash function throws. + iterator iterator_to(reference value) + { + return iterator(bucket_type::s_iterator_to(priv_value_to_node(value)), this); + } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator belonging to the + //! unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: If the internal hash function throws. + const_iterator iterator_to(const_reference value) const + { + return const_iterator(bucket_type::s_iterator_to(priv_value_to_node(const_cast(value))), this); + } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid local_iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static local_iterator s_local_iterator_to(reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + siterator sit = bucket_type::s_iterator_to(((hashtable_impl*)0)->priv_value_to_node(value)); + return local_iterator(sit, (hashtable_impl*)0); + } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_local_iterator belonging to + //! the unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_local_iterator s_local_iterator_to(const_reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + siterator sit = bucket_type::s_iterator_to(((hashtable_impl*)0)->priv_value_to_node(const_cast(value))); + return const_local_iterator(sit, (hashtable_impl*)0); + } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid local_iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + local_iterator local_iterator_to(reference value) + { + siterator sit = bucket_type::s_iterator_to(this->priv_value_to_node(value)); + return local_iterator(sit, this); + } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_local_iterator belonging to + //! the unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_local_iterator local_iterator_to(const_reference value) const + { + siterator sit = bucket_type::s_iterator_to + (const_cast(this->priv_value_to_node(value))); + return const_local_iterator(sit, this); + } + + //! Effects: Returns the number of buckets passed in the constructor + //! or the last rehash function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + size_type bucket_count() const + { return this->priv_buckets_len(); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns the number of elements in the nth bucket. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + size_type bucket_size(size_type n) const + { return this->priv_buckets()[n].size(); } + + //! Effects: Returns the index of the bucket in which elements + //! with keys equivalent to k would be found, if any such element existed. + //! + //! Complexity: Constant. + //! + //! Throws: If the hash functor throws. + //! + //! Note: the return value is in the range [0, this->bucket_count()). + size_type bucket(const key_type& k) const + { return this->bucket(k, this->priv_hasher()); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! Effects: Returns the index of the bucket in which elements + //! with keys equivalent to k would be found, if any such element existed. + //! + //! Complexity: Constant. + //! + //! Throws: If hash_func throws. + //! + //! Note: the return value is in the range [0, this->bucket_count()). + template + size_type bucket(const KeyType& k, const KeyHasher &hash_func) const + { return priv_hash_to_bucket(hash_func(k)); } + + //! Effects: Returns the bucket array pointer passed in the constructor + //! or the last rehash function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bucket_ptr bucket_pointer() const + { return this->priv_buckets(); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + local_iterator begin(size_type n) + { return local_iterator(this->priv_buckets()[n].begin(), this); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator begin(size_type n) const + { return this->cbegin(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator cbegin(size_type n) const + { + siterator sit = const_cast(this->priv_buckets()[n]).begin(); + return const_local_iterator(sit, this); + } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + local_iterator end(size_type n) + { return local_iterator(this->priv_buckets()[n].end(), this); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator end(size_type n) const + { return this->cend(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator cend(size_type n) const + { return const_local_iterator(const_cast(this->priv_buckets()[n]).end(), this); } + + //! Requires: new_buckets must be a pointer to a new bucket array + //! or the same as the old bucket array. new_size is the length of the + //! the array pointed by new_buckets. If new_buckets == this->bucket_pointer() + //! n can be bigger or smaller than this->bucket_count(). + //! 'new_bucket_traits' copy constructor should not throw. + //! + //! Effects: Updates the internal reference with the new bucket erases + //! the values from the old bucket and inserts then in the new one. + //! Bucket traits hold by *this is assigned from new_bucket_traits. + //! If the container is configured as incremental<>, the split bucket is set + //! to the new bucket_len(). + //! + //! If store_hash option is true, this method does not use the hash function. + //! + //! Complexity: Average case linear in this->size(), worst case quadratic. + //! + //! Throws: If the hasher functor throws. Basic guarantee. + void rehash(const bucket_traits &new_bucket_traits) + { + bucket_ptr new_buckets = new_bucket_traits.bucket_begin(); + size_type new_buckets_len = new_bucket_traits.bucket_count(); + bucket_ptr old_buckets = this->priv_buckets(); + size_type old_buckets_len = this->priv_buckets_len(); + + //Check power of two bucket array if the option is activated + BOOST_INTRUSIVE_INVARIANT_ASSERT + (!power_2_buckets || (0 == (new_buckets_len & (new_buckets_len-1u)))); + + size_type n = priv_get_cache_bucket_num(); + const bool same_buffer = old_buckets == new_buckets; + //If the new bucket length is a common factor + //of the old one we can avoid hash calculations. + const bool fast_shrink = (!incremental) && (old_buckets_len > new_buckets_len) && + (power_2_buckets ||(old_buckets_len % new_buckets_len) == 0); + //If we are shrinking the same bucket array and it's + //is a fast shrink, just rehash the last nodes + size_type new_first_bucket_num = new_buckets_len; + if(same_buffer && fast_shrink && (n < new_buckets_len)){ + n = new_buckets_len; + new_first_bucket_num = priv_get_cache_bucket_num(); + } + + //Anti-exception stuff: they destroy the elements if something goes wrong. + //If the source and destination buckets are the same, the second rollback function + //is harmless, because all elements have been already unlinked and destroyed + typedef detail::init_disposer NodeDisposer; + NodeDisposer node_disp; + detail::exception_array_disposer + rollback1(new_buckets[0], node_disp, new_buckets_len); + detail::exception_array_disposer + rollback2(old_buckets[0], node_disp, old_buckets_len); + + //Put size in a safe value for rollback exception + size_type size_backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(0); + //Put cache to safe position + priv_initialize_cache(); + priv_insertion_update_cache(size_type(0u)); + + //Iterate through nodes + for(; n < old_buckets_len; ++n){ + bucket_type &old_bucket = old_buckets[n]; + + if(!fast_shrink){ + siterator before_i(old_bucket.before_begin()); + siterator end(old_bucket.end()); + siterator i(old_bucket.begin()); + for(;i != end; ++i){ + const value_type &v = priv_value_from_slist_node(i.pointed_node()); + const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t()); + const size_type new_n = priv_hash_to_bucket(hash_value, new_buckets_len, new_buckets_len); + if(cache_begin && new_n < new_first_bucket_num) + new_first_bucket_num = new_n; + siterator last = bucket_type::s_iterator_to + (*group_functions_t::priv_get_last_in_group + (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t())); + if(same_buffer && new_n == n){ + before_i = last; + } + else{ + bucket_type &new_b = new_buckets[new_n]; + new_b.splice_after(new_b.before_begin(), old_bucket, before_i, last); + } + i = before_i; + } + } + else{ + const size_type new_n = priv_hash_to_bucket(n, new_buckets_len, new_buckets_len); + if(cache_begin && new_n < new_first_bucket_num) + new_first_bucket_num = new_n; + bucket_type &new_b = new_buckets[new_n]; + if(!old_bucket.empty()){ + new_b.splice_after( new_b.before_begin() + , old_bucket + , old_bucket.before_begin() + , priv_get_last(old_bucket)); + } + } + } + + this->priv_size_traits().set_size(size_backup); + this->priv_split_traits().set_size(new_buckets_len); + this->priv_real_bucket_traits() = new_bucket_traits; + priv_initialize_cache(); + priv_insertion_update_cache(new_first_bucket_num); + rollback1.release(); + rollback2.release(); + } + + //! Requires: + //! + //! Effects: + //! + //! Complexity: + //! + //! Throws: + //! + //! Note: this method is only available if incremental option is activated. + bool incremental_rehash(bool grow = true) + { + //This function is only available for containers with incremental hashing + BOOST_STATIC_ASSERT(( incremental && power_2_buckets )); + size_type split_idx = priv_split_traits().get_size(); + size_type bucket_len = priv_buckets_len(); + + if(grow){ + //Test if the split variable can be changed + if(split_idx >= bucket_len) + return false; + + size_type bucket_len = priv_buckets_len(); + size_type bucket_to_rehash = split_idx - bucket_len/2; + bucket_type &old_bucket = this->priv_buckets()[bucket_to_rehash]; + siterator before_i(old_bucket.before_begin()); + siterator end(old_bucket.end()); + siterator i(old_bucket.begin()); + priv_split_traits().increment(); + + //Anti-exception stuff: if an exception is thrown while + //moving elements from old_bucket to the target bucket, all moved + //elements are moved back to the original one. + detail::incremental_rehash_rollback rollback + ( this->priv_buckets()[split_idx], old_bucket, priv_split_traits()); + for(;i != end; ++i){ + const value_type &v = priv_value_from_slist_node(i.pointed_node()); + const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t()); + const size_type new_n = priv_hash_to_bucket(hash_value); + siterator last = bucket_type::s_iterator_to + (*group_functions_t::priv_get_last_in_group + (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t())); + if(new_n == bucket_to_rehash){ + before_i = last; + } + else{ + bucket_type &new_b = this->priv_buckets()[new_n]; + new_b.splice_after(new_b.before_begin(), old_bucket, before_i, last); + } + i = before_i; + } + rollback.release(); + priv_erasure_update_cache(); + return true; + } + else{ + //Test if the split variable can be changed + if(split_idx <= bucket_len/2) + return false; + const size_type target_bucket_num = split_idx - 1 - bucket_len/2; + bucket_type &target_bucket = this->priv_buckets()[target_bucket_num]; + bucket_type &source_bucket = this->priv_buckets()[split_idx-1]; + target_bucket.splice_after(target_bucket.cbefore_begin(), source_bucket); + priv_split_traits().decrement(); + priv_insertion_update_cache(target_bucket_num); + return true; + } + } + + //! Effects: If new_bucket_traits.bucket_count() is not + //! this->bucket_count()/2 or this->bucket_count()*2, or + //! this->split_bucket() != new_bucket_traits.bucket_count() returns false + //! and does nothing. + //! + //! Otherwise, copy assigns new_bucket_traits to the internal bucket_traits + //! and transfers all the objects from old buckets to the new ones. + //! + //! Complexity: Linear to size(). + //! + //! Throws: Nothing + //! + //! Note: this method is only available if incremental option is activated. + bool incremental_rehash(const bucket_traits &new_bucket_traits) + { + //This function is only available for containers with incremental hashing + BOOST_STATIC_ASSERT(( incremental && power_2_buckets )); + size_type new_bucket_traits_size = new_bucket_traits.bucket_count(); + size_type cur_bucket_traits = this->priv_buckets_len(); + if(new_bucket_traits_size/2 != cur_bucket_traits && new_bucket_traits_size != cur_bucket_traits/2){ + return false; + } + + const size_type split_idx = this->split_count(); + + if(new_bucket_traits_size/2 == cur_bucket_traits){ + //Test if the split variable can be changed + if(!(split_idx >= cur_bucket_traits)) + return false; + } + else{ + //Test if the split variable can be changed + if(!(split_idx <= cur_bucket_traits/2)) + return false; + } + + const size_type ini_n = priv_get_cache_bucket_num(); + const bucket_ptr old_buckets = this->priv_buckets(); + this->priv_real_bucket_traits() = new_bucket_traits; + if(new_bucket_traits.bucket_begin() != old_buckets){ + for(size_type n = ini_n; n < split_idx; ++n){ + bucket_type &new_bucket = new_bucket_traits.bucket_begin()[n]; + bucket_type &old_bucket = old_buckets[n]; + new_bucket.splice_after(new_bucket.cbefore_begin(), old_bucket); + } + //Put cache to safe position + priv_initialize_cache(); + priv_insertion_update_cache(ini_n); + } + return true; + } + + //! Requires: + //! + //! Effects: + //! + //! Complexity: + //! + //! Throws: + size_type split_count() const + { + //This function is only available if incremental hashing is activated + BOOST_STATIC_ASSERT(( incremental && power_2_buckets )); + return this->priv_split_traits().get_size(); + } + + //! Effects: Returns the nearest new bucket count optimized for + //! the container that is bigger than n. This suggestion can be used + //! to create bucket arrays with a size that will usually improve + //! container's performance. If such value does not exist, the + //! higher possible value is returned. + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static size_type suggested_upper_bucket_count(size_type n) + { + const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0]; + const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size; + size_type const* bound = std::lower_bound(primes, primes_end, n); + if(bound == primes_end) + bound--; + return size_type(*bound); + } + + //! Effects: Returns the nearest new bucket count optimized for + //! the container that is smaller than n. This suggestion can be used + //! to create bucket arrays with a size that will usually improve + //! container's performance. If such value does not exist, the + //! lower possible value is returned. + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static size_type suggested_lower_bucket_count(size_type n) + { + const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0]; + const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size; + size_type const* bound = std::upper_bound(primes, primes_end, n); + if(bound != primes_end) + bound--; + return size_type(*bound); + } + + /// @cond + private: + + std::size_t priv_hash_to_bucket(std::size_t hash_value) const + { return priv_hash_to_bucket(hash_value, this->priv_real_bucket_traits().bucket_count(), priv_split_traits().get_size()); } + + std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_len, std::size_t split) const + { + std::size_t bucket_number = priv_hash_to_bucket_impl(hash_value, bucket_len, power_2_buckets_t()); + if(incremental) + if(bucket_number >= split) + bucket_number -= bucket_len/2; + return bucket_number; + } + + std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::bool_) const + { return hash_value % bucket_len; } + + std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::bool_) const + { return hash_value & (bucket_len - 1); } + + const key_equal &priv_equal() const + { return static_cast(this->data_.internal_.bucket_hash_equal_.get()); } + + key_equal &priv_equal() + { return static_cast(this->data_.internal_.bucket_hash_equal_.get()); } + + value_type &priv_value_from_slist_node(slist_node_ptr n) + { return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); } + + const value_type &priv_value_from_slist_node(slist_node_ptr n) const + { return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); } + + const real_bucket_traits &priv_real_bucket_traits(detail::bool_) const + { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; } + + const real_bucket_traits &priv_real_bucket_traits(detail::bool_) const + { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); } + + real_bucket_traits &priv_real_bucket_traits(detail::bool_) + { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; } + + real_bucket_traits &priv_real_bucket_traits(detail::bool_) + { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_.get_bucket_traits(*this); } + + const real_bucket_traits &priv_real_bucket_traits() const + { return this->priv_real_bucket_traits(detail::bool_()); } + + real_bucket_traits &priv_real_bucket_traits() + { return this->priv_real_bucket_traits(detail::bool_()); } + + const hasher &priv_hasher() const + { return static_cast(this->data_.internal_.bucket_hash_equal_.bucket_hash.get()); } + + hasher &priv_hasher() + { return static_cast(this->data_.internal_.bucket_hash_equal_.bucket_hash.get()); } + + bucket_ptr priv_buckets() const + { return this->priv_real_bucket_traits().bucket_begin(); } + + size_type priv_buckets_len() const + { return this->priv_real_bucket_traits().bucket_count(); } + + static node_ptr uncast(const_node_ptr ptr) + { return node_ptr(const_cast(detail::get_pointer(ptr))); } + + node &priv_value_to_node(value_type &v) + { return *this->get_real_value_traits().to_node_ptr(v); } + + const node &priv_value_to_node(const value_type &v) const + { return *this->get_real_value_traits().to_node_ptr(v); } + + size_traits &priv_size_traits() + { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_; } + + const size_traits &priv_size_traits() const + { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_; } + + split_traits &priv_split_traits() + { return this->data_.internal_; } + + const split_traits &priv_split_traits() const + { return this->data_.internal_; } + + template + void priv_erase_range_impl + (size_type bucket_num, siterator before_first_it, siterator end, Disposer disposer, size_type &num_erased) + { + const bucket_ptr buckets = priv_buckets(); + bucket_type &b = buckets[bucket_num]; + + if(before_first_it == b.before_begin() && end == b.end()){ + priv_erase_range_impl(bucket_num, 1, disposer, num_erased); + } + else{ + num_erased = 0; + siterator to_erase(before_first_it); + ++to_erase; + slist_node_ptr end_ptr = end.pointed_node(); + while(to_erase != end){ + group_functions_t::priv_erase_from_group(end_ptr, dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t()); + to_erase = b.erase_after_and_dispose(before_first_it, make_node_disposer(disposer)); + ++num_erased; + } + this->priv_size_traits().set_size(this->priv_size_traits().get_size()-num_erased); + } + } + + template + void priv_erase_range_impl + (size_type first_bucket_num, size_type num_buckets, Disposer disposer, size_type &num_erased) + { + //Now fully clear the intermediate buckets + const bucket_ptr buckets = priv_buckets(); + num_erased = 0; + for(size_type i = first_bucket_num; i < (num_buckets + first_bucket_num); ++i){ + bucket_type &b = buckets[i]; + siterator b_begin(b.before_begin()); + siterator nxt(b_begin); + ++nxt; + siterator end(b.end()); + while(nxt != end){ + priv_init_group(nxt.pointed_node(), optimize_multikey_t()); + nxt = b.erase_after_and_dispose + (b_begin, make_node_disposer(disposer)); + this->priv_size_traits().decrement(); + ++num_erased; + } + } + } + + template + void priv_erase_range( siterator before_first_it, size_type first_bucket + , siterator last_it, size_type last_bucket + , Disposer disposer) + { + size_type num_erased; + if (first_bucket == last_bucket){ + priv_erase_range_impl(first_bucket, before_first_it, last_it, disposer, num_erased); + } + else { + bucket_type *b = (&this->priv_buckets()[0]); + priv_erase_range_impl(first_bucket, before_first_it, b[first_bucket].end(), disposer, num_erased); + if(size_type n = (last_bucket - first_bucket - 1)) + priv_erase_range_impl(first_bucket + 1, n, disposer, num_erased); + priv_erase_range_impl(last_bucket, b[last_bucket].before_begin(), last_it, disposer, num_erased); + } + } + + static node_ptr dcast_bucket_ptr(typename slist_impl::node_ptr p) + { return node_ptr(&static_cast(*p)); } + + std::size_t priv_stored_or_compute_hash(const value_type &v, detail::true_) const + { return node_traits::get_hash(this->get_real_value_traits().to_node_ptr(v)); } + + std::size_t priv_stored_or_compute_hash(const value_type &v, detail::false_) const + { return priv_hasher()(v); } + + std::size_t priv_stored_hash(slist_node_ptr n, detail::true_) const + { return node_traits::get_hash(dcast_bucket_ptr(n)); } + + std::size_t priv_stored_hash(slist_node_ptr, detail::false_) const + { + //This code should never be reached! + BOOST_INTRUSIVE_INVARIANT_ASSERT(0); + return 0; + } + + static void priv_store_hash(node_ptr p, std::size_t h, detail::true_) + { return node_traits::set_hash(p, h); } + + static void priv_store_hash(node_ptr, std::size_t, detail::false_) + {} + + static void priv_clear_group_nodes(bucket_type &b, detail::true_) + { + siterator it(b.begin()), itend(b.end()); + while(it != itend){ + node_ptr to_erase(dcast_bucket_ptr(it.pointed_node())); + ++it; + group_algorithms::init(to_erase); + } + } + + static void priv_clear_group_nodes(bucket_type &, detail::false_) + {} + + std::size_t priv_get_bucket_num(siterator it) + { return priv_get_bucket_num_hash_dispatch(it, store_hash_t()); } + + std::size_t priv_get_bucket_num_hash_dispatch(siterator it, detail::true_) + { + return this->priv_hash_to_bucket + (this->priv_stored_hash(it.pointed_node(), store_hash_t())); + } + + std::size_t priv_get_bucket_num_hash_dispatch(siterator it, detail::false_) + { return priv_get_bucket_num_no_hash_store(it, optimize_multikey_t()); } + + std::size_t priv_get_bucket_num_no_hash_store(siterator it, detail::true_) + { + bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1); + slist_node_ptr bb = group_functions_t::priv_get_bucket_before_begin + ( f->end().pointed_node() + , l->end().pointed_node() + , dcast_bucket_ptr(it.pointed_node())); + //Now get the bucket_impl from the iterator + const bucket_type &b = static_cast + (bucket_type::slist_type::container_from_end_iterator(bucket_type::s_iterator_to(*bb))); + //Now just calculate the index b has in the bucket array + return static_cast(&b - &*f); + } + + std::size_t priv_get_bucket_num_no_hash_store(siterator it, detail::false_) + { + bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1); + slist_node_ptr first_ptr(f->cend().pointed_node()) + , last_ptr(l->cend().pointed_node()); + + //The end node is embedded in the singly linked list: + //iterate until we reach it. + while(!(first_ptr <= it.pointed_node() && it.pointed_node() <= last_ptr)){ + ++it; + } + //Now get the bucket_impl from the iterator + const bucket_type &b = static_cast + (bucket_type::container_from_end_iterator(it)); + + //Now just calculate the index b has in the bucket array + return static_cast(&b - &*f); + } + + void priv_init_group(slist_node_ptr n, detail::true_) + { group_algorithms::init(dcast_bucket_ptr(n)); } + + void priv_init_group(slist_node_ptr, detail::false_) + {} + + void priv_insert_in_group(node_ptr first_in_group, node_ptr n, detail::true_) + { + if(first_in_group){ + if(group_algorithms::unique(first_in_group)) + group_algorithms::link_after(first_in_group, n); + else{ + group_algorithms::link_after(node_traits::get_next(first_in_group), n); + } + } + else{ + group_algorithms::init_header(n); + } + } + + void priv_insert_in_group(node_ptr, node_ptr, detail::false_) + {} + + siterator priv_get_previous + (bucket_type &b, siterator i) + { return priv_get_previous(b, i, optimize_multikey_t()); } + + siterator priv_get_previous + (bucket_type &b, siterator i, detail::true_) + { + node_ptr elem(dcast_bucket_ptr(i.pointed_node())); + node_ptr prev_in_group(group_traits::get_next(elem)); + bool first_in_group = node_traits::get_next(prev_in_group) != elem; + typename bucket_type::node &n = first_in_group + ? *group_functions_t::priv_get_prev_to_first_in_group(b.end().pointed_node(), elem) + : *group_traits::get_next(elem) + ; + return bucket_type::s_iterator_to(n); + } + + siterator priv_get_previous + (bucket_type &b, siterator i, detail::false_) + { return b.previous(i); } + + static siterator priv_get_last(bucket_type &b) + { return priv_get_last(b, optimize_multikey_t()); } + + static siterator priv_get_last(bucket_type &b, detail::true_) + { + //First find the last node of p's group. + //This requires checking the first node of the next group or + //the bucket node. + slist_node_ptr end_ptr(b.end().pointed_node()); + node_ptr possible_end(node_traits::get_next( dcast_bucket_ptr(end_ptr))); + node_ptr last_node_group(possible_end); + + while(end_ptr != possible_end){ + last_node_group = group_traits::get_next(dcast_bucket_ptr(possible_end)); + possible_end = node_traits::get_next(last_node_group); + } + return bucket_type::s_iterator_to(*last_node_group); + } + + static siterator priv_get_last(bucket_type &b, detail::false_) + { return b.previous(b.end()); } + + siterator priv_get_previous_and_next_in_group + (siterator i, node_ptr &nxt_in_group) + { + siterator prev; + node_ptr elem(dcast_bucket_ptr(i.pointed_node())); + bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1); + + slist_node_ptr first_end_ptr(f->cend().pointed_node()); + slist_node_ptr last_end_ptr (l->cend().pointed_node()); + + node_ptr nxt(node_traits::get_next(elem)); + node_ptr prev_in_group(group_traits::get_next(elem)); + bool last_in_group = (first_end_ptr <= nxt && nxt <= last_end_ptr) || + (group_traits::get_next(nxt) != elem); + bool first_in_group = node_traits::get_next(prev_in_group) != elem; + + if(first_in_group){ + node_ptr start_pos; + if(last_in_group){ + start_pos = elem; + nxt_in_group = 0; + } + else{ + start_pos = prev_in_group; + nxt_in_group = node_traits::get_next(elem); + } + slist_node_ptr bucket_node; + if(store_hash){ + bucket_node = this->priv_buckets() + [this->priv_hash_to_bucket + (this->priv_stored_hash(elem, store_hash_t())) + ].before_begin().pointed_node(); + } + else{ + bucket_node = group_functions_t::priv_get_bucket_before_begin + (first_end_ptr, last_end_ptr, start_pos); + } + prev = bucket_type::s_iterator_to + (*group_functions_t::priv_get_prev_to_first_in_group(bucket_node, elem)); + } + else{ + if(last_in_group){ + nxt_in_group = group_functions_t::priv_get_first_in_group_of_last_in_group(elem); + } + else{ + nxt_in_group = node_traits::get_next(elem); + } + prev = bucket_type::s_iterator_to(*group_traits::get_next(elem)); + } + return prev; + } + + template + void priv_erase(const_iterator i, Disposer disposer, detail::true_) + { + siterator elem(i.slist_it()); + node_ptr nxt_in_group; + siterator prev = priv_get_previous_and_next_in_group(elem, nxt_in_group); + bucket_type::s_erase_after_and_dispose(prev, make_node_disposer(disposer)); + if(nxt_in_group) + group_algorithms::unlink_after(nxt_in_group); + if(safemode_or_autounlink) + group_algorithms::init(dcast_bucket_ptr(elem.pointed_node())); + } + + template + void priv_erase(const_iterator i, Disposer disposer, detail::false_) + { + siterator to_erase(i.slist_it()); + bucket_type &b = this->priv_buckets()[this->priv_get_bucket_num(to_erase)]; + siterator prev(priv_get_previous(b, to_erase)); + b.erase_after_and_dispose(prev, make_node_disposer(disposer)); + } + + bucket_ptr priv_invalid_bucket() const + { + const real_bucket_traits &rbt = this->priv_real_bucket_traits(); + return rbt.bucket_begin() + rbt.bucket_count(); + } + + siterator priv_invalid_local_it() const + { return priv_invalid_bucket()->end(); } + + siterator priv_begin() const + { return priv_begin(cache_begin_t()); } + + siterator priv_begin(detail::bool_) const + { + size_type n = 0; + size_type buckets_len = this->priv_buckets_len(); + for (n = 0; n < buckets_len; ++n){ + bucket_type &b = this->priv_buckets()[n]; + if(!b.empty()){ + return b.begin(); + } + } + return priv_invalid_local_it(); + } + + siterator priv_begin(detail::bool_) const + { + if(this->data_.internal_.bucket_hash_equal_.cached_begin_ == priv_invalid_bucket()){ + return priv_invalid_local_it(); + } + else{ + return this->data_.internal_.bucket_hash_equal_.cached_begin_->begin(); + } + } + + void priv_initialize_cache() + { priv_initialize_cache(cache_begin_t()); } + + void priv_initialize_cache(detail::bool_) + { this->data_.internal_.bucket_hash_equal_.cached_begin_ = priv_invalid_bucket(); } + + void priv_initialize_cache(detail::bool_) + {} + + void priv_insertion_update_cache(size_type insertion_bucket) + { priv_insertion_update_cache(insertion_bucket, cache_begin_t()); } + + void priv_insertion_update_cache(size_type insertion_bucket, detail::bool_) + { + bucket_ptr p = priv_buckets() + insertion_bucket; + if(p < this->data_.internal_.bucket_hash_equal_.cached_begin_){ + this->data_.internal_.bucket_hash_equal_.cached_begin_ = p; + } + } + + void priv_insertion_update_cache(size_type, detail::bool_) + {} + + void priv_erasure_update_cache(size_type first_bucket, size_type last_bucket) + { priv_erasure_update_cache(first_bucket, last_bucket, cache_begin_t()); } + + void priv_erasure_update_cache(size_type first_bucket_num, size_type last_bucket_num, detail::bool_) + { + //If the last bucket is the end, the cache must be updated + //to the last position if all + if(priv_get_cache_bucket_num() == first_bucket_num && + priv_buckets()[first_bucket_num].empty() ){ + priv_set_cache(priv_buckets() + last_bucket_num); + priv_erasure_update_cache(); + } + } + + void priv_erasure_update_cache(size_type, size_type, detail::bool_) + {} + + void priv_erasure_update_cache() + { priv_erasure_update_cache(cache_begin_t()); } + + void priv_erasure_update_cache(detail::bool_) + { + if(constant_time_size && !size()){ + priv_initialize_cache(); + } + else{ + size_type current_n = this->data_.internal_.bucket_hash_equal_.cached_begin_ - priv_buckets(); + for( const size_type num_buckets = this->priv_buckets_len() + ; current_n < num_buckets + ; ++current_n, ++this->data_.internal_.bucket_hash_equal_.cached_begin_){ + if(!this->data_.internal_.bucket_hash_equal_.cached_begin_->empty()){ + return; + } + } + priv_initialize_cache(); + } + } + + void priv_erasure_update_cache(detail::bool_) + {} + + void priv_swap_cache(detail::bool_, hashtable_impl &other) + { + std::swap( this->data_.internal_.bucket_hash_equal_.cached_begin_ + , other.data_.internal_.bucket_hash_equal_.cached_begin_); + } + + void priv_swap_cache(detail::bool_, hashtable_impl &) + {} + + bucket_ptr priv_get_cache() + { return priv_get_cache(cache_begin_t()); } + + bucket_ptr priv_get_cache(detail::bool_) + { return this->data_.internal_.bucket_hash_equal_.cached_begin_; } + + bucket_ptr priv_get_cache(detail::bool_) + { return this->priv_buckets(); } + + void priv_set_cache(bucket_ptr p) + { priv_set_cache(p, cache_begin_t()); } + + void priv_set_cache(bucket_ptr p, detail::bool_) + { this->data_.internal_.bucket_hash_equal_.cached_begin_ = p; } + + void priv_set_cache(bucket_ptr, detail::bool_) + {} + + size_type priv_get_cache_bucket_num() + { return priv_get_cache_bucket_num(cache_begin_t()); } + + size_type priv_get_cache_bucket_num(detail::bool_) + { return this->data_.internal_.bucket_hash_equal_.cached_begin_ - this->priv_buckets(); } + + size_type priv_get_cache_bucket_num(detail::bool_) + { return 0u; } + + void priv_clear_buckets() + { + this->priv_clear_buckets + ( priv_get_cache() + , this->priv_buckets_len() - (priv_get_cache() - priv_buckets())); + } + + void priv_initialize_buckets() + { this->priv_clear_buckets(priv_buckets(), this->priv_buckets_len()); } + + void priv_clear_buckets(bucket_ptr buckets_ptr, size_type buckets_len) + { + for(; buckets_len--; ++buckets_ptr){ + if(safemode_or_autounlink){ + priv_clear_group_nodes(*buckets_ptr, optimize_multikey_t()); + buckets_ptr->clear_and_dispose(detail::init_disposer()); + } + else{ + buckets_ptr->clear(); + } + } + priv_initialize_cache(); + } + + template + siterator priv_find + ( const KeyType &key, KeyHasher hash_func + , KeyValueEqual equal_func, size_type &bucket_number, std::size_t &h, siterator &previt) const + { + h = hash_func(key); + return priv_find_with_hash(key, equal_func, bucket_number, h, previt); + } + + template + siterator priv_find_with_hash + ( const KeyType &key, KeyValueEqual equal_func, size_type &bucket_number, const std::size_t h, siterator &previt) const + { + bucket_number = priv_hash_to_bucket(h); + bucket_type &b = this->priv_buckets()[bucket_number]; + previt = b.before_begin(); + if(constant_time_size && this->empty()){ + return priv_invalid_local_it(); + } + + siterator it = previt; + ++it; + + while(it != b.end()){ + const value_type &v = priv_value_from_slist_node(it.pointed_node()); + if(compare_hash){ + std::size_t vh = this->priv_stored_or_compute_hash(v, store_hash_t()); + if(h == vh && equal_func(key, v)){ + return it; + } + } + else if(equal_func(key, v)){ + return it; + } + if(optimize_multikey){ + previt = bucket_type::s_iterator_to + (*group_functions_t::priv_get_last_in_group + (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())); + it = previt; + } + else{ + previt = it; + } + ++it; + } + previt = b.before_begin(); + return priv_invalid_local_it(); + } + + iterator priv_insert_equal_with_hash(reference value, std::size_t hash_value) + { + size_type bucket_num; + siterator prev; + siterator it = this->priv_find_with_hash + (value, this->priv_equal(), bucket_num, hash_value, prev); + return priv_insert_equal_find(value, bucket_num, hash_value, it); + } + + iterator priv_insert_equal_find(reference value, size_type bucket_num, std::size_t hash_value, siterator it) + { + bucket_type &b = this->priv_buckets()[bucket_num]; + bool found_equal = it != priv_invalid_local_it(); + if(!found_equal){ + it = b.before_begin(); + } + //Now store hash if needed + node_ptr n = node_ptr(&priv_value_to_node(value)); + this->priv_store_hash(n, hash_value, store_hash_t()); + //Checks for some modes + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n)); + //Shorcut for optimize_multikey cases + if(optimize_multikey){ + node_ptr first_in_group = found_equal ? + dcast_bucket_ptr(it.pointed_node()) : node_ptr(0); + this->priv_insert_in_group(first_in_group, n, optimize_multikey_t()); + } + //Update cache and increment size if needed + priv_insertion_update_cache(bucket_num); + this->priv_size_traits().increment(); + //Insert the element in the bucket after it + return iterator(b.insert_after(it, *n), this); + } + + template + std::pair priv_equal_range + ( const KeyType &key + , KeyHasher hash_func + , KeyValueEqual equal_func + , size_type &bucket_number_first + , size_type &bucket_number_second + , size_type &count) const + { + std::size_t h; + count = 0; + siterator prev; + //Let's see if the element is present + std::pair to_return + ( priv_find(key, hash_func, equal_func, bucket_number_first, h, prev) + , priv_invalid_local_it()); + if(to_return.first == to_return.second){ + bucket_number_second = bucket_number_first; + return to_return; + } + //If it's present, find the first that it's not equal in + //the same bucket + bucket_type &b = this->priv_buckets()[bucket_number_first]; + siterator it = to_return.first; + if(optimize_multikey){ + to_return.second = bucket_type::s_iterator_to + (*node_traits::get_next(group_functions_t::priv_get_last_in_group + (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()))); + count = std::distance(it, to_return.second); + if(to_return.second != b.end()){ + bucket_number_second = bucket_number_first; + return to_return; + } + } + else{ + ++count; + ++it; + while(it != b.end()){ + const value_type &v = priv_value_from_slist_node(it.pointed_node()); + if(compare_hash){ + std::size_t hv = this->priv_stored_or_compute_hash(v, store_hash_t()); + if(hv != h || !equal_func(key, v)){ + to_return.second = it; + bucket_number_second = bucket_number_first; + return to_return; + } + } + else if(!equal_func(key, v)){ + to_return.second = it; + bucket_number_second = bucket_number_first; + return to_return; + } + ++it; + ++count; + } + } + + //If we reached the end, find the first, non-empty bucket + for(bucket_number_second = bucket_number_first+1 + ; bucket_number_second != this->priv_buckets_len() + ; ++bucket_number_second){ + bucket_type &b = this->priv_buckets()[bucket_number_second]; + if(!b.empty()){ + to_return.second = b.begin(); + return to_return; + } + } + + //Otherwise, return the end node + to_return.second = priv_invalid_local_it(); + return to_return; + } + /// @endcond +}; + +/// @cond +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template < class T + , bool UniqueKeys + , class O1 = none, class O2 = none + , class O3 = none, class O4 = none + , class O5 = none, class O6 = none + , class O7 = none, class O8 = none + , class O9 = none, class O10= none + > +#else +template +#endif +struct make_hashtable_opt +{ + typedef typename pack_options + < uset_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4, O5, O6, O7, O8, O9, O10 + #else + Options... + #endif + >::type packed_options; + + //Real value traits must be calculated from options + typedef typename detail::get_value_traits + ::type value_traits; + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + typedef typename packed_options::bucket_traits specified_bucket_traits; + /// @endcond + + //Real bucket traits must be calculated from options and calculated value_traits + typedef typename detail::get_slist_impl + ::type + >::type slist_impl; + + typedef typename + detail::if_c< detail::is_same + < specified_bucket_traits + , default_bucket_traits + >::value + , detail::bucket_traits_impl + , specified_bucket_traits + >::type real_bucket_traits; + + typedef detail::usetopt + < value_traits + , typename packed_options::hash + , typename packed_options::equal + , typename packed_options::size_type + , real_bucket_traits + , (std::size_t(UniqueKeys)*detail::hash_bool_flags::unique_keys_pos) + | (std::size_t(packed_options::constant_time_size)*detail::hash_bool_flags::constant_time_size_pos) + | (std::size_t(packed_options::power_2_buckets)*detail::hash_bool_flags::power_2_buckets_pos) + | (std::size_t(packed_options::cache_begin)*detail::hash_bool_flags::cache_begin_pos) + | (std::size_t(packed_options::compare_hash)*detail::hash_bool_flags::compare_hash_pos) + | (std::size_t(packed_options::incremental)*detail::hash_bool_flags::incremental_pos) + > type; +}; +/// @endcond + +//! Helper metafunction to define a \c hashtable that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_hashtable +{ + /// @cond + typedef hashtable_impl + < typename make_hashtable_opt + ::type + > implementation_defined; + + /// @endcond + typedef implementation_defined type; +}; + +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + +#if defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class hashtable + : public make_hashtable::type +{ + typedef typename make_hashtable::type Base; + + public: + typedef typename Base::value_traits value_traits; + typedef typename Base::real_value_traits real_value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + typedef typename Base::bucket_ptr bucket_ptr; + typedef typename Base::size_type size_type; + typedef typename Base::hasher hasher; + typedef typename Base::bucket_traits bucket_traits; + typedef typename Base::key_equal key_equal; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + hashtable ( const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : Base(b_traits, hash_func, equal_func, v_traits) + {} +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_HASHTABLE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/intrusive_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/intrusive_fwd.hpp new file mode 100644 index 0000000000..38a622f887 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/intrusive_fwd.hpp @@ -0,0 +1,486 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_FWD_HPP +#define BOOST_INTRUSIVE_FWD_HPP + +#include +#include +#include + +/// @cond + +namespace boost { + +namespace intrusive { + +struct none; + +} //namespace intrusive{ +} //namespace boost{ + +namespace boost { +namespace intrusive { + +//////////////////////////// +// Node algorithms +//////////////////////////// + +//Algorithms predeclarations +template +class circular_list_algorithms; + +template +class circular_slist_algorithms; + +template +class rbtree_algorithms; + +//////////////////////////// +// Containers +//////////////////////////// + +//slist +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + , class O5 = none + > +#else +template +#endif +class slist; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class slist_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class slist_member_hook; + +//list +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class list; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class list_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class list_member_hook; + +//rbtree/set/multiset +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class rbtree; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class set; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class multiset; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class set_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class set_member_hook; + +//splaytree/splay_set/splay_multiset +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class splaytree; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class splay_set; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class splay_multiset; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class splay_set_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class splay_set_member_hook; + +//avltree/avl_set/avl_multiset +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class avltree; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class avl_set; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class avl_multiset; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class avl_set_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class avl_set_member_hook; + +//sgtree/sg_set/sg_multiset +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class sgtree; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class sg_set; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class sg_multiset; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class bs_set_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class bs_set_member_hook; + +//hashtable/unordered_set/unordered_multiset + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + , class O5 = none + , class O6 = none + , class O7 = none + , class O8 = none + , class O9 = none + , class O10 = none + > +#else +template +#endif +class hashtable; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + , class O5 = none + , class O6 = none + , class O7 = none + , class O8 = none + , class O9 = none + , class O10 = none + > +#else +template +#endif +class unordered_set; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class T + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + , class O5 = none + , class O6 = none + , class O7 = none + , class O8 = none + , class O9 = none + , class O10 = none + > +#else +template +#endif +class unordered_multiset; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class unordered_set_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + > +#else +template +#endif +class unordered_set_member_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class any_base_hook; + +#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class any_member_hook; + +} //namespace intrusive { +} //namespace boost { + +/// @endcond + +#endif //#ifndef BOOST_INTRUSIVE_FWD_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/linear_slist_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/linear_slist_algorithms.hpp new file mode 100644 index 0000000000..a181a51d7b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/linear_slist_algorithms.hpp @@ -0,0 +1,327 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_LINEAR_SLIST_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_LINEAR_SLIST_ALGORITHMS_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! linear_slist_algorithms provides basic algorithms to manipulate nodes +//! forming a linear singly linked list. +//! +//! linear_slist_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the linear list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! Static functions: +//! +//! static node_ptr get_next(const_node_ptr n); +//! +//! static void set_next(node_ptr n, node_ptr next); +template +class linear_slist_algorithms + /// @cond + : public detail::common_slist_algorithms + /// @endcond +{ + /// @cond + typedef detail::common_slist_algorithms base_t; + /// @endcond + public: + typedef typename NodeTraits::node node; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef NodeTraits node_traits; + + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + + //! Effects: Constructs an non-used list element, putting the next + //! pointer to null: + //! NodeTraits::get_next(this_node) == 0 + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void init(node_ptr this_node); + + //! Requires: this_node must be in a circular list or be an empty circular list. + //! + //! Effects: Returns true is "this_node" is the only node of a circular list: + //! or it's a not inserted node: + //! return !NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static bool unique(const_node_ptr this_node); + + //! Effects: Returns true is "this_node" has the same state as if + //! it was inited using "init(node_ptr)" + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static bool inited(const_node_ptr this_node); + + //! Requires: prev_node must be in a circular list or be an empty circular list. + //! + //! Effects: Unlinks the next node of prev_node from the circular list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void unlink_after(node_ptr prev_node); + + //! Requires: prev_node and last_node must be in a circular list + //! or be an empty circular list. + //! + //! Effects: Unlinks the range (prev_node, last_node) from the linear list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void unlink_after(node_ptr prev_node, node_ptr last_node); + + //! Requires: prev_node must be a node of a linear list. + //! + //! Effects: Links this_node after prev_node in the linear list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void link_after(node_ptr prev_node, node_ptr this_node); + + //! Requires: b and e must be nodes of the same linear list or an empty range. + //! and p must be a node of a different linear list. + //! + //! Effects: Removes the nodes from (b, e] range from their linear list and inserts + //! them after p in p's linear list. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void transfer_after(node_ptr p, node_ptr b, node_ptr e); + + #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + + //! Effects: Constructs an empty list, making this_node the only + //! node of the circular list: + //! NodeTraits::get_next(this_node) == this_node. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void init_header(node_ptr this_node) + { NodeTraits::set_next(this_node, node_ptr(0)); } + + //! Requires: this_node and prev_init_node must be in the same linear list. + //! + //! Effects: Returns the previous node of this_node in the linear list starting. + //! the search from prev_init_node. The first node checked for equality + //! is NodeTraits::get_next(prev_init_node). + //! + //! Complexity: Linear to the number of elements between prev_init_node and this_node. + //! + //! Throws: Nothing. + static node_ptr get_previous_node(node_ptr prev_init_node, node_ptr this_node) + { return base_t::get_previous_node(prev_init_node, this_node); } + + //! Requires: this_node must be in a linear list or be an empty linear list. + //! + //! Effects: Returns the number of nodes in a linear list. If the linear list + //! is empty, returns 1. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr this_node) + { + std::size_t result = 0; + const_node_ptr p = this_node; + do{ + p = NodeTraits::get_next(p); + ++result; + } while (p); + return result; + } + + //! Requires: this_node and other_node must be nodes inserted + //! in linear lists or be empty linear lists. + //! + //! Effects: Moves all the nodes previously chained after this_node after other_node + //! and vice-versa. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + static void swap_trailing_nodes(node_ptr this_node, node_ptr other_node) + { + node_ptr this_nxt = NodeTraits::get_next(this_node); + node_ptr other_nxt = NodeTraits::get_next(other_node); + NodeTraits::set_next(this_node, other_nxt); + NodeTraits::set_next(other_node, this_nxt); + } + + //! Effects: Reverses the order of elements in the list. + //! + //! Returns: The new first node of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: This function is linear to the contained elements. + static node_ptr reverse(node_ptr p) + { + if(!p) return node_ptr(0); + node_ptr i = NodeTraits::get_next(p); + node_ptr first(p); + while(i){ + node_ptr nxti(NodeTraits::get_next(i)); + base_t::unlink_after(p); + NodeTraits::set_next(i, first); + first = i; + i = nxti; + } + return first; + } + + //! Effects: Moves the first n nodes starting at p to the end of the list. + //! + //! Returns: A pair containing the new first and last node of the list or + //! if there has been any movement, a null pair if n leads to no movement. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements plus the number moved positions. + static std::pair move_first_n_backwards(node_ptr p, std::size_t n) + { + std::pair ret(node_ptr(0), node_ptr(0)); + //Null shift, or count() == 0 or 1, nothing to do + if(!n || !p || !NodeTraits::get_next(p)){ + return ret; + } + + node_ptr first = p; + bool end_found = false; + node_ptr new_last(0); + node_ptr old_last(0); + + //Now find the new last node according to the shift count. + //If we find 0 before finding the new last node + //unlink p, shortcut the search now that we know the size of the list + //and continue. + for(std::size_t i = 1; i <= n; ++i){ + new_last = first; + first = NodeTraits::get_next(first); + if(first == 0){ + //Shortcut the shift with the modulo of the size of the list + n %= i; + if(!n) return ret; + old_last = new_last; + i = 0; + //Unlink p and continue the new first node search + first = p; + //unlink_after(new_last); + end_found = true; + } + } + + //If the p has not been found in the previous loop, find it + //starting in the new first node and unlink it + if(!end_found){ + old_last = base_t::get_previous_node(first, node_ptr(0)); + } + + //Now link p after the new last node + NodeTraits::set_next(old_last, p); + NodeTraits::set_next(new_last, node_ptr(0)); + ret.first = first; + ret.second = new_last; + return ret; + } + + //! Effects: Moves the first n nodes starting at p to the beginning of the list. + //! + //! Returns: A pair containing the new first and last node of the list or + //! if there has been any movement, a null pair if n leads to no movement. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements plus the number moved positions. + static std::pair move_first_n_forward(node_ptr p, std::size_t n) + { + std::pair ret(node_ptr(0), node_ptr(0)); + //Null shift, or count() == 0 or 1, nothing to do + if(!n || !p || !NodeTraits::get_next(p)) + return ret; + + node_ptr first = p; + + //Iterate until p is found to know where the current last node is. + //If the shift count is less than the size of the list, we can also obtain + //the position of the new last node after the shift. + node_ptr old_last(first), next_to_it, new_last(p); + std::size_t distance = 1; + while(!!(next_to_it = node_traits::get_next(old_last))){ + if(distance++ > n) + new_last = node_traits::get_next(new_last); + old_last = next_to_it; + } + //If the shift was bigger or equal than the size, obtain the equivalent + //forward shifts and find the new last node. + if(distance <= n){ + //Now find the equivalent forward shifts. + //Shortcut the shift with the modulo of the size of the list + std::size_t new_before_last_pos = (distance - (n % distance))% distance; + //If the shift is a multiple of the size there is nothing to do + if(!new_before_last_pos) + return ret; + + for( new_last = p + ; --new_before_last_pos + ; new_last = node_traits::get_next(new_last)){ + //empty + } + } + + //Get the first new node + node_ptr new_first(node_traits::get_next(new_last)); + //Now put the old beginning after the old end + NodeTraits::set_next(old_last, p); + NodeTraits::set_next(new_last, node_ptr(0)); + ret.first = new_first; + ret.second = new_last; + return ret; + } +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_LINEAR_SLIST_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/link_mode.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/link_mode.hpp new file mode 100644 index 0000000000..525e15000f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/link_mode.hpp @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_VALUE_LINK_TYPE_HPP +#define BOOST_INTRUSIVE_VALUE_LINK_TYPE_HPP + +namespace boost { +namespace intrusive { + +//!This enumeration defines the type of value_traits that can be defined +//!for Boost.Intrusive containers +enum link_mode_type{ + //!If this linking policy is specified in a value_traits class + //!as the link_mode, containers + //!configured with such value_traits won't set the hooks + //!of the erased values to a default state. Containers also won't + //!check that the hooks of the new values are default initialized. + normal_link, + + //!If this linking policy is specified in a value_traits class + //!as the link_mode, containers + //!configured with such value_traits will set the hooks + //!of the erased values to a default state. Containers also will + //!check that the hooks of the new values are default initialized. + safe_link, + + //!Same as "safe_link" but the user type is an auto-unlink + //!type, so the containers with constant-time size features won't be + //!compatible with value_traits configured with this policy. + //!Containers also know that the a value can be silently erased from + //!the container without using any function provided by the containers. + auto_unlink +}; +} //namespace intrusive +} //namespace boost + +#endif //BOOST_INTRUSIVE_VALUE_LINK_TYPE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/list.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/list.hpp new file mode 100644 index 0000000000..c6d94f24f2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/list.hpp @@ -0,0 +1,1476 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_LIST_HPP +#define BOOST_INTRUSIVE_LIST_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond + +template +struct listopt +{ + typedef ValueTraits value_traits; + typedef SizeType size_type; + static const bool constant_time_size = ConstantTimeSize; +}; + + +template +struct list_defaults + : pack_options + < none + , base_hook + , constant_time_size + , size_type + >::type +{}; + +/// @endcond + +//! The class template list is an intrusive container that mimics most of the +//! interface of std::list as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<> and \c size_type<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class list_impl +{ + //Public typedefs + public: + typedef typename Config::value_traits value_traits; + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + /// @endcond + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::const_pointer const_pointer; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename Config::size_type size_type; + typedef list_iterator iterator; + typedef list_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef circular_list_algorithms node_algorithms; + + static const bool constant_time_size = Config::constant_time_size; + static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; + + /// @cond + + private: + typedef detail::size_holder size_traits; + + //Non-copyable and non-moveable + list_impl (const list_impl&); + list_impl &operator =(const list_impl&); + + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + //Constant-time size is incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(constant_time_size && + ((int)real_value_traits::link_mode == (int)auto_unlink) + )); + + //Const cast emulation for smart pointers + static node_ptr uncast(const_node_ptr ptr) + { + //return node_ptr(detail::get_pointer(ptr))); + return const_cast(detail::get_pointer(ptr)); + } + + node_ptr get_root_node() + { return node_ptr(&data_.root_plus_size_.root_); } + + const_node_ptr get_root_node() const + { return const_node_ptr(&data_.root_plus_size_.root_); } + + struct root_plus_size : public size_traits + { + node root_; + }; + + struct data_t : public value_traits + { + typedef typename list_impl::value_traits value_traits; + data_t(const value_traits &val_traits) + : value_traits(val_traits) + {} + + root_plus_size root_plus_size_; + } data_; + + size_traits &priv_size_traits() + { return data_.root_plus_size_; } + + const size_traits &priv_size_traits() const + { return data_.root_plus_size_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_.get_value_traits(*this); } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_; } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_.get_value_traits(*this); } + + /// @endcond + + public: + + const real_value_traits &get_real_value_traits() const + { return this->get_real_value_traits(detail::bool_()); } + + real_value_traits &get_real_value_traits() + { return this->get_real_value_traits(detail::bool_()); } + + //! Effects: constructs an empty list. + //! + //! Complexity: Constant + //! + //! Throws: If real_value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks). + list_impl(const value_traits &v_traits = value_traits()) + : data_(v_traits) + { + this->priv_size_traits().set_size(size_type(0)); + node_algorithms::init_header(this->get_root_node()); + } + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! + //! Effects: Constructs a list equal to the range [first,last). + //! + //! Complexity: Linear in std::distance(b, e). No copy constructors are called. + //! + //! Throws: If real_value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks). + template + list_impl(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) + : data_(v_traits) + { + this->priv_size_traits().set_size(size_type(0)); + node_algorithms::init_header(this->get_root_node()); + this->insert(this->cend(), b, e); + } + + //! Effects: If it's not a safe-mode or an auto-unlink value_type + //! the destructor does nothing + //! (ie. no code is generated). Otherwise it detaches all elements from this. + //! In this case the objects in the list are not deleted (i.e. no destructors + //! are called), but the hooks according to the ValueTraits template parameter + //! are set to their default value. + //! + //! Complexity: Linear to the number of elements in the list, if + //! it's a safe-mode or auto-unlink value . Otherwise constant. + ~list_impl() + { + if(safemode_or_autounlink){ + this->clear(); + } + } + + //! Requires: value must be an lvalue. + //! + //! Effects: Inserts the value in the back of the list. + //! No copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + void push_back(reference value) + { + node_ptr to_insert = get_real_value_traits().to_node_ptr(value); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert)); + node_algorithms::link_before(this->get_root_node(), to_insert); + this->priv_size_traits().increment(); + } + + //! Requires: value must be an lvalue. + //! + //! Effects: Inserts the value in the front of the list. + //! No copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + void push_front(reference value) + { + node_ptr to_insert = get_real_value_traits().to_node_ptr(value); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert)); + node_algorithms::link_before(node_traits::get_next(this->get_root_node()), to_insert); + this->priv_size_traits().increment(); + } + + //! Effects: Erases the last element of the list. + //! No destructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators (but not the references) to the erased element. + void pop_back() + { return this->pop_back_and_dispose(detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the last element of the list. + //! No destructors are called. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators to the erased element. + template + void pop_back_and_dispose(Disposer disposer) + { + node_ptr to_erase = node_traits::get_previous(this->get_root_node()); + node_algorithms::unlink(to_erase); + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + } + + //! Effects: Erases the first element of the list. + //! No destructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators (but not the references) to the erased element. + void pop_front() + { return this->pop_front_and_dispose(detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the first element of the list. + //! No destructors are called. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators to the erased element. + template + void pop_front_and_dispose(Disposer disposer) + { + node_ptr to_erase = node_traits::get_next(this->get_root_node()); + node_algorithms::unlink(to_erase); + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + } + + //! Effects: Returns a reference to the first element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + reference front() + { return *get_real_value_traits().to_value_ptr(node_traits::get_next(this->get_root_node())); } + + //! Effects: Returns a const_reference to the first element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_reference front() const + { return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_next(this->get_root_node()))); } + + //! Effects: Returns a reference to the last element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + reference back() + { return *get_real_value_traits().to_value_ptr(node_traits::get_previous(this->get_root_node())); } + + //! Effects: Returns a const_reference to the last element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_reference back() const + { return *get_real_value_traits().to_value_ptr(uncast(node_traits::get_previous(this->get_root_node()))); } + + //! Effects: Returns an iterator to the first element contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + iterator begin() + { return iterator(node_traits::get_next(this->get_root_node()), this); } + + //! Effects: Returns a const_iterator to the first element contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator begin() const + { return this->cbegin(); } + + //! Effects: Returns a const_iterator to the first element contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator cbegin() const + { return const_iterator(node_traits::get_next(this->get_root_node()), this); } + + //! Effects: Returns an iterator to the end of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + iterator end() + { return iterator(this->get_root_node(), this); } + + //! Effects: Returns a const_iterator to the end of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator end() const + { return this->cend(); } + + //! Effects: Returns a constant iterator to the end of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator cend() const + { return const_iterator(uncast(this->get_root_node()), this); } + + //! Effects: Returns a reverse_iterator pointing to the beginning + //! of the reversed list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + reverse_iterator rbegin() + { return reverse_iterator(this->end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_reverse_iterator rbegin() const + { return this->crbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_reverse_iterator crbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + reverse_iterator rend() + { return reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_reverse_iterator rend() const + { return this->crend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_reverse_iterator crend() const + { return const_reverse_iterator(this->begin()); } + + //! Precondition: end_iterator must be a valid end iterator + //! of list. + //! + //! Effects: Returns a const reference to the list associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static list_impl &container_from_end_iterator(iterator end_iterator) + { return list_impl::priv_container_from_end_iterator(end_iterator); } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of list. + //! + //! Effects: Returns a const reference to the list associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const list_impl &container_from_end_iterator(const_iterator end_iterator) + { return list_impl::priv_container_from_end_iterator(end_iterator); } + + //! Effects: Returns the number of the elements contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements contained in the list. + //! if constant-time size option is disabled. Constant time otherwise. + //! + //! Note: Does not affect the validity of iterators and references. + size_type size() const + { + if(constant_time_size) + return this->priv_size_traits().get_size(); + else + return node_algorithms::count(this->get_root_node()) - 1; + } + + //! Effects: Returns true if the list contains no elements. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + bool empty() const + { return node_algorithms::unique(this->get_root_node()); } + + //! Effects: Swaps the elements of x and *this. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + void swap(list_impl& other) + { + node_algorithms::swap_nodes(this->get_root_node(), other.get_root_node()); + if(constant_time_size){ + size_type backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(other.priv_size_traits().get_size()); + other.priv_size_traits().set_size(backup); + } + } + + //! Effects: Moves backwards all the elements, so that the first + //! element becomes the second, the second becomes the third... + //! the last element becomes the first one. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of shifts. + //! + //! Note: Does not affect the validity of iterators and references. + void shift_backwards(size_type n = 1) + { node_algorithms::move_forward(this->get_root_node(), n); } + + //! Effects: Moves forward all the elements, so that the second + //! element becomes the first, the third becomes the second... + //! the first element becomes the last one. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of shifts. + //! + //! Note: Does not affect the validity of iterators and references. + void shift_forward(size_type n = 1) + { node_algorithms::move_backwards(this->get_root_node(), n); } + + //! Effects: Erases the element pointed by i of the list. + //! No destructors are called. + //! + //! Returns: the first element remaining beyond the removed element, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased element. + iterator erase(const_iterator i) + { return this->erase_and_dispose(i, detail::null_disposer()); } + + //! Requires: b and e must be valid iterators to elements in *this. + //! + //! Effects: Erases the element range pointed by b and e + //! No destructors are called. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of erased elements if it's a safe-mode + //! or auto-unlink value, or constant-time size is enabled. Constant-time otherwise. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased elements. + iterator erase(const_iterator b, const_iterator e) + { + if(safemode_or_autounlink || constant_time_size){ + return this->erase_and_dispose(b, e, detail::null_disposer()); + } + else{ + node_algorithms::unlink(b.pointed_node(), e.pointed_node()); + return e.unconst(); + } + } + + //! Requires: b and e must be valid iterators to elements in *this. + //! n must be std::distance(b, e). + //! + //! Effects: Erases the element range pointed by b and e + //! No destructors are called. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of erased elements if it's a safe-mode + //! or auto-unlink value is enabled. Constant-time otherwise. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased elements. + iterator erase(const_iterator b, const_iterator e, difference_type n) + { + BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(b, e) == difference_type(n)); + if(safemode_or_autounlink || constant_time_size){ + return this->erase_and_dispose(b, e, detail::null_disposer()); + } + else{ + if(constant_time_size){ + this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n); + } + node_algorithms::unlink(b.pointed_node(), e.pointed_node()); + return e.unconst(); + } + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed by i of the list. + //! No destructors are called. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Returns: the first element remaining beyond the removed element, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators to the erased element. + template + iterator erase_and_dispose(const_iterator i, Disposer disposer) + { + node_ptr to_erase(i.pointed_node()); + ++i; + node_algorithms::unlink(to_erase); + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(this->get_real_value_traits().to_value_ptr(to_erase)); + return i.unconst(); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element range pointed by b and e + //! No destructors are called. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements erased. + //! + //! Note: Invalidates the iterators to the erased elements. + template + iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) + { + node_ptr bp(b.pointed_node()), ep(e.pointed_node()); + node_algorithms::unlink(bp, ep); + while(bp != ep){ + node_ptr to_erase(bp); + bp = node_traits::get_next(bp); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + this->priv_size_traits().decrement(); + } + return e.unconst(); + } + + //! Effects: Erases all the elements of the container. + //! No destructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements of the list. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Note: Invalidates the iterators (but not the references) to the erased elements. + void clear() + { + if(safemode_or_autounlink){ + this->clear_and_dispose(detail::null_disposer()); + } + else{ + node_algorithms::init_header(this->get_root_node()); + this->priv_size_traits().set_size(size_type(0)); + } + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! No destructors are called. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements of the list. + //! + //! Note: Invalidates the iterators to the erased elements. + template + void clear_and_dispose(Disposer disposer) + { + const_iterator it(this->begin()), itend(this->end()); + while(it != itend){ + node_ptr to_erase(it.pointed_node()); + ++it; + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + } + node_algorithms::init_header(this->get_root_node()); + this->priv_size_traits().set_size(0); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws. Basic guarantee. + template + void clone_from(const list_impl &src, Cloner cloner, Disposer disposer) + { + this->clear_and_dispose(disposer); + detail::exception_disposer + rollback(*this, disposer); + const_iterator b(src.begin()), e(src.end()); + for(; b != e; ++b){ + this->push_back(*cloner(*b)); + } + rollback.release(); + } + + //! Requires: value must be an lvalue and p must be a valid iterator of *this. + //! + //! Effects: Inserts the value before the position pointed by p. + //! + //! Returns: An iterator to the inserted element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. No copy constructors are called. + //! + //! Note: Does not affect the validity of iterators and references. + iterator insert(const_iterator p, reference value) + { + node_ptr to_insert = this->get_real_value_traits().to_node_ptr(value); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert)); + node_algorithms::link_before(p.pointed_node(), to_insert); + this->priv_size_traits().increment(); + return iterator(to_insert, this); + } + + //! Requires: Dereferencing iterator must yield + //! an lvalue of type value_type and p must be a valid iterator of *this. + //! + //! Effects: Inserts the range pointed by b and e before the position p. + //! No copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements inserted. + //! + //! Note: Does not affect the validity of iterators and references. + template + void insert(const_iterator p, Iterator b, Iterator e) + { + for (; b != e; ++b) + this->insert(p, *b); + } + + //! Requires: Dereferencing iterator must yield + //! an lvalue of type value_type. + //! + //! Effects: Clears the list and inserts the range pointed by b and e. + //! No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements inserted plus + //! linear to the elements contained in the list if it's a safe-mode + //! or auto-unlink value. + //! Linear to the number of elements inserted in the list otherwise. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. + template + void assign(Iterator b, Iterator e) + { + this->clear(); + this->insert(this->cend(), b, e); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Requires: Dereferencing iterator must yield + //! an lvalue of type value_type. + //! + //! Effects: Clears the list and inserts the range pointed by b and e. + //! No destructors or copy constructors are called. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements inserted plus + //! linear to the elements contained in the list. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. + template + void dispose_and_assign(Disposer disposer, Iterator b, Iterator e) + { + this->clear_and_dispose(disposer); + this->insert(this->cend(), b, e); + } + + //! Requires: p must be a valid iterator of *this. + //! + //! Effects: Transfers all the elements of list x to this list, before the + //! the element pointed by p. No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Iterators of values obtained from list x now point to elements of + //! this list. Iterators of this list and all the references are not invalidated. + void splice(const_iterator p, list_impl& x) + { + if(!x.empty()){ + size_traits &thist = this->priv_size_traits(); + size_traits &xt = x.priv_size_traits(); + node_algorithms::transfer + (p.pointed_node(), x.begin().pointed_node(), x.end().pointed_node()); + thist.set_size(thist.get_size() + xt.get_size()); + xt.set_size(size_type(0)); + } + } + + //! Requires: p must be a valid iterator of *this. + //! new_ele must point to an element contained in list x. + //! + //! Effects: Transfers the value pointed by new_ele, from list x to this list, + //! before the the element pointed by p. No destructors or copy constructors are called. + //! If p == new_ele or p == ++new_ele, this function is a null operation. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice(const_iterator p, list_impl&x, const_iterator new_ele) + { + node_algorithms::transfer(p.pointed_node(), new_ele.pointed_node()); + x.priv_size_traits().decrement(); + this->priv_size_traits().increment(); + } + + //! Requires: p must be a valid iterator of *this. + //! start and end must point to elements contained in list x. + //! + //! Effects: Transfers the range pointed by start and end from list x to this list, + //! before the the element pointed by p. No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements transferred + //! if constant-time size option is enabled. Constant-time otherwise. + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end) + { + if(constant_time_size) + this->splice(p, x, start, end, std::distance(start, end)); + else + this->splice(p, x, start, end, 1);//distance is a dummy value + } + + //! Requires: p must be a valid iterator of *this. + //! start and end must point to elements contained in list x. + //! n == std::distance(start, end) + //! + //! Effects: Transfers the range pointed by start and end from list x to this list, + //! before the the element pointed by p. No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end, difference_type n) + { + if(n){ + if(constant_time_size){ + size_traits &thist = this->priv_size_traits(); + size_traits &xt = x.priv_size_traits(); + BOOST_INTRUSIVE_INVARIANT_ASSERT(n == std::distance(start, end)); + node_algorithms::transfer(p.pointed_node(), start.pointed_node(), end.pointed_node()); + thist.set_size(thist.get_size() + n); + xt.set_size(xt.get_size() - n); + } + else{ + node_algorithms::transfer(p.pointed_node(), start.pointed_node(), end.pointed_node()); + } + } + } + + //! Effects: This function sorts the list *this according to std::less. + //! The sort is stable, that is, the relative order of equivalent elements is preserved. + //! + //! Throws: If real_value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or std::less throws. Basic guarantee. + //! + //! Notes: Iterators and references are not invalidated. + //! + //! Complexity: The number of comparisons is approximately N log N, where N + //! is the list's size. + void sort() + { this->sort(std::less()); } + + //! Requires: p must be a comparison function that induces a strict weak ordering + //! + //! Effects: This function sorts the list *this according to p. The sort is + //! stable, that is, the relative order of equivalent elements is preserved. + //! + //! Throws: If real_value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the predicate throws. Basic guarantee. + //! + //! Notes: This won't throw if list_base_hook<> or + //! list_member_hook are used. + //! Iterators and references are not invalidated. + //! + //! Complexity: The number of comparisons is approximately N log N, where N + //! is the list's size. + template + void sort(Predicate p) + { + if(node_traits::get_next(this->get_root_node()) + != node_traits::get_previous(this->get_root_node())){ + list_impl carry; + list_impl counter[64]; + int fill = 0; + while(!this->empty()){ + carry.splice(carry.cbegin(), *this, this->cbegin()); + int i = 0; + while(i < fill && !counter[i].empty()) { + carry.merge(counter[i++], p); + } + carry.swap(counter[i]); + if(i == fill) + ++fill; + } + for (int i = 1; i < fill; ++i) + counter[i].merge(counter[i-1], p); + this->swap(counter[fill-1]); + } + } + + //! Effects: This function removes all of x's elements and inserts them + //! in order into *this according to std::less. The merge is stable; + //! that is, if an element from *this is equivalent to one from x, then the element + //! from *this will precede the one from x. + //! + //! Throws: If std::less throws. Basic guarantee. + //! + //! Complexity: This function is linear time: it performs at most + //! size() + x.size() - 1 comparisons. + //! + //! Note: Iterators and references are not invalidated + void merge(list_impl& x) + { this->merge(x, std::less()); } + + //! Requires: p must be a comparison function that induces a strict weak + //! ordering and both *this and x must be sorted according to that ordering + //! The lists x and *this must be distinct. + //! + //! Effects: This function removes all of x's elements and inserts them + //! in order into *this. The merge is stable; that is, if an element from *this is + //! equivalent to one from x, then the element from *this will precede the one from x. + //! + //! Throws: If the predicate throws. Basic guarantee. + //! + //! Complexity: This function is linear time: it performs at most + //! size() + x.size() - 1 comparisons. + //! + //! Note: Iterators and references are not invalidated. + template + void merge(list_impl& x, Predicate p) + { + const_iterator e(this->end()); + const_iterator bx(x.begin()); + const_iterator ex(x.end()); + + for (const_iterator b = this->cbegin(); b != e; ++b) { + size_type n(0); + const_iterator ix(bx); + while(ix != ex && p(*ix, *b)){ + ++ix; ++n; + } + this->splice(b, x, bx, ix, n); + bx = ix; + } + //Now transfer the rest at the end of the container + this->splice(e, x); + } + + //! Effects: Reverses the order of elements in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: This function is linear time. + //! + //! Note: Iterators and references are not invalidated + void reverse() + { node_algorithms::reverse(this->get_root_node()); } + + //! Effects: Removes all the elements that compare equal to value. + //! No destructors are called. + //! + //! Throws: If std::equal_to throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() comparisons for equality. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + void remove(const_reference value) + { this->remove_if(detail::equal_to_value(value)); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes all the elements that compare equal to value. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If std::equal_to throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() comparisons for equality. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void remove_and_dispose(const_reference value, Disposer disposer) + { this->remove_and_dispose_if(detail::equal_to_value(value), disposer); } + + //! Effects: Removes all the elements for which a specified + //! predicate is satisfied. No destructors are called. + //! + //! Throws: If pred throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() calls to the predicate. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void remove_if(Pred pred) + { this->remove_and_dispose_if(pred, detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes all the elements for which a specified + //! predicate is satisfied. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If pred throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() comparisons for equality. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void remove_and_dispose_if(Pred pred, Disposer disposer) + { + const_iterator cur(this->cbegin()); + const_iterator last(this->cend()); + while(cur != last) { + if(pred(*cur)){ + cur = this->erase_and_dispose(cur, disposer); + } + else{ + ++cur; + } + } + } + + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that are equal from the list. No destructors are called. + //! + //! Throws: If std::equal_toComplexity: Linear time (size()-1 comparisons calls to pred()). + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + void unique() + { this->unique_and_dispose(std::equal_to(), detail::null_disposer()); } + + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that satisfy some binary predicate from the list. + //! No destructors are called. + //! + //! Throws: If pred throws. Basic guarantee. + //! + //! Complexity: Linear time (size()-1 comparisons equality comparisons). + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void unique(BinaryPredicate pred) + { this->unique_and_dispose(pred, detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that are equal from the list. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If std::equal_toComplexity: Linear time (size()-1) comparisons equality comparisons. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void unique_and_dispose(Disposer disposer) + { this->unique_and_dispose(std::equal_to(), disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that satisfy some binary predicate from the list. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If pred throws. Basic guarantee. + //! + //! Complexity: Linear time (size()-1) comparisons equality comparisons. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void unique_and_dispose(BinaryPredicate pred, Disposer disposer) + { + const_iterator itend(this->cend()); + const_iterator cur(this->cbegin()); + + if(cur != itend){ + const_iterator after(cur); + ++after; + while(after != itend){ + if(pred(*cur, *after)){ + after = this->erase_and_dispose(after, disposer); + } + else{ + cur = after; + ++after; + } + } + } + } + + //! Requires: value must be a reference to a value inserted in a list. + //! + //! Effects: This function returns a const_iterator pointing to the element + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + //! This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value))); + return iterator(real_value_traits::to_node_ptr(value), 0); + } + + //! Requires: value must be a const reference to a value inserted in a list. + //! + //! Effects: This function returns an iterator pointing to the element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + //! This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast (value)))); + return const_iterator(real_value_traits::to_node_ptr(const_cast (value)), 0); + } + + //! Requires: value must be a reference to a value inserted in a list. + //! + //! Effects: This function returns a const_iterator pointing to the element + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + iterator iterator_to(reference value) + { + BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(value))); + return iterator(real_value_traits::to_node_ptr(value), this); + } + + //! Requires: value must be a const reference to a value inserted in a list. + //! + //! Effects: This function returns an iterator pointing to the element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + const_iterator iterator_to(const_reference value) const + { + BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(real_value_traits::to_node_ptr(const_cast (value)))); + return const_iterator(real_value_traits::to_node_ptr(const_cast (value)), this); + } + + /// @cond + + private: + static list_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) + { + root_plus_size *r = detail::parent_from_member + ( detail::get_pointer(end_iterator.pointed_node()), &root_plus_size::root_); + data_t *d = detail::parent_from_member + ( r, &data_t::root_plus_size_); + list_impl *s = detail::parent_from_member(d, &list_impl::data_); + return *s; + } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator< +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const list_impl &x, const list_impl &y) +#else +(const list_impl &x, const list_impl &y) +#endif +{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +bool operator== +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const list_impl &x, const list_impl &y) +#else +(const list_impl &x, const list_impl &y) +#endif +{ + typedef list_impl list_type; + typedef typename list_type::const_iterator const_iterator; + const bool C = list_type::constant_time_size; + if(C && x.size() != y.size()){ + return false; + } + const_iterator end1 = x.end(); + + const_iterator i1 = x.begin(); + const_iterator i2 = y.begin(); + if(C){ + while (i1 != end1 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1; + } + else{ + const_iterator end2 = y.end(); + while (i1 != end1 && i2 != end2 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1 && i2 == end2; + } +} + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const list_impl &x, const list_impl &y) +#else +(const list_impl &x, const list_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const list_impl &x, const list_impl &y) +#else +(const list_impl &x, const list_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const list_impl &x, const list_impl &y) +#else +(const list_impl &x, const list_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const list_impl &x, const list_impl &y) +#else +(const list_impl &x, const list_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(list_impl &x, list_impl &y) +#else +(list_impl &x, list_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c list that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_list +{ + /// @cond + typedef typename pack_options + < list_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef typename detail::get_value_traits + ::type value_traits; + + typedef list_impl + < + listopt + < value_traits + , typename packed_options::size_type + , packed_options::constant_time_size + > + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class list + : public make_list::type +{ + typedef typename make_list + ::type Base; + typedef typename Base::real_value_traits real_value_traits; + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + public: + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + list(const value_traits &v_traits = value_traits()) + : Base(v_traits) + {} + + template + list(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) + : Base(b, e, v_traits) + {} + + static list &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const list &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_LIST_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/list_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/list_hook.hpp new file mode 100644 index 0000000000..86745cf195 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/list_hook.hpp @@ -0,0 +1,288 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_LIST_HOOK_HPP +#define BOOST_INTRUSIVE_LIST_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +template +struct get_list_node_algo +{ + typedef circular_list_algorithms > type; +}; +/// @endcond + +//! Helper metafunction to define a \c \c list_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_list_base_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_list_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::ListBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from this hook in order to store objects of that class +//! in an list. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<> and +//! \c link_mode<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! unique tag. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class list_base_hook + : public make_list_base_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + list_base_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + list_base_hook(const list_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + list_base_hook& operator=(const list_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in an list an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~list_base_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(list_base_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c list::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +//! Helper metafunction to define a \c \c list_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_list_member_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_list_node_algo + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Store this hook in a class to be inserted +//! in an list. +//! +//! The hook admits the following options: \c void_pointer<> and +//! \c link_mode<>. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class list_member_hook + : public make_list_member_hook + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + + #else + + #endif + ::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + list_member_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + list_member_hook(const list_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + list_member_hook& operator=(const list_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in an list an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~list_member_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(list_member_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c list::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_LIST_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/member_value_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/member_value_traits.hpp new file mode 100644 index 0000000000..b32f8c431e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/member_value_traits.hpp @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP +#define BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP + +#include +#include +#include + +namespace boost { +namespace intrusive { + +//!This value traits template is used to create value traits +//!from user defined node traits where value_traits::value_type will +//!store a node_traits::node +template< class T, class NodeTraits + , typename NodeTraits::node T::* PtrToMember + , link_mode_type LinkMode = safe_link> +struct member_value_traits +{ + public: + typedef NodeTraits node_traits; + typedef T value_type; + typedef typename node_traits::node node; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename boost::pointer_to_other::type pointer; + typedef typename boost::pointer_to_other::type const_pointer; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + static const link_mode_type link_mode = LinkMode; + + static node_ptr to_node_ptr(reference value) + { return node_ptr(&(value.*PtrToMember)); } + + static const_node_ptr to_node_ptr(const_reference value) + { return node_ptr(&(value.*PtrToMember)); } + + static pointer to_value_ptr(node_ptr n) + { + return pointer(detail::parent_from_member + (detail::get_pointer(n), PtrToMember)); + } + + static const_pointer to_value_ptr(const_node_ptr n) + { + return pointer(detail::parent_from_member + (detail::get_pointer(n), PtrToMember)); + } +}; + +} //namespace intrusive +} //namespace boost + +#endif //BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/options.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/options.hpp new file mode 100644 index 0000000000..b937698958 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/options.hpp @@ -0,0 +1,780 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_OPTIONS_HPP +#define BOOST_INTRUSIVE_OPTIONS_HPP + +#include +#include +#include +#include +#include +#include + + +namespace boost { +namespace intrusive { + +/// @cond + +struct default_tag; +struct member_tag; + +namespace detail{ + +struct default_hook_tag{}; + +#define BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER) \ +struct BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER : public default_hook_tag\ +{\ + template \ + struct apply\ + { typedef typename T::BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER type; };\ +}\ + +BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_list_hook); +BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_slist_hook); +BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_set_hook); +BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_uset_hook); +BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_avl_set_hook); +BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_splay_set_hook); +BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION(default_bs_set_hook); + +#undef BOOST_INTRUSIVE_DEFAULT_HOOK_MARKER_DEFINITION + +template +struct eval_value_traits +{ + typedef typename ValueTraits::value_traits type; +}; + +template +struct external_bucket_traits_is_true +{ + static const bool value = external_bucket_traits_bool::value == 3; +}; + +template +struct eval_bucket_traits +{ + typedef typename BucketTraits::bucket_traits type; +}; + +template +struct concrete_hook_base_value_traits +{ + typedef typename BaseHook::boost_intrusive_tags tags; + typedef detail::base_hook_traits + < T + , typename tags::node_traits + , tags::link_mode + , typename tags::tag + , tags::hook_type> type; +}; + +template +struct concrete_hook_base_node_traits +{ typedef typename BaseHook::boost_intrusive_tags::node_traits type; }; + +template +struct any_hook_base_value_traits +{ + typedef typename BaseHook::boost_intrusive_tags tags; + typedef detail::base_hook_traits + < T + , typename BaseHook::node_traits + , tags::link_mode + , typename tags::tag + , tags::hook_type> type; +}; + +template +struct any_hook_base_node_traits +{ typedef typename BaseHook::node_traits type; }; + +template +struct get_base_value_traits +{ + typedef typename detail::eval_if_c + < internal_any_hook_bool_is_true::value + , any_hook_base_value_traits + , concrete_hook_base_value_traits + >::type type; +}; + +template +struct get_base_node_traits +{ + typedef typename detail::eval_if_c + < internal_any_hook_bool_is_true::value + , any_hook_base_node_traits + , concrete_hook_base_node_traits + >::type type; +}; + +template +struct get_member_value_traits +{ + typedef typename MemberHook::member_value_traits type; +}; + +template +struct get_member_node_traits +{ + typedef typename MemberHook::member_value_traits::node_traits type; +}; + +template +struct get_value_traits +{ + typedef typename detail::eval_if_c + ::value + ,detail::apply + ,detail::identity + >::type supposed_value_traits; + //...if it's a default hook + typedef typename detail::eval_if_c + < internal_base_hook_bool_is_true::value + //...get it's internal value traits using + //the provided T value type. + , get_base_value_traits + //...else use it's internal value traits tag + //(member hooks and custom value traits are in this group) + , detail::eval_if_c + < internal_member_value_traits::value + , get_member_value_traits + , detail::identity + > + >::type type; +}; + +template +struct get_explicit_node_traits +{ + typedef typename ValueTraits::node_traits type; +}; + +template +struct get_node_traits +{ + typedef SupposedValueTraits supposed_value_traits; + //...if it's a base hook + typedef typename detail::eval_if_c + < internal_base_hook_bool_is_true::value + //...get it's internal value traits using + //the provided T value type. + , get_base_node_traits + //...else use it's internal value traits tag + //(member hooks and custom value traits are in this group) + , detail::eval_if_c + < internal_member_value_traits::value + , get_member_node_traits + , get_explicit_node_traits + > + >::type type; +}; + +} //namespace detail{ + + +//!This type indicates that no option is being used +//!and that the default options should be used +struct none +{ + template + struct pack : Base + { }; +}; + +/// @endcond + +//!This option setter specifies if the intrusive +//!container stores its size as a member to +//!obtain constant-time size() member. +template +struct constant_time_size +{ +/// @cond + template + struct pack : Base + { + static const bool constant_time_size = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies the type that +//!the container will use to store its size. +template +struct size_type +{ +/// @cond + template + struct pack : Base + { + typedef SizeType size_type; + }; +/// @endcond +}; + +//!This option setter specifies the strict weak ordering +//!comparison functor for the value type +template +struct compare +{ +/// @cond + template + struct pack : Base + { + typedef Compare compare; + }; +/// @endcond +}; + +//!This option setter for scapegoat containers specifies if +//!the intrusive scapegoat container should use a non-variable +//!alpha value that does not need floating-point operations. +//! +//!If activated, the fixed alpha value is 1/sqrt(2). This +//!option also saves some space in the container since +//!the alpha value and some additional data does not need +//!to be stored in the container. +//! +//!If the user only needs an alpha value near 1/sqrt(2), this +//!option also improves performance since avoids logarithm +//!and division operations when rebalancing the tree. +template +struct floating_point +{ +/// @cond + template + struct pack : Base + { + static const bool floating_point = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies the equality +//!functor for the value type +template +struct equal +{ +/// @cond + template + struct pack : Base + { + typedef Equal equal; + }; +/// @endcond +}; + +//!This option setter specifies the hash +//!functor for the value type +template +struct hash +{ +/// @cond + template + struct pack : Base + { + typedef Hash hash; + }; +/// @endcond +}; + +//!This option setter specifies the relationship between the type +//!to be managed by the container (the value type) and the node to be +//!used in the node algorithms. It also specifies the linking policy. +template +struct value_traits +{ +/// @cond + template + struct pack : Base + { + typedef ValueTraits value_traits; + }; +/// @endcond +}; + +//!This option setter specifies the member hook the +//!container must use. +template< typename Parent + , typename MemberHook + , MemberHook Parent::* PtrToMember> +struct member_hook +{ +/// @cond + typedef detail::member_hook_traits + < Parent + , MemberHook + , PtrToMember + > member_value_traits; + template + struct pack : Base + { + typedef member_value_traits value_traits; + }; +/// @endcond +}; + + +//!This option setter specifies that the container +//!must use the specified base hook +template +struct base_hook +{ +/// @cond + template + struct pack : Base + { + typedef BaseHook value_traits; + }; +/// @endcond +}; + +//!This option setter specifies the type of +//!a void pointer. This will instruct the hook +//!to use this type of pointer instead of the +//!default one +template +struct void_pointer +{ +/// @cond + template + struct pack : Base + { + typedef VoidPointer void_pointer; + }; +/// @endcond +}; + +//!This option setter specifies the type of +//!the tag of a base hook. A type cannot have two +//!base hooks of the same type, so a tag can be used +//!to differentiate two base hooks with otherwise same type +template +struct tag +{ +/// @cond + template + struct pack : Base + { + typedef Tag tag; + }; +/// @endcond +}; + +//!This option setter specifies the link mode +//!(normal_link, safe_link or auto_unlink) +template +struct link_mode +{ +/// @cond + template + struct pack : Base + { + static const link_mode_type link_mode = LinkType; + }; +/// @endcond +}; + +//!This option setter specifies if the hook +//!should be optimized for size instead of for speed. +template +struct optimize_size +{ +/// @cond + template + struct pack : Base + { + static const bool optimize_size = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies if the list container should +//!use a linear implementation instead of a circular one. +template +struct linear +{ +/// @cond + template + struct pack : Base + { + static const bool linear = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies if the list container should +//!use a linear implementation instead of a circular one. +template +struct cache_last +{ +/// @cond + template + struct pack : Base + { + static const bool cache_last = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies the bucket traits +//!class for unordered associative containers. When this option is specified, +//!instead of using the default bucket traits, a user defined holder will be defined +template +struct bucket_traits +{ +/// @cond + template + struct pack : Base + { + typedef BucketTraits bucket_traits; + }; +/// @endcond +}; + +//!This option setter specifies if the unordered hook +//!should offer room to store the hash value. +//!Storing the hash in the hook will speed up rehashing +//!processes in applications where rehashing is frequent, +//!rehashing might throw or the value is heavy to hash. +template +struct store_hash +{ +/// @cond + template + struct pack : Base + { + static const bool store_hash = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies if the unordered hook +//!should offer room to store another link to another node +//!with the same key. +//!Storing this link will speed up lookups and insertions on +//!unordered_multiset containers with a great number of elements +//!with the same key. +template +struct optimize_multikey +{ +/// @cond + template + struct pack : Base + { + static const bool optimize_multikey = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies if the bucket array will be always power of two. +//!This allows using masks instead of the default modulo operation to determine +//!the bucket number from the hash value, leading to better performance. +//!In debug mode, if power of two buckets mode is activated, the bucket length +//!will be checked to through assertions to assure the bucket length is power of two. +template +struct power_2_buckets +{ +/// @cond + template + struct pack : Base + { + static const bool power_2_buckets = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies if the container will cache a pointer to the first +//!non-empty bucket so that begin() is always constant-time. +//!This is specially helpful when we can have containers with a few elements +//!but with big bucket arrays (that is, hashtables with low load factors). +template +struct cache_begin +{ +/// @cond + template + struct pack : Base + { + static const bool cache_begin = Enabled; + }; +/// @endcond +}; + + +//!This option setter specifies if the container will compare the hash value +//!before comparing objects. This option can't be specified if store_hash<> +//!is not true. +//!This is specially helpful when we have containers with a high load factor. +//!and the comparison function is much more expensive that comparing already +//!stored hash values. +template +struct compare_hash +{ +/// @cond + template + struct pack : Base + { + static const bool compare_hash = Enabled; + }; +/// @endcond +}; + +//!This option setter specifies if the hash container will use incremental +//!hashing. With incremental hashing the cost of hash table expansion is spread +//!out across each hash table insertion operation, as opposed to be incurred all at once. +//!Therefore linear hashing is well suited for interactive applications or real-time +//!appplications where the worst-case insertion time of non-incremental hash containers +//!(rehashing the whole bucket array) is not admisible. +template +struct incremental +{ + /// @cond + template + struct pack : Base + { + static const bool incremental = Enabled; + }; + /// @endcond +}; + +/// @cond + +//To-do: pass to variadic templates +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + +template +struct do_pack +{ + //Use "pack" member template to pack options + typedef typename Next::template pack type; +}; + +template +struct do_pack +{ + //Avoid packing "none" to shorten template names + typedef Prev type; +}; + +template + < class DefaultOptions + , class O1 = none + , class O2 = none + , class O3 = none + , class O4 = none + , class O5 = none + , class O6 = none + , class O7 = none + , class O8 = none + , class O9 = none + , class O10 = none + , class O11 = none + > +struct pack_options +{ + // join options + typedef + typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < typename do_pack + < DefaultOptions + , O1 + >::type + , O2 + >::type + , O3 + >::type + , O4 + >::type + , O5 + >::type + , O6 + >::type + , O7 + >::type + , O8 + >::type + , O9 + >::type + , O10 + >::type + , O11 + >::type + type; +}; +#else + +//index_tuple +template +struct index_tuple{}; + +//build_number_seq +template > +struct build_number_seq; + +template +struct build_number_seq > + : build_number_seq > +{}; + +template +struct build_number_seq<0, index_tuple > +{ typedef index_tuple type; }; + +template +struct typelist +{}; + +//invert_typelist +template +struct invert_typelist; + +template +struct typelist_element; + +template +struct typelist_element > +{ + typedef typename typelist_element >::type type; +}; + +template +struct typelist_element<0, typelist > +{ + typedef Head type; +}; + +template +typelist >::type...> + inverted_typelist(index_tuple, typelist) +{ + return typelist >::type...>(); +} + +//sizeof_typelist +template +struct sizeof_typelist; + +template +struct sizeof_typelist< typelist > +{ + static const std::size_t value = sizeof...(Types); +}; + +//invert_typelist_impl +template +struct invert_typelist_impl; + + +template +struct invert_typelist_impl< Typelist, index_tuple > +{ + static const std::size_t last_idx = sizeof_typelist::value - 1; + typedef typelist + ::type...> type; +}; + +template +struct invert_typelist_impl< Typelist, index_tuple > +{ + typedef Typelist type; +}; + +template +struct invert_typelist_impl< Typelist, index_tuple<> > +{ + typedef Typelist type; +}; + +//invert_typelist +template +struct invert_typelist; + +template +struct invert_typelist< typelist > +{ + typedef typelist typelist_t; + typedef typename build_number_seq::type indexes_t; + typedef typename invert_typelist_impl::type type; +}; + +//Do pack +template +struct do_pack; + +template<> +struct do_pack >; + +template +struct do_pack > +{ + typedef Prev type; +}; + +template +struct do_pack > +{ + typedef typename Prev::template pack type; +}; + +template +struct do_pack > +{ + typedef typename Prev::template pack + >::type> type; +}; + + +template +struct pack_options +{ + typedef typelist typelist_t; + typedef typename invert_typelist::type inverted_typelist; + typedef typename do_pack::type type; +}; + +#endif + +struct hook_defaults + : public pack_options + < none + , void_pointer + , link_mode + , tag + , optimize_size + , store_hash + , linear + , optimize_multikey + >::type +{}; + +/// @endcond + +} //namespace intrusive { +} //namespace boost { + +#include + +#endif //#ifndef BOOST_INTRUSIVE_OPTIONS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/pointer_plus_bits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/pointer_plus_bits.hpp new file mode 100644 index 0000000000..ec1fe51c91 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/pointer_plus_bits.hpp @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP +#define BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP + +#include //ls_zeros +#include //BOOST_INTRUSIVE_INVARIANT_ASSERT + +namespace boost { +namespace intrusive { + +//!This trait class is used to know if a pointer +//!can embed extra bits of information if +//!it's going to be used to point to objects +//!with an alignment of "Alignment" bytes. +template +struct max_pointer_plus_bits +{ + static const std::size_t value = 0; +}; + +//!This is a specialization for raw pointers. +//!Raw pointers can embed extra bits in the lower bits +//!if the alignment is multiple of 2pow(NumBits). +template +struct max_pointer_plus_bits +{ + static const std::size_t value = detail::ls_zeros::value; +}; + +//!This is class that is supposed to have static methods +//!to embed extra bits of information in a pointer. +//!This is a declaration and there is no default implementation, +//!because operations to embed the bits change with every pointer type. +//! +//!An implementation that detects that a pointer type whose +//!has_pointer_plus_bits<>::value is non-zero can make use of these +//!operations to embed the bits in the pointer. +template +struct pointer_plus_bits; + +//!This is the specialization to embed extra bits of information +//!in a raw pointer. The extra bits are stored in the lower bit of the pointer. +template +struct pointer_plus_bits +{ + static const std::size_t Mask = ((std::size_t(1u) << NumBits) - 1); + typedef T* pointer; + + static pointer get_pointer(pointer n) + { return pointer(std::size_t(n) & ~Mask); } + + static void set_pointer(pointer &n, pointer p) + { + BOOST_INTRUSIVE_INVARIANT_ASSERT(0 == (std::size_t(p) & Mask)); + n = pointer(std::size_t(p) | (std::size_t(n) & Mask)); + } + + static std::size_t get_bits(pointer n) + { return (std::size_t(n) & Mask); } + + static void set_bits(pointer &n, std::size_t c) + { + BOOST_INTRUSIVE_INVARIANT_ASSERT(c <= Mask); + n = pointer(std::size_t(get_pointer(n)) | c); + } +}; + +} //namespace intrusive +} //namespace boost + +#endif //BOOST_INTRUSIVE_POINTER_PLUS_BITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/rbtree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/rbtree.hpp new file mode 100644 index 0000000000..94d1a3996a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/rbtree.hpp @@ -0,0 +1,1479 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_RBTREE_HPP +#define BOOST_INTRUSIVE_RBTREE_HPP + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond + +template +struct setopt +{ + typedef ValueTraits value_traits; + typedef Compare compare; + typedef SizeType size_type; + static const bool constant_time_size = ConstantTimeSize; +}; + +template +struct set_defaults + : pack_options + < none + , base_hook + , constant_time_size + , size_type + , compare > + >::type +{}; + +/// @endcond + +//! The class template rbtree is an intrusive red-black tree container, that +//! is used to construct intrusive set and multiset containers. The no-throw +//! guarantee holds only, if the value_compare object +//! doesn't throw. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class rbtree_impl +{ + public: + typedef typename Config::value_traits value_traits; + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + /// @endcond + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::const_pointer const_pointer; + typedef typename std::iterator_traits::value_type value_type; + typedef value_type key_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename Config::size_type size_type; + typedef typename Config::compare value_compare; + typedef value_compare key_compare; + typedef tree_iterator iterator; + typedef tree_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef rbtree_algorithms node_algorithms; + + static const bool constant_time_size = Config::constant_time_size; + static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; + + /// @cond + private: + typedef detail::size_holder size_traits; + + //noncopyable + rbtree_impl (const rbtree_impl&); + rbtree_impl operator =(const rbtree_impl&); + + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + //Constant-time size is incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink))); + + struct header_plus_size : public size_traits + { node header_; }; + + struct node_plus_pred_t : public detail::ebo_functor_holder + { + node_plus_pred_t(const value_compare &comp) + : detail::ebo_functor_holder(comp) + {} + header_plus_size header_plus_size_; + }; + + struct data_t : public rbtree_impl::value_traits + { + typedef typename rbtree_impl::value_traits value_traits; + data_t(const value_compare & comp, const value_traits &val_traits) + : value_traits(val_traits), node_plus_pred_(comp) + {} + node_plus_pred_t node_plus_pred_; + } data_; + + const value_compare &priv_comp() const + { return data_.node_plus_pred_.get(); } + + value_compare &priv_comp() + { return data_.node_plus_pred_.get(); } + + const node &priv_header() const + { return data_.node_plus_pred_.header_plus_size_.header_; } + + node &priv_header() + { return data_.node_plus_pred_.header_plus_size_.header_; } + + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(detail::get_pointer(ptr))); + } + + size_traits &priv_size_traits() + { return data_.node_plus_pred_.header_plus_size_; } + + const size_traits &priv_size_traits() const + { return data_.node_plus_pred_.header_plus_size_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_.get_value_traits(*this); } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_; } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_.get_value_traits(*this); } + + /// @endcond + + public: + + const real_value_traits &get_real_value_traits() const + { return this->get_real_value_traits(detail::bool_()); } + + real_value_traits &get_real_value_traits() + { return this->get_real_value_traits(detail::bool_()); } + + typedef typename node_algorithms::insert_commit_data insert_commit_data; + + //! Effects: Constructs an empty tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + rbtree_impl( value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + } + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty tree and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is the distance between first and last. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + template + rbtree_impl( bool unique, Iterator b, Iterator e + , value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + if(unique) + this->insert_unique(b, e); + else + this->insert_equal(b, e); + } + + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called), but the nodes according to + //! the value_traits template parameter are reinitialized and thus can be reused. + //! + //! Complexity: Linear to elements contained in *this. + //! + //! Throws: Nothing. + ~rbtree_impl() + { this->clear(); } + + //! Effects: Returns an iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return iterator (node_traits::get_left(node_ptr(&priv_header())), this); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return cbegin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return const_iterator (node_traits::get_left(const_node_ptr(&priv_header())), this); } + + //! Effects: Returns an iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return iterator (node_ptr(&priv_header()), this); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return cend(); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return const_iterator (uncast(const_node_ptr(&priv_header())), this); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return const_reverse_iterator(begin()); } + + //! Precondition: end_iterator must be a valid end iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the rbtree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static rbtree_impl &container_from_end_iterator(iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the rbtree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const rbtree_impl &container_from_end_iterator(const_iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: it must be a valid iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static rbtree_impl &container_from_iterator(iterator it) + { return priv_container_from_iterator(it); } + + //! Precondition: it must be a valid end const_iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const rbtree_impl &container_from_iterator(const_iterator it) + { return priv_container_from_iterator(it); } + + //! Effects: Returns the value_compare object used by the tree. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return priv_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return node_algorithms::unique(const_node_ptr(&priv_header())); } + + //! Effects: Returns the number of elements stored in the tree. + //! + //! Complexity: Linear to elements contained in *this. + //! + //! Throws: Nothing. + size_type size() const + { + if(constant_time_size) + return this->priv_size_traits().get_size(); + else{ + return (size_type)node_algorithms::size(const_node_ptr(&priv_header())); + } + } + + //! Effects: Swaps the contents of two multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the comparison functor's swap call throws. + void swap(rbtree_impl& other) + { + //This can throw + using std::swap; + swap(priv_comp(), priv_comp()); + //These can't throw + node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header())); + if(constant_time_size){ + size_type backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(other.priv_size_traits().get_size()); + other.priv_size_traits().set_size(backup); + } + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree before the upper bound. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + return iterator(node_algorithms::insert_equal_upper_bound + (node_ptr(&priv_header()), to_insert, key_node_comp), this); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator. + //! + //! Effects: Inserts x into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case) + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(const_iterator hint, reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + return iterator(node_algorithms::insert_equal + (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a each element of a range into the tree + //! before the upper bound of the key of each element. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_equal(Iterator b, Iterator e) + { + iterator end(this->end()); + for (; b != e; ++b) + this->insert_equal(end, *b); + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree if the value + //! is not already present. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert_unique(reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(value, commit_data); + if(!ret.second) + return ret; + return std::pair (insert_unique_commit(value, commit_data), true); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator + //! + //! Effects: Tries to insert x into the tree, using "hint" as a hint + //! to where it will be inserted. + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time (two comparisons in the worst case) + //! if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_unique(const_iterator hint, reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(hint, value, commit_data); + if(!ret.second) + return ret.first; + return insert_unique_commit(value, commit_data); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Tries to insert each element of a range into the tree. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_unique(Iterator b, Iterator e) + { + if(this->empty()){ + iterator end(this->end()); + for (; b != e; ++b) + this->insert_unique(end, *b); + } + else{ + for (; b != e; ++b) + this->insert_unique(*b); + } + } + + std::pair insert_unique_check + (const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + (node_algorithms::insert_unique_check + (node_ptr(&priv_header()), key, comp, commit_data)); + return std::pair(iterator(ret.first, this), ret.second); + } + + std::pair insert_unique_check + (const_iterator hint, const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(hint, value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + (node_algorithms::insert_unique_check + (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data)); + return std::pair(iterator(ret.first, this), ret.second); + } + + iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) + { + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + node_algorithms::insert_unique_commit + (node_ptr(&priv_header()), to_insert, commit_data); + return iterator(to_insert, this); + } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { + iterator ret(i); + ++ret; + node_ptr to_erase(i.pointed_node()); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase)); + node_algorithms::erase(&priv_header(), to_erase); + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + return ret; + } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { size_type n; return private_erase(b, e, n); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return this->erase(value, priv_comp()); } + + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { + node_ptr to_erase(i.pointed_node()); + iterator ret(this->erase(i)); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + return ret; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { size_type n; return private_erase(b, e, n, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { + std::pair p = this->equal_range(value); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { + if(safemode_or_autounlink){ + this->clear_and_dispose(detail::null_disposer()); + } + else{ + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + } + + //! Effects: Erases all of the elements calling disposer(p) for + //! each node to be erased. + //! Complexity: Average complexity for is at most O(log(size() + N)), + //! where N is the number of elements in the container. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. Calls N times to disposer functor. + template + void clear_and_dispose(Disposer disposer) + { + node_algorithms::clear_and_dispose(node_ptr(&priv_header()) + , detail::node_disposer(disposer, this)); + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + + //! Effects: Returns the number of contained elements with the given value + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given value. + //! + //! Throws: Nothing. + size_type count(const_reference value) const + { return this->count(value, priv_comp()); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: Nothing. + template + size_type count(const KeyType &key, KeyValueCompare comp) const + { + std::pair ret = this->equal_range(key, comp); + return std::distance(ret.first, ret.second); + } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator lower_bound(const_reference value) + { return this->lower_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator lower_bound(const_reference value) const + { return this->lower_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator lower_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator upper_bound(const_reference value) + { return this->upper_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator upper_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::upper_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator upper_bound(const_reference value) const + { return this->upper_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::upper_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator find(const_reference value) + { return this->find(value, priv_comp()); } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator find(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator find(const_reference value) const + { return this->find(value, priv_comp()); } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator find(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + std::pair equal_range(const_reference value) + { return this->equal_range(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + std::pair equal_range(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp)); + return std::pair(iterator(ret.first, this), iterator(ret.second, this)); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + std::pair + equal_range(const_reference value) const + { return this->equal_range(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + std::pair + equal_range(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp)); + return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer) + { + this->clear_and_dispose(disposer); + if(!src.empty()){ + detail::exception_disposer + rollback(*this, disposer); + node_algorithms::clone + (const_node_ptr(&src.priv_header()) + ,node_ptr(&this->priv_header()) + ,detail::node_cloner(cloner, this) + ,detail::node_disposer(disposer, this)); + this->priv_size_traits().set_size(src.priv_size_traits().get_size()); + this->priv_comp() = src.priv_comp(); + rollback.release(); + } + } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { + node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance + (node_ptr(&priv_header()))); + if(!to_be_disposed) + return 0; + this->priv_size_traits().decrement(); + if(safemode_or_autounlink)//If this is commented does not work with normal_link + node_algorithms::init(to_be_disposed); + return get_real_value_traits().to_value_ptr(to_be_disposed); + } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { + node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) + , node_ptr(&priv_header()) + , get_real_value_traits().to_node_ptr(with_this)); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return iterator (value_traits::to_node_ptr(value), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return const_iterator (value_traits::to_node_ptr(const_cast (value)), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return iterator (value_traits::to_node_ptr(value), this); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return const_iterator (value_traits::to_node_ptr(const_cast (value)), this); } + + //! Requires: value shall not be in a tree. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { node_algorithms::init(value_traits::to_node_ptr(value)); } + + //! Effects: removes "value" from the container. + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic time. + //! + //! Note: This static function is only usable with non-constant + //! time size containers that have stateless comparison functors. + //! + //! If the user calls + //! this function with a constant time size container or stateful comparison + //! functor a compilation error will be issued. + static void remove_node(reference value) + { + BOOST_STATIC_ASSERT((!constant_time_size)); + node_ptr to_remove(value_traits::to_node_ptr(value)); + node_algorithms::unlink(to_remove); + if(safemode_or_autounlink) + node_algorithms::init(to_remove); + } + + /// @cond + private: + template + iterator private_erase(iterator b, iterator e, size_type &n, Disposer disposer) + { + for(n = 0; b != e; ++n) + this->erase_and_dispose(b++, disposer); + return b; + } + + iterator private_erase(iterator b, iterator e, size_type &n) + { + for(n = 0; b != e; ++n) + this->erase(b++); + return b; + } + /// @endcond + + private: + static rbtree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) + { + header_plus_size *r = detail::parent_from_member + ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + node_plus_pred_t *n = detail::parent_from_member + (r, &node_plus_pred_t::header_plus_size_); + data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); + rbtree_impl *rb = detail::parent_from_member(d, &rbtree_impl::data_); + return *rb; + } + + static rbtree_impl &priv_container_from_iterator(const const_iterator &it) + { return priv_container_from_end_iterator(it.end_iterator_from_it()); } +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator< +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const rbtree_impl &x, const rbtree_impl &y) +#else +(const rbtree_impl &x, const rbtree_impl &y) +#endif +{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +bool operator== +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const rbtree_impl &x, const rbtree_impl &y) +#else +(const rbtree_impl &x, const rbtree_impl &y) +#endif +{ + typedef rbtree_impl tree_type; + typedef typename tree_type::const_iterator const_iterator; + + if(tree_type::constant_time_size && x.size() != y.size()){ + return false; + } + const_iterator end1 = x.end(); + const_iterator i1 = x.begin(); + const_iterator i2 = y.begin(); + if(tree_type::constant_time_size){ + while (i1 != end1 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1; + } + else{ + const_iterator end2 = y.end(); + while (i1 != end1 && i2 != end2 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1 && i2 == end2; + } +} + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const rbtree_impl &x, const rbtree_impl &y) +#else +(const rbtree_impl &x, const rbtree_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const rbtree_impl &x, const rbtree_impl &y) +#else +(const rbtree_impl &x, const rbtree_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const rbtree_impl &x, const rbtree_impl &y) +#else +(const rbtree_impl &x, const rbtree_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const rbtree_impl &x, const rbtree_impl &y) +#else +(const rbtree_impl &x, const rbtree_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(rbtree_impl &x, rbtree_impl &y) +#else +(rbtree_impl &x, rbtree_impl &y) +#endif +{ x.swap(y); } + +/// @cond +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_rbtree_opt +{ + typedef typename pack_options + < set_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + typedef typename detail::get_value_traits + ::type value_traits; + + typedef setopt + < value_traits + , typename packed_options::compare + , typename packed_options::size_type + , packed_options::constant_time_size + > type; +}; +/// @endcond + +//! Helper metafunction to define a \c rbtree that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_rbtree +{ + /// @cond + typedef rbtree_impl + < typename make_rbtree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class rbtree + : public make_rbtree::type +{ + typedef typename make_rbtree + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::real_value_traits real_value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + rbtree( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + rbtree( bool unique, Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(unique, b, e, cmp, v_traits) + {} + + static rbtree &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const rbtree &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static rbtree &container_from_it(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const rbtree &container_from_it(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_RBTREE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/rbtree_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/rbtree_algorithms.hpp new file mode 100644 index 0000000000..c40819350a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/rbtree_algorithms.hpp @@ -0,0 +1,850 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +// The internal implementation of red-black trees is based on that of SGI STL +// stl_tree.h file: +// +// Copyright (c) 1996,1997 +// Silicon Graphics Computer Systems, Inc. +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. Silicon Graphics makes no +// representations about the suitability of this software for any +// purpose. It is provided "as is" without express or implied warranty. +// +// +// Copyright (c) 1994 +// Hewlett-Packard Company +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appear in all copies and +// that both that copyright notice and this permission notice appear +// in supporting documentation. Hewlett-Packard Company makes no +// representations about the suitability of this software for any +// purpose. It is provided "as is" without express or implied warranty. +// +// The tree destruction algorithm is based on Julienne Walker and The EC Team code: +// +// This code is in the public domain. Anyone may use it or change it in any way that +// they see fit. The author assumes no responsibility for damages incurred through +// use of the original code or any variations thereof. +// +// It is requested, but not required, that due credit is given to the original author +// and anyone who has modified the code through a header comment, such as this one. + +#ifndef BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP + +#include + +#include +#include + +#include +#include +#include + + +namespace boost { +namespace intrusive { + +//! rbtree_algorithms provides basic algorithms to manipulate +//! nodes forming a red-black tree. The insertion and deletion algorithms are +//! based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms +//! (MIT Press, 1990), except that +//! +//! (1) the header node is maintained with links not only to the root +//! but also to the leftmost node of the tree, to enable constant time +//! begin(), and to the rightmost node of the tree, to enable linear time +//! performance when used with the generic set algorithms (set_union, +//! etc.); +//! +//! (2) when a node being deleted has two children its successor node is +//! relinked into its place, rather than copied, so that the only +//! pointers invalidated are those referring to the deleted node. +//! +//! rbtree_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the circular list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! color: The type that can store the color of a node +//! +//! Static functions: +//! +//! static node_ptr get_parent(const_node_ptr n); +//! +//! static void set_parent(node_ptr n, node_ptr parent); +//! +//! static node_ptr get_left(const_node_ptr n); +//! +//! static void set_left(node_ptr n, node_ptr left); +//! +//! static node_ptr get_right(const_node_ptr n); +//! +//! static void set_right(node_ptr n, node_ptr right); +//! +//! static color get_color(const_node_ptr n); +//! +//! static void set_color(node_ptr n, color c); +//! +//! static color black(); +//! +//! static color red(); +template +class rbtree_algorithms +{ + public: + typedef NodeTraits node_traits; + typedef typename NodeTraits::node node; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef typename NodeTraits::color color; + + /// @cond + private: + + typedef detail::tree_algorithms tree_algorithms; + + template + struct rbtree_node_cloner + : private detail::ebo_functor_holder + { + typedef detail::ebo_functor_holder base_t; + + rbtree_node_cloner(F f) + : base_t(f) + {} + + node_ptr operator()(node_ptr p) + { + node_ptr n = base_t::get()(p); + NodeTraits::set_color(n, NodeTraits::get_color(p)); + return n; + } + }; + + struct rbtree_erase_fixup + { + void operator()(node_ptr to_erase, node_ptr successor) + { + //Swap color of y and z + color tmp(NodeTraits::get_color(successor)); + NodeTraits::set_color(successor, NodeTraits::get_color(to_erase)); + NodeTraits::set_color(to_erase, tmp); + } + }; + + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + } + /// @endcond + + public: + static node_ptr begin_node(const_node_ptr header) + { return tree_algorithms::begin_node(header); } + + static node_ptr end_node(const_node_ptr header) + { return tree_algorithms::end_node(header); } + + //! This type is the information that will be + //! filled by insert_unique_check + typedef typename tree_algorithms::insert_commit_data insert_commit_data; + + //! Requires: header1 and header2 must be the header nodes + //! of two trees. + //! + //! Effects: Swaps two trees. After the function header1 will contain + //! links to the second tree and header2 will have links to the first tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static void swap_tree(node_ptr header1, node_ptr header2) + { return tree_algorithms::swap_tree(header1, header2); } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr node2) + { + if(node1 == node2) + return; + + node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2)); + swap_nodes(node1, header1, node2, header2); + } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees with header header1 and header2. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) + { + if(node1 == node2) return; + + tree_algorithms::swap_nodes(node1, header1, node2, header2); + //Swap color + color c = NodeTraits::get_color(node1); + NodeTraits::set_color(node1, NodeTraits::get_color(node2)); + NodeTraits::set_color(node2, c); + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing and comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) + { + if(node_to_be_replaced == new_node) + return; + replace_node(node_to_be_replaced, tree_algorithms::get_header(node_to_be_replaced), new_node); + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! with header "header" and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) + { + tree_algorithms::replace_node(node_to_be_replaced, header, new_node); + NodeTraits::set_color(new_node, NodeTraits::get_color(node_to_be_replaced)); + } + + //! Requires: node is a tree node but not the header. + //! + //! Effects: Unlinks the node and rebalances the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + static void unlink(node_ptr node) + { + node_ptr x = NodeTraits::get_parent(node); + if(x){ + while(!is_header(x)) + x = NodeTraits::get_parent(x); + erase(x, node); + } + } + + //! Requires: header is the header of a tree. + //! + //! Effects: Unlinks the leftmost node from the tree, and + //! updates the header link to the new leftmost node. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + static node_ptr unlink_leftmost_without_rebalance(node_ptr header) + { return tree_algorithms::unlink_leftmost_without_rebalance(header); } + + //! Requires: node is a node of the tree or an node initialized + //! by init(...). + //! + //! Effects: Returns true if the node is initialized by init(). + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + static bool unique(const_node_ptr node) + { return tree_algorithms::unique(node); } + + //! Requires: node is a node of the tree but it's not the header. + //! + //! Effects: Returns the number of nodes of the subtree. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr node) + { return tree_algorithms::count(node); } + + //! Requires: header is the header node of the tree. + //! + //! Effects: Returns the number of nodes above the header. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t size(const_node_ptr header) + { return tree_algorithms::size(header); } + + //! Requires: p is a node from the tree except the header. + //! + //! Effects: Returns the next node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr next_node(node_ptr p) + { return tree_algorithms::next_node(p); } + + //! Requires: p is a node from the tree except the leftmost node. + //! + //! Effects: Returns the previous node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr prev_node(node_ptr p) + { return tree_algorithms::prev_node(p); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: After the function unique(node) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init(node_ptr node) + { tree_algorithms::init(node); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: Initializes the header to represent an empty tree. + //! unique(header) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init_header(node_ptr header) + { + tree_algorithms::init_header(header); + NodeTraits::set_color(header, NodeTraits::red()); + } + + //! Requires: header must be the header of a tree, z a node + //! of that tree and z != header. + //! + //! Effects: Erases node "z" from the tree with header "header". + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static node_ptr erase(node_ptr header, node_ptr z) + { + typename tree_algorithms::data_for_rebalance info; + tree_algorithms::erase(header, z, rbtree_erase_fixup(), info); + node_ptr x = info.x; + node_ptr x_parent = info.x_parent; + + //Rebalance rbtree + if(NodeTraits::get_color(z) != NodeTraits::red()){ + rebalance_after_erasure(header, x, x_parent); + } + return z; + } + + //! Requires: "cloner" must be a function + //! object taking a node_ptr and returning a new cloned node of it. "disposer" must + //! take a node_ptr and shouldn't throw. + //! + //! Effects: First empties target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Then, duplicates the entire tree pointed by "source_header" cloning each + //! source node with node_ptr Cloner::operator()(node_ptr) to obtain + //! the nodes of the target tree. If "cloner" throws, the cloned target nodes + //! are disposed using void disposer(node_ptr). + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clone + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer) + { + rbtree_node_cloner new_cloner(cloner); + tree_algorithms::clone(source_header, target_header, new_cloner, disposer); + } + + //! Requires: "disposer" must be an object function + //! taking a node_ptr parameter and shouldn't throw. + //! + //! Effects: Empties the target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clear_and_dispose(node_ptr header, Disposer disposer) + { tree_algorithms::clear_and_dispose(header, disposer); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is + //! not less than "key" according to "comp" or "header" if that element does + //! not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr lower_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::lower_bound(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is greater + //! than "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr upper_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::upper_bound(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the element that is equivalent to + //! "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr find + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::find(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an a pair of node_ptr delimiting a range containing + //! all elements that are equivalent to "key" according to "comp" or an + //! empty range that indicates the position where those elements would be + //! if they there are no equivalent elements. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static std::pair equal_range + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::equal_range(header, key, comp); } + + //! Requires: "h" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. + //! + //! Effects: Inserts new_node into the tree before the upper bound + //! according to "comp". + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal_upper_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp) + { + tree_algorithms::insert_equal_upper_bound(h, new_node, comp); + rebalance_after_insertion(h, new_node); + return new_node; + } + + //! Requires: "h" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. + //! + //! Effects: Inserts new_node into the tree before the lower bound + //! according to "comp". + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal_lower_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp) + { + tree_algorithms::insert_equal_lower_bound(h, new_node, comp); + rebalance_after_insertion(h, new_node); + return new_node; + } + + //! Requires: "header" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from + //! the "header"'s tree. + //! + //! Effects: Inserts new_node into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case). + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if new_node is inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp) + { + tree_algorithms::insert_equal(header, hint, new_node, comp); + rebalance_after_insertion(header, new_node); + return new_node; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (const_node_ptr header, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { return tree_algorithms::insert_unique_check(header, key, comp, commit_data); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! "hint" is node from the "header"'s tree. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" using "hint" as a hint to where it should be + //! inserted and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! If "hint" is the upper_bound the function has constant time + //! complexity (two comparisons in the worst case). + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic, but it is + //! amortized constant time if new_node should be inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (const_node_ptr header, node_ptr hint, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data); } + + //! Requires: "header" must be the header node of a tree. + //! "commit_data" must have been obtained from a previous call to + //! "insert_unique_check". No objects should have been inserted or erased + //! from the set between the "insert_unique_check" that filled "commit_data" + //! and the call to "insert_commit". + //! + //! + //! Effects: Inserts new_node in the set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_unique_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + static void insert_unique_commit + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data) + { + tree_algorithms::insert_unique_commit(header, new_value, commit_data); + rebalance_after_insertion(header, new_value); + } + + //! Requires: "n" must be a node inserted in a tree. + //! + //! Effects: Returns a pointer to the header node of the tree. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + static node_ptr get_header(node_ptr n) + { return tree_algorithms::get_header(n); } + + /// @cond + private: + + //! Requires: p is a node of a tree. + //! + //! Effects: Returns true if p is the header of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static bool is_header(const_node_ptr p) + { + return NodeTraits::get_color(p) == NodeTraits::red() && + tree_algorithms::is_header(p); + //return NodeTraits::get_color(p) == NodeTraits::red() && + // NodeTraits::get_parent(NodeTraits::get_parent(p)) == p; + } + + static void rebalance_after_erasure(node_ptr header, node_ptr x, node_ptr x_parent) + { + while(x != NodeTraits::get_parent(header) && (x == 0 || NodeTraits::get_color(x) == NodeTraits::black())){ + if(x == NodeTraits::get_left(x_parent)){ + node_ptr w = NodeTraits::get_right(x_parent); + if(NodeTraits::get_color(w) == NodeTraits::red()){ + NodeTraits::set_color(w, NodeTraits::black()); + NodeTraits::set_color(x_parent, NodeTraits::red()); + tree_algorithms::rotate_left(x_parent, header); + w = NodeTraits::get_right(x_parent); + } + if((NodeTraits::get_left(w) == 0 || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()) && + (NodeTraits::get_right(w) == 0 || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black())){ + NodeTraits::set_color(w, NodeTraits::red()); + x = x_parent; + x_parent = NodeTraits::get_parent(x_parent); + } + else { + if(NodeTraits::get_right(w) == 0 || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){ + NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black()); + NodeTraits::set_color(w, NodeTraits::red()); + tree_algorithms::rotate_right(w, header); + w = NodeTraits::get_right(x_parent); + } + NodeTraits::set_color(w, NodeTraits::get_color(x_parent)); + NodeTraits::set_color(x_parent, NodeTraits::black()); + if(NodeTraits::get_right(w)) + NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black()); + tree_algorithms::rotate_left(x_parent, header); + break; + } + } + else { + // same as above, with right_ <-> left_. + node_ptr w = NodeTraits::get_left(x_parent); + if(NodeTraits::get_color(w) == NodeTraits::red()){ + NodeTraits::set_color(w, NodeTraits::black()); + NodeTraits::set_color(x_parent, NodeTraits::red()); + tree_algorithms::rotate_right(x_parent, header); + w = NodeTraits::get_left(x_parent); + } + if((NodeTraits::get_right(w) == 0 || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()) && + (NodeTraits::get_left(w) == 0 || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black())){ + NodeTraits::set_color(w, NodeTraits::red()); + x = x_parent; + x_parent = NodeTraits::get_parent(x_parent); + } + else { + if(NodeTraits::get_left(w) == 0 || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()){ + NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black()); + NodeTraits::set_color(w, NodeTraits::red()); + tree_algorithms::rotate_left(w, header); + w = NodeTraits::get_left(x_parent); + } + NodeTraits::set_color(w, NodeTraits::get_color(x_parent)); + NodeTraits::set_color(x_parent, NodeTraits::black()); + if(NodeTraits::get_left(w)) + NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black()); + tree_algorithms::rotate_right(x_parent, header); + break; + } + } + } + if(x) + NodeTraits::set_color(x, NodeTraits::black()); + } + + + static void rebalance_after_insertion(node_ptr header, node_ptr p) + { + NodeTraits::set_color(p, NodeTraits::red()); + while(p != NodeTraits::get_parent(header) && NodeTraits::get_color(NodeTraits::get_parent(p)) == NodeTraits::red()){ + node_ptr p_parent(NodeTraits::get_parent(p)); + node_ptr p_parent_parent(NodeTraits::get_parent(p_parent)); + if(tree_algorithms::is_left_child(p_parent)){ + node_ptr x = NodeTraits::get_right(p_parent_parent); + if(x && NodeTraits::get_color(x) == NodeTraits::red()){ + NodeTraits::set_color(p_parent, NodeTraits::black()); + NodeTraits::set_color(p_parent_parent, NodeTraits::red()); + NodeTraits::set_color(x, NodeTraits::black()); + p = p_parent_parent; + } + else { + if(!tree_algorithms::is_left_child(p)){ + p = p_parent; + tree_algorithms::rotate_left(p, header); + } + node_ptr new_p_parent(NodeTraits::get_parent(p)); + node_ptr new_p_parent_parent(NodeTraits::get_parent(new_p_parent)); + NodeTraits::set_color(new_p_parent, NodeTraits::black()); + NodeTraits::set_color(new_p_parent_parent, NodeTraits::red()); + tree_algorithms::rotate_right(new_p_parent_parent, header); + } + } + else{ + node_ptr x = NodeTraits::get_left(p_parent_parent); + if(x && NodeTraits::get_color(x) == NodeTraits::red()){ + NodeTraits::set_color(p_parent, NodeTraits::black()); + NodeTraits::set_color(p_parent_parent, NodeTraits::red()); + NodeTraits::set_color(x, NodeTraits::black()); + p = p_parent_parent; + } + else{ + if(tree_algorithms::is_left_child(p)){ + p = p_parent; + tree_algorithms::rotate_right(p, header); + } + node_ptr new_p_parent(NodeTraits::get_parent(p)); + node_ptr new_p_parent_parent(NodeTraits::get_parent(new_p_parent)); + NodeTraits::set_color(new_p_parent, NodeTraits::black()); + NodeTraits::set_color(new_p_parent_parent, NodeTraits::red()); + tree_algorithms::rotate_left(new_p_parent_parent, header); + } + } + } + NodeTraits::set_color(NodeTraits::get_parent(header), NodeTraits::black()); + } + /// @endcond +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_RBTREE_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/set.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/set.hpp new file mode 100644 index 0000000000..d2dff1ec67 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/set.hpp @@ -0,0 +1,2199 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_SET_HPP +#define BOOST_INTRUSIVE_SET_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! The class template set is an intrusive container, that mimics most of +//! the interface of std::set as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class set_impl +{ + /// @cond + typedef rbtree_impl tree_type; + //! This class is + //! non-copyable + set_impl (const set_impl&); + + //! This class is + //! non-assignable + set_impl &operator =(const set_impl&); + + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor of the value_compare object throws. + set_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty set and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is std::distance(last, first). + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + set_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(true, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~set_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of set. + //! + //! Effects: Returns a reference to the set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static set_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &set_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of set. + //! + //! Effects: Returns a const reference to the set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const set_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &set_impl::tree_); + } + + //! Precondition: it must be a valid iterator of set. + //! + //! Effects: Returns a reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static set_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &set_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of set. + //! + //! Effects: Returns a const reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const set_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &set_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the set. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the set. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two sets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(set_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const set_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to inserts value into the set. + //! + //! Returns: If the value + //! is not already present inserts it and returns a pair containing the + //! iterator to the new value and true. If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert(reference value) + { return tree_.insert_unique(value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to to insert x into the set, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: An iterator that points to the position where the + //! new element was inserted into the set. + //! + //! Complexity: Logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_unique(hint, value); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an arbitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the set, using + //! a user provided key instead of the value itself. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that + //! part to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the set. + template + std::pair insert_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(key, key_value_comp, commit_data); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an arbitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the set, using + //! a user provided key instead of the value itself, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! constructing that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that key + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This can give a total + //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the set. + template + std::pair insert_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(hint, key, key_value_comp, commit_data); } + + //! Requires: value must be an lvalue of type value_type. commit_data + //! must have been obtained from a previous call to "insert_check". + //! No objects should have been inserted or erased from the set between + //! the "insert_check" that filled "commit_data" and the call to "insert_commit". + //! + //! Effects: Inserts the value in the set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Returns: An iterator to the newly inserted object. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + iterator insert_commit(reference value, const insert_commit_data &commit_data) + { return tree_.insert_unique_commit(value, commit_data); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the set. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_unique(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size()) + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If the comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: If the internal value_compare ordering function throws. + //! + //! Complexity: O(log(size() + this->count(value)). Basic guarantee. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) const + { return tree_.find(value) != end(); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp) != end(); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound(const_reference value) const + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound(const_reference value) const + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find(const_reference value) const + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range(const_reference value) const + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range(key, comp); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a set/multiset. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + /// @cond + friend bool operator==(const set_impl &x, const set_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const set_impl &x, const set_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const set_impl &x, const set_impl &y) +#else +(const set_impl &x, const set_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const set_impl &x, const set_impl &y) +#else +(const set_impl &x, const set_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const set_impl &x, const set_impl &y) +#else +(const set_impl &x, const set_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const set_impl &x, const set_impl &y) +#else +(const set_impl &x, const set_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(set_impl &x, set_impl &y) +#else +(set_impl &x, set_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c set that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_set +{ + /// @cond + typedef set_impl + < typename make_rbtree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class set + : public make_set::type +{ + typedef typename make_set + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + set( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + set( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static set &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const set &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static set &container_from_iterator(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const set &container_from_iterator(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + +//! The class template multiset is an intrusive container, that mimics most of +//! the interface of std::multiset as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class multiset_impl +{ + /// @cond + typedef rbtree_impl tree_type; + + //Non-copyable and non-assignable + multiset_impl (const multiset_impl&); + multiset_impl &operator =(const multiset_impl&); + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + multiset_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty multiset and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is the distance between first and last + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + multiset_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(false, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~multiset_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static multiset_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &multiset_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const multiset_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &multiset_impl::tree_); + } + + //! Precondition: it must be a valid iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static multiset_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &multiset_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const multiset_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &multiset_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the multiset. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(multiset_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const multiset_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(reference value) + { return tree_.insert_equal(value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts x into the multiset, using pos as a hint to + //! where it will be inserted. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_equal(hint, value); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_equal(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) const + { return tree_.count(value); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) const + { return tree_.count(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound(const_reference value) const + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound(const_reference value) const + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find(const_reference value) const + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range(const_reference value) const + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range(key, comp); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a set/multiset. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + //! Effects: removes "value" from the container. + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic time. + //! + //! Note: This static function is only usable with non-constant + //! time size containers that have stateless comparison functors. + //! + //! If the user calls + //! this function with a constant time size container or stateful comparison + //! functor a compilation error will be issued. + static void remove_node(reference value) + { tree_type::remove_node(value); } + + /// @cond + friend bool operator==(const multiset_impl &x, const multiset_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const multiset_impl &x, const multiset_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const multiset_impl &x, const multiset_impl &y) +#else +(const multiset_impl &x, const multiset_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const multiset_impl &x, const multiset_impl &y) +#else +(const multiset_impl &x, const multiset_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const multiset_impl &x, const multiset_impl &y) +#else +(const multiset_impl &x, const multiset_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const multiset_impl &x, const multiset_impl &y) +#else +(const multiset_impl &x, const multiset_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(multiset_impl &x, multiset_impl &y) +#else +(multiset_impl &x, multiset_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c multiset that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_multiset +{ + /// @cond + typedef multiset_impl + < typename make_rbtree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class multiset + : public make_multiset::type +{ + typedef typename make_multiset::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + multiset( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + multiset( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static multiset &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const multiset &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static multiset &container_from_iterator(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const multiset &container_from_iterator(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SET_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/set_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/set_hook.hpp new file mode 100644 index 0000000000..473dfe3562 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/set_hook.hpp @@ -0,0 +1,298 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_SET_HOOK_HPP +#define BOOST_INTRUSIVE_SET_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +template +struct get_set_node_algo +{ + typedef rbtree_algorithms > type; +}; +/// @endcond + +//! Helper metafunction to define a \c set_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_set_base_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_set_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::SetBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from set_base_hook in order to store objects in +//! in a set/multiset. set_base_hook holds the data necessary to maintain +//! the set/multiset and provides an appropriate value_traits class for set/multiset. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<>, +//! \c link_mode<> and \c optimize_size<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! unique tag. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c optimize_size<> will tell the hook to optimize the hook for size instead +//! of speed. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class set_base_hook + : public make_set_base_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + set_base_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + set_base_hook(const set_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + set_base_hook& operator=(const set_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~set_base_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(set_base_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +//! Helper metafunction to define a \c set_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_set_member_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_set_node_algo + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Put a public data member set_member_hook in order to store objects of this class in +//! a set/multiset. set_member_hook holds the data necessary for maintaining the +//! set/multiset and provides an appropriate value_traits class for set/multiset. +//! +//! The hook admits the following options: \c void_pointer<>, +//! \c link_mode<> and \c optimize_size<>. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c optimize_size<> will tell the hook to optimize the hook for size instead +//! of speed. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class set_member_hook + : public make_set_member_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + set_member_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + set_member_hook(const set_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + set_member_hook& operator=(const set_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~set_member_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(set_member_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SET_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sg_set.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sg_set.hpp new file mode 100644 index 0000000000..b3570fb41b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sg_set.hpp @@ -0,0 +1,2263 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_SG_SET_HPP +#define BOOST_INTRUSIVE_SG_SET_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! The class template sg_set is an intrusive container, that mimics most of +//! the interface of std::set as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class sg_set_impl +{ + /// @cond + typedef sgtree_impl tree_type; + //! This class is + //! non-copyable + sg_set_impl (const sg_set_impl&); + + //! This class is + //! non-assignable + sg_set_impl &operator =(const sg_set_impl&); + + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor of the value_compare object throws. + sg_set_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty sg_set and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is std::distance(last, first). + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + sg_set_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(true, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the sg_set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~sg_set_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of sg_set. + //! + //! Effects: Returns a const reference to the sg_set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static sg_set_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &sg_set_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of sg_set. + //! + //! Effects: Returns a const reference to the sg_set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const sg_set_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &sg_set_impl::tree_); + } + + //! Precondition: it must be a valid iterator of set. + //! + //! Effects: Returns a reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static sg_set_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &sg_set_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of set. + //! + //! Effects: Returns a const reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const sg_set_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &sg_set_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the sg_set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the sg_set. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two sets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(sg_set_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const sg_set_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to inserts value into the sg_set. + //! + //! Returns: If the value + //! is not already present inserts it and returns a pair containing the + //! iterator to the new value and true. If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert(reference value) + { return tree_.insert_unique(value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to to insert x into the sg_set, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: An iterator that points to the position where the + //! new element was inserted into the sg_set. + //! + //! Complexity: Logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_unique(hint, value); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an ascapegoatitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the sg_set, using + //! a user provided key instead of the value itself. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that + //! part to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the sg_set. + template + std::pair insert_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(key, key_value_comp, commit_data); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an ascapegoatitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the sg_set, using + //! a user provided key instead of the value itself, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! constructing that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that key + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This can give a total + //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the sg_set. + template + std::pair insert_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(hint, key, key_value_comp, commit_data); } + + //! Requires: value must be an lvalue of type value_type. commit_data + //! must have been obtained from a previous call to "insert_check". + //! No objects should have been inserted or erased from the sg_set between + //! the "insert_check" that filled "commit_data" and the call to "insert_commit". + //! + //! Effects: Inserts the value in the sg_set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Returns: An iterator to the newly inserted object. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + iterator insert_commit(reference value, const insert_commit_data &commit_data) + { return tree_.insert_unique_commit(value, commit_data); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the sg_set. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_unique(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size()) + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If the comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: If the internal value_compare ordering function throws. + //! + //! Complexity: O(log(size() + this->count(value)). Basic guarantee. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) const + { return tree_.find(value) != end(); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp) != end(); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound(const_reference value) const + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound(const_reference value) const + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find(const_reference value) const + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range(const_reference value) const + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range(key, comp); } + + //! Requires: value must be an lvalue and shall be in a sg_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the sg_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a sg_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! sg_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a sg_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the sg_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a sg_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! sg_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a sg_set/sg_multiset. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + void rebalance() + { tree_.rebalance(); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + iterator rebalance_subtree(iterator root) + { return tree_.rebalance_subtree(root); } + + //! Returns: The balance factor (alpha) used in this tree + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + float balance_factor() const + { return tree_.balance_factor(); } + + //! Requires: new_alpha must be a value between 0.5 and 1.0 + //! + //! Effects: Establishes a new balance factor (alpha) and rebalances + //! the tree if the new balance factor is stricter (less) than the old factor. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + void balance_factor(float new_alpha) + { tree_.balance_factor(new_alpha); } + + /// @cond + friend bool operator==(const sg_set_impl &x, const sg_set_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const sg_set_impl &x, const sg_set_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_set_impl &x, const sg_set_impl &y) +#else +(const sg_set_impl &x, const sg_set_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_set_impl &x, const sg_set_impl &y) +#else +(const sg_set_impl &x, const sg_set_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_set_impl &x, const sg_set_impl &y) +#else +(const sg_set_impl &x, const sg_set_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_set_impl &x, const sg_set_impl &y) +#else +(const sg_set_impl &x, const sg_set_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(sg_set_impl &x, sg_set_impl &y) +#else +(sg_set_impl &x, sg_set_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c sg_set that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_sg_set +{ + /// @cond + typedef sg_set_impl + < typename make_sgtree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class sg_set + : public make_sg_set::type +{ + typedef typename make_sg_set + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + sg_set( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + sg_set( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static sg_set &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const sg_set &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static sg_set &container_from_iterator(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const sg_set &container_from_iterator(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + +//! The class template sg_multiset is an intrusive container, that mimics most of +//! the interface of std::sg_multiset as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class sg_multiset_impl +{ + /// @cond + typedef sgtree_impl tree_type; + + //Non-copyable and non-assignable + sg_multiset_impl (const sg_multiset_impl&); + sg_multiset_impl &operator =(const sg_multiset_impl&); + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + sg_multiset_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty sg_multiset and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is the distance between first and last + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + sg_multiset_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(false, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the sg_multiset + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~sg_multiset_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of sg_multiset. + //! + //! Effects: Returns a const reference to the sg_multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static sg_multiset_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &sg_multiset_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of sg_multiset. + //! + //! Effects: Returns a const reference to the sg_multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const sg_multiset_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &sg_multiset_impl::tree_); + } + + //! Precondition: it must be a valid iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static sg_multiset_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &sg_multiset_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const sg_multiset_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &sg_multiset_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the sg_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the sg_multiset. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two sg_multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(sg_multiset_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the sg_multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(reference value) + { return tree_.insert_equal(value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts x into the sg_multiset, using pos as a hint to + //! where it will be inserted. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_equal(hint, value); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the sg_multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_equal(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) const + { return tree_.count(value); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) const + { return tree_.count(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound(const_reference value) const + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound(const_reference value) const + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find(const_reference value) const + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyValueCompare comp) const + { return tree_.find(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range(const_reference value) const + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range(key, comp); } + + //! Requires: value must be an lvalue and shall be in a sg_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the sg_multiset + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a sg_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! sg_multiset that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a sg_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the sg_multiset + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a sg_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! sg_multiset that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a sg_multiset/sg_multiset. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + void rebalance() + { tree_.rebalance(); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + iterator rebalance_subtree(iterator root) + { return tree_.rebalance_subtree(root); } + + //! Returns: The balance factor (alpha) used in this tree + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + float balance_factor() const + { return tree_.balance_factor(); } + + //! Requires: new_alpha must be a value between 0.5 and 1.0 + //! + //! Effects: Establishes a new balance factor (alpha) and rebalances + //! the tree if the new balance factor is stricter (less) than the old factor. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + void balance_factor(float new_alpha) + { tree_.balance_factor(new_alpha); } + + /// @cond + friend bool operator==(const sg_multiset_impl &x, const sg_multiset_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const sg_multiset_impl &x, const sg_multiset_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#else +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#else +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#else +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#else +(const sg_multiset_impl &x, const sg_multiset_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(sg_multiset_impl &x, sg_multiset_impl &y) +#else +(sg_multiset_impl &x, sg_multiset_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c sg_multiset that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_sg_multiset +{ + /// @cond + typedef sg_multiset_impl + < typename make_sgtree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class sg_multiset + : public make_sg_multiset::type +{ + typedef typename make_sg_multiset + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + sg_multiset( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + sg_multiset( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static sg_multiset &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const sg_multiset &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static sg_multiset &container_from_iterator(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const sg_multiset &container_from_iterator(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SG_SET_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sgtree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sgtree.hpp new file mode 100644 index 0000000000..63022a4095 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sgtree.hpp @@ -0,0 +1,1701 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +// +// The option that yields to non-floating point 1/sqrt(2) alpha is taken +// from the scapegoat tree implementation of the PSPP library. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_SGTREE_HPP +#define BOOST_INTRUSIVE_SGTREE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond + +namespace detail{ + +//! Returns floor(log(n)/log(sqrt(2))) -> floor(2*log2(n)) +//! Undefined if N is 0. +//! +//! This function does not use float point operations. +inline std::size_t calculate_h_sqrt2 (std::size_t n) +{ + std::size_t f_log2 = detail::floor_log2(n); + return (2*f_log2) + (n >= detail::sqrt2_pow_2xplus1 (f_log2)); +} + +struct h_alpha_sqrt2_t +{ + h_alpha_sqrt2_t(void){} + std::size_t operator()(std::size_t n) const + { return calculate_h_sqrt2(n); } +}; + +struct alpha_0_75_by_max_size_t +{ + alpha_0_75_by_max_size_t(void){} + std::size_t operator()(std::size_t max_tree_size) const + { + const std::size_t max_tree_size_limit = ((~std::size_t(0))/std::size_t(3)); + return max_tree_size > max_tree_size_limit ? max_tree_size/4*3 : max_tree_size*3/4; + } +}; + +struct h_alpha_t +{ + h_alpha_t(float inv_minus_logalpha) + : inv_minus_logalpha_(inv_minus_logalpha) + {} + + std::size_t operator()(std::size_t n) const + { + //Returns floor(log1/alpha(n)) -> + // floor(log(n)/log(1/alpha)) -> + // floor(log(n)/(-log(alpha))) + //return static_cast(std::log(float(n))*inv_minus_logalpha_); + return static_cast(detail::fast_log2(float(n))*inv_minus_logalpha_); + } + + private: + //Since the function will be repeatedly called + //precalculate constant data to avoid repeated + //calls to log and division. + //This will store 1/(-std::log(alpha_)) + float inv_minus_logalpha_; +}; + +struct alpha_by_max_size_t +{ + alpha_by_max_size_t(float alpha) + : alpha_(alpha) + {} + + float operator()(std::size_t max_tree_size) const + { return float(max_tree_size)*alpha_; } + + private: + float alpha_; + float inv_minus_logalpha_; +}; + +template +struct alpha_holder +{ + typedef boost::intrusive::detail::h_alpha_t h_alpha_t; + typedef boost::intrusive::detail::alpha_by_max_size_t multiply_by_alpha_t; + + alpha_holder() + { set_alpha(0.7f); } + + float get_alpha() const + { return alpha_; } + + void set_alpha(float alpha) + { + alpha_ = alpha; + inv_minus_logalpha_ = 1/(-detail::fast_log2(alpha)); + } + + h_alpha_t get_h_alpha_t() const + { return h_alpha_t(inv_minus_logalpha_); } + + multiply_by_alpha_t get_multiply_by_alpha_t() const + { return multiply_by_alpha_t(alpha_); } + + private: + float alpha_; + float inv_minus_logalpha_; +}; + +template<> +struct alpha_holder +{ + //This specialization uses alpha = 1/sqrt(2) + //without using floating point operations + //Downside: alpha CAN't be changed. + typedef boost::intrusive::detail::h_alpha_sqrt2_t h_alpha_t; + typedef boost::intrusive::detail::alpha_0_75_by_max_size_t multiply_by_alpha_t; + + float get_alpha() const + { return 0.70710677f; } + + void set_alpha(float) + { //alpha CAN't be changed. + BOOST_INTRUSIVE_INVARIANT_ASSERT(0); + } + + h_alpha_t get_h_alpha_t() const + { return h_alpha_t(); } + + multiply_by_alpha_t get_multiply_by_alpha_t() const + { return multiply_by_alpha_t(); } +}; + +} //namespace detail{ + +template +struct sg_setopt +{ + typedef ValueTraits value_traits; + typedef Compare compare; + typedef SizeType size_type; + static const bool floating_point = FloatingPoint; +}; + +template +struct sg_set_defaults + : pack_options + < none + , base_hook + , floating_point + , size_type + , compare > + >::type +{}; + +/// @endcond + +//! The class template sgtree is an intrusive scapegoat tree container, that +//! is used to construct intrusive sg_set and sg_multiset containers. +//! The no-throw guarantee holds only, if the value_compare object +//! doesn't throw. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c floating_point<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class sgtree_impl +{ + public: + typedef typename Config::value_traits value_traits; + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + /// @endcond + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::const_pointer const_pointer; + typedef typename std::iterator_traits::value_type value_type; + typedef value_type key_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename Config::size_type size_type; + typedef typename Config::compare value_compare; + typedef value_compare key_compare; + typedef tree_iterator iterator; + typedef tree_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef sgtree_algorithms node_algorithms; + + static const bool floating_point = Config::floating_point; + static const bool constant_time_size = true; + static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; + + /// @cond + private: + typedef detail::size_holder size_traits; + typedef detail::alpha_holder alpha_traits; + typedef typename alpha_traits::h_alpha_t h_alpha_t; + typedef typename alpha_traits::multiply_by_alpha_t multiply_by_alpha_t; + + //noncopyable + sgtree_impl (const sgtree_impl&); + sgtree_impl operator =(const sgtree_impl&); + + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + BOOST_STATIC_ASSERT(((int)real_value_traits::link_mode != (int)auto_unlink)); + + //BOOST_STATIC_ASSERT(( + // (int)real_value_traits::link_mode != (int)auto_unlink || + // !floating_point + // )); + + struct header_plus_alpha : public alpha_traits + { node header_; }; + + struct node_plus_pred_t : public detail::ebo_functor_holder + { + node_plus_pred_t(const value_compare &comp) + : detail::ebo_functor_holder(comp) + {} + header_plus_alpha header_plus_alpha_; + size_traits size_traits_; + }; + + struct data_t : public sgtree_impl::value_traits + { + typedef typename sgtree_impl::value_traits value_traits; + data_t(const value_compare & comp, const value_traits &val_traits) + : value_traits(val_traits), node_plus_pred_(comp) + , max_tree_size_(0) + {} + node_plus_pred_t node_plus_pred_; + size_type max_tree_size_; + } data_; + + float priv_alpha() const + { return this->priv_alpha_traits().get_alpha(); } + + void priv_alpha(float alpha) + { return this->priv_alpha_traits().set_alpha(alpha); } + + const value_compare &priv_comp() const + { return data_.node_plus_pred_.get(); } + + value_compare &priv_comp() + { return data_.node_plus_pred_.get(); } + + const node &priv_header() const + { return data_.node_plus_pred_.header_plus_alpha_.header_; } + + node &priv_header() + { return data_.node_plus_pred_.header_plus_alpha_.header_; } + + static node_ptr uncast(const_node_ptr ptr) + { return node_ptr(const_cast(detail::get_pointer(ptr))); } + + size_traits &priv_size_traits() + { return data_.node_plus_pred_.size_traits_; } + + const size_traits &priv_size_traits() const + { return data_.node_plus_pred_.size_traits_; } + + alpha_traits &priv_alpha_traits() + { return data_.node_plus_pred_.header_plus_alpha_; } + + const alpha_traits &priv_alpha_traits() const + { return data_.node_plus_pred_.header_plus_alpha_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_.get_value_traits(*this); } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_; } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_.get_value_traits(*this); } + + h_alpha_t get_h_alpha_func() const + { return priv_alpha_traits().get_h_alpha_t(); } + + multiply_by_alpha_t get_alpha_by_max_size_func() const + { return priv_alpha_traits().get_multiply_by_alpha_t(); } + + /// @endcond + + public: + + const real_value_traits &get_real_value_traits() const + { return this->get_real_value_traits(detail::bool_()); } + + real_value_traits &get_real_value_traits() + { return this->get_real_value_traits(detail::bool_()); } + + typedef typename node_algorithms::insert_commit_data insert_commit_data; + + //! Effects: Constructs an empty tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + sgtree_impl( value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + } + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty tree and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise N * log N, where N is the distance between first and last. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + template + sgtree_impl( bool unique, Iterator b, Iterator e + , value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + if(unique) + this->insert_unique(b, e); + else + this->insert_equal(b, e); + } + + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called), but the nodes according to + //! the value_traits template parameter are reinitialized and thus can be reused. + //! + //! Complexity: Linear to elements contained in *this. + //! + //! Throws: Nothing. + ~sgtree_impl() + { this->clear(); } + + //! Effects: Returns an iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return iterator (node_traits::get_left(node_ptr(&priv_header())), this); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return cbegin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return const_iterator (node_traits::get_left(const_node_ptr(&priv_header())), this); } + + //! Effects: Returns an iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return iterator (node_ptr(&priv_header()), this); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return cend(); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return const_iterator (uncast(const_node_ptr(&priv_header())), this); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return const_reverse_iterator(begin()); } + + //! Precondition: end_iterator must be a valid end iterator + //! of sgtree. + //! + //! Effects: Returns a const reference to the sgtree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static sgtree_impl &container_from_end_iterator(iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of sgtree. + //! + //! Effects: Returns a const reference to the sgtree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const sgtree_impl &container_from_end_iterator(const_iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: it must be a valid iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static sgtree_impl &container_from_iterator(iterator it) + { return priv_container_from_iterator(it); } + + //! Precondition: it must be a valid end const_iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const sgtree_impl &container_from_iterator(const_iterator it) + { return priv_container_from_iterator(it); } + + //! Effects: Returns the value_compare object used by the tree. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return priv_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return node_algorithms::unique(const_node_ptr(&priv_header())); } + + //! Effects: Returns the number of elements stored in the tree. + //! + //! Complexity: Linear to elements contained in *this. + //! + //! Throws: Nothing. + size_type size() const + { + if(constant_time_size) + return this->priv_size_traits().get_size(); + else{ + return (size_type)node_algorithms::size(const_node_ptr(&priv_header())); + } + } + + //! Effects: Swaps the contents of two multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the comparison functor's swap call throws. + void swap(sgtree_impl& other) + { + //This can throw + using std::swap; + swap(priv_comp(), priv_comp()); + swap(priv_alpha_traits(), priv_alpha_traits()); + swap(data_.max_tree_size_, other.data_.max_tree_size_); + //These can't throw + node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header())); + if(constant_time_size){ + size_type backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(other.priv_size_traits().get_size()); + other.priv_size_traits().set_size(backup); + } + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree before the upper bound. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + std::size_t max_tree_size = (std::size_t)data_.max_tree_size_; + node_ptr p = node_algorithms::insert_equal_upper_bound + (node_ptr(&priv_header()), to_insert, key_node_comp + , (size_type)this->size(), this->get_h_alpha_func(), max_tree_size); + data_.max_tree_size_ = (size_type)max_tree_size; + return iterator(p, this); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator. + //! + //! Effects: Inserts x into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case) + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(const_iterator hint, reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + std::size_t max_tree_size = (std::size_t)data_.max_tree_size_; + node_ptr p = node_algorithms::insert_equal + (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp + , (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size); + data_.max_tree_size_ = (size_type)max_tree_size; + return iterator(p, this); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a each element of a range into the tree + //! before the upper bound of the key of each element. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_equal(Iterator b, Iterator e) + { + iterator end(this->end()); + for (; b != e; ++b) + this->insert_equal(end, *b); + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree if the value + //! is not already present. + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert_unique(reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(value, commit_data); + if(!ret.second) + return ret; + return std::pair (insert_unique_commit(value, commit_data), true); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator + //! + //! Effects: Tries to insert x into the tree, using "hint" as a hint + //! to where it will be inserted. + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time (two comparisons in the worst case) + //! if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_unique(const_iterator hint, reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(hint, value, commit_data); + if(!ret.second) + return ret.first; + return insert_unique_commit(value, commit_data); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Tries to insert each element of a range into the tree. + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_unique(Iterator b, Iterator e) + { + if(this->empty()){ + iterator end(this->end()); + for (; b != e; ++b) + this->insert_unique(end, *b); + } + else{ + for (; b != e; ++b) + this->insert_unique(*b); + } + } + + std::pair insert_unique_check + (const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + (node_algorithms::insert_unique_check + (node_ptr(&priv_header()), key, comp, commit_data)); + return std::pair(iterator(ret.first, this), ret.second); + } + + std::pair insert_unique_check + (const_iterator hint, const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(hint, value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + (node_algorithms::insert_unique_check + (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data)); + return std::pair(iterator(ret.first, this), ret.second); + } + + iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) + { + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + std::size_t max_tree_size = (std::size_t)data_.max_tree_size_; + node_algorithms::insert_unique_commit + ( node_ptr(&priv_header()), to_insert, commit_data + , (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size); + data_.max_tree_size_ = (size_type)max_tree_size; + return iterator(to_insert, this); + } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { + iterator ret(i); + ++ret; + node_ptr to_erase(i.pointed_node()); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase)); + std::size_t max_tree_size = data_.max_tree_size_; + node_algorithms::erase + ( &priv_header(), to_erase, (std::size_t)this->size() + , max_tree_size, this->get_alpha_by_max_size_func()); + data_.max_tree_size_ = (size_type)max_tree_size; + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + return ret; + } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { size_type n; return private_erase(b, e, n); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return this->erase(value, priv_comp()); } + + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { + node_ptr to_erase(i.pointed_node()); + iterator ret(this->erase(i)); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + return ret; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { size_type n; return private_erase(b, e, n, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { + std::pair p = this->equal_range(value); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { + if(safemode_or_autounlink){ + this->clear_and_dispose(detail::null_disposer()); + } + else{ + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + } + + //! Effects: Erases all of the elements calling disposer(p) for + //! each node to be erased. + //! Complexity: Average complexity for is at most O(log(size() + N)), + //! where N is the number of elements in the container. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. Calls N times to disposer functor. + template + void clear_and_dispose(Disposer disposer) + { + node_algorithms::clear_and_dispose(node_ptr(&priv_header()) + , detail::node_disposer(disposer, this)); + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + + //! Effects: Returns the number of contained elements with the given value + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given value. + //! + //! Throws: Nothing. + size_type count(const_reference value) const + { return this->count(value, priv_comp()); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: Nothing. + template + size_type count(const KeyType &key, KeyValueCompare comp) const + { + std::pair ret = this->equal_range(key, comp); + return std::distance(ret.first, ret.second); + } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator lower_bound(const_reference value) + { return this->lower_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator lower_bound(const_reference value) const + { return this->lower_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator lower_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator lower_bound(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator upper_bound(const_reference value) + { return this->upper_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator upper_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::upper_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator upper_bound(const_reference value) const + { return this->upper_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator upper_bound(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::upper_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + iterator find(const_reference value) + { return this->find(value, priv_comp()); } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator find(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator find(const_reference value) const + { return this->find(value, priv_comp()); } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator find(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + std::pair equal_range(const_reference value) + { return this->equal_range(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + std::pair equal_range(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp)); + return std::pair(iterator(ret.first, this), iterator(ret.second, this)); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + std::pair + equal_range(const_reference value) const + { return this->equal_range(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + std::pair + equal_range(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp)); + return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const sgtree_impl &src, Cloner cloner, Disposer disposer) + { + this->clear_and_dispose(disposer); + if(!src.empty()){ + detail::exception_disposer + rollback(*this, disposer); + node_algorithms::clone + (const_node_ptr(&src.priv_header()) + ,node_ptr(&this->priv_header()) + ,detail::node_cloner(cloner, this) + ,detail::node_disposer(disposer, this)); + this->priv_size_traits().set_size(src.priv_size_traits().get_size()); + this->priv_comp() = src.priv_comp(); + rollback.release(); + } + } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { + node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance + (node_ptr(&priv_header()))); + if(!to_be_disposed) + return 0; + this->priv_size_traits().decrement(); + if(safemode_or_autounlink)//If this is commented does not work with normal_link + node_algorithms::init(to_be_disposed); + return get_real_value_traits().to_value_ptr(to_be_disposed); + } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { + node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) + , node_ptr(&priv_header()) + , get_real_value_traits().to_node_ptr(with_this)); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return iterator (value_traits::to_node_ptr(value), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return const_iterator (value_traits::to_node_ptr(const_cast (value)), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return iterator (value_traits::to_node_ptr(value), this); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return const_iterator (value_traits::to_node_ptr(const_cast (value)), this); } + + //! Requires: value shall not be in a tree. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { node_algorithms::init(value_traits::to_node_ptr(value)); } + + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + void rebalance() + { node_algorithms::rebalance(node_ptr(&priv_header())); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + iterator rebalance_subtree(iterator root) + { return iterator(node_algorithms::rebalance_subtree(root.pointed_node()), this); } + + //! Returns: The balance factor (alpha) used in this tree + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + float balance_factor() const + { return this->priv_alpha(); } + + //! Requires: new_alpha must be a value between 0.5 and 1.0 + //! + //! Effects: Establishes a new balance factor (alpha) and rebalances + //! the tree if the new balance factor is stricter (less) than the old factor. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + void balance_factor(float new_alpha) + { + BOOST_INTRUSIVE_INVARIANT_ASSERT((new_alpha > 0.5f && new_alpha < 1.0f)); + if(new_alpha < 0.5f && new_alpha >= 1.0f) return; + + //The alpha factor CAN't be changed if the fixed, floating operation-less + //1/sqrt(2) alpha factor option is activated + BOOST_STATIC_ASSERT((floating_point)); + float old_alpha = this->priv_alpha(); + this->priv_alpha(new_alpha); + + if(new_alpha < old_alpha){ + data_.max_tree_size_ = this->size(); + this->rebalance(); + } + } +/* + //! Effects: removes x from a tree of the appropriate type. It has no effect, + //! if x is not in such a tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This static function is only usable with the "safe mode" + //! hook and non-constant time size lists. Otherwise, the user must use + //! the non-static "erase(reference )" member. If the user calls + //! this function with a non "safe mode" or constant time size list + //! a compilation error will be issued. + template + static void remove_node(T& value) + { + //This function is only usable for safe mode hooks and non-constant + //time lists. + //BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size))); + BOOST_STATIC_ASSERT((!constant_time_size)); + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + node_ptr to_remove(value_traits::to_node_ptr(value)); + node_algorithms::unlink_and_rebalance(to_remove); + if(safemode_or_autounlink) + node_algorithms::init(to_remove); + } +*/ + + /// @cond + private: + template + iterator private_erase(iterator b, iterator e, size_type &n, Disposer disposer) + { + for(n = 0; b != e; ++n) + this->erase_and_dispose(b++, disposer); + return b; + } + + iterator private_erase(iterator b, iterator e, size_type &n) + { + for(n = 0; b != e; ++n) + this->erase(b++); + return b; + } + /// @endcond + + private: + static sgtree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) + { + header_plus_alpha *r = detail::parent_from_member + ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_alpha::header_); + node_plus_pred_t *n = detail::parent_from_member + (r, &node_plus_pred_t::header_plus_alpha_); + data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); + sgtree_impl *scapegoat = detail::parent_from_member(d, &sgtree_impl::data_); + return *scapegoat; + } + + static sgtree_impl &priv_container_from_iterator(const const_iterator &it) + { return priv_container_from_end_iterator(it.end_iterator_from_it()); } +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator< +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sgtree_impl &x, const sgtree_impl &y) +#else +(const sgtree_impl &x, const sgtree_impl &y) +#endif +{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +bool operator== +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sgtree_impl &x, const sgtree_impl &y) +#else +(const sgtree_impl &x, const sgtree_impl &y) +#endif +{ + typedef sgtree_impl tree_type; + typedef typename tree_type::const_iterator const_iterator; + + if(tree_type::constant_time_size && x.size() != y.size()){ + return false; + } + const_iterator end1 = x.end(); + const_iterator i1 = x.begin(); + const_iterator i2 = y.begin(); + if(tree_type::constant_time_size){ + while (i1 != end1 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1; + } + else{ + const_iterator end2 = y.end(); + while (i1 != end1 && i2 != end2 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1 && i2 == end2; + } +} + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sgtree_impl &x, const sgtree_impl &y) +#else +(const sgtree_impl &x, const sgtree_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sgtree_impl &x, const sgtree_impl &y) +#else +(const sgtree_impl &x, const sgtree_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sgtree_impl &x, const sgtree_impl &y) +#else +(const sgtree_impl &x, const sgtree_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const sgtree_impl &x, const sgtree_impl &y) +#else +(const sgtree_impl &x, const sgtree_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(sgtree_impl &x, sgtree_impl &y) +#else +(sgtree_impl &x, sgtree_impl &y) +#endif +{ x.swap(y); } + +/// @cond +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_sgtree_opt +{ + typedef typename pack_options + < sg_set_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + typedef typename detail::get_value_traits + ::type value_traits; + + typedef sg_setopt + < value_traits + , typename packed_options::compare + , typename packed_options::size_type + , packed_options::floating_point + > type; +}; +/// @endcond + +//! Helper metafunction to define a \c sgtree that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_sgtree +{ + /// @cond + typedef sgtree_impl + < typename make_sgtree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class sgtree + : public make_sgtree::type +{ + typedef typename make_sgtree + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::real_value_traits real_value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + sgtree( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + sgtree( bool unique, Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(unique, b, e, cmp, v_traits) + {} + + static sgtree &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const sgtree &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } +}; + +#endif + + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SGTREE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sgtree_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sgtree_algorithms.hpp new file mode 100644 index 0000000000..c9af84f5ef --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/sgtree_algorithms.hpp @@ -0,0 +1,713 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +// +// Scapegoat tree algorithms are taken from the paper titled: +// "Scapegoat Trees" by Igal Galperin Ronald L. Rivest. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_SGTREE_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_SGTREE_ALGORITHMS_HPP + +#include + +#include +#include +#include +#include +#include + + +namespace boost { +namespace intrusive { + +//! sgtree_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the circular list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! Static functions: +//! +//! static node_ptr get_parent(const_node_ptr n); +//! +//! static void set_parent(node_ptr n, node_ptr parent); +//! +//! static node_ptr get_left(const_node_ptr n); +//! +//! static void set_left(node_ptr n, node_ptr left); +//! +//! static node_ptr get_right(const_node_ptr n); +//! +//! static void set_right(node_ptr n, node_ptr right); +template +class sgtree_algorithms +{ + public: + typedef typename NodeTraits::node node; + typedef NodeTraits node_traits; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + + /// @cond + private: + + typedef detail::tree_algorithms tree_algorithms; + + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + } + /// @endcond + + public: + static node_ptr begin_node(const_node_ptr header) + { return tree_algorithms::begin_node(header); } + + static node_ptr end_node(const_node_ptr header) + { return tree_algorithms::end_node(header); } + + //! This type is the information that will be + //! filled by insert_unique_check + struct insert_commit_data + : tree_algorithms::insert_commit_data + { + std::size_t depth; + }; + + //! Requires: header1 and header2 must be the header nodes + //! of two trees. + //! + //! Effects: Swaps two trees. After the function header1 will contain + //! links to the second tree and header2 will have links to the first tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static void swap_tree(node_ptr header1, node_ptr header2) + { return tree_algorithms::swap_tree(header1, header2); } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr node2) + { + if(node1 == node2) + return; + + node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2)); + swap_nodes(node1, header1, node2, header2); + } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees with header header1 and header2. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) + { tree_algorithms::swap_nodes(node1, header1, node2, header2); } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing and comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) + { + if(node_to_be_replaced == new_node) + return; + replace_node(node_to_be_replaced, tree_algorithms::get_header(node_to_be_replaced), new_node); + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! with header "header" and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) + { tree_algorithms::replace_node(node_to_be_replaced, header, new_node); } + + //! Requires: node is a tree node but not the header. + //! + //! Effects: Unlinks the node and rebalances the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + static void unlink(node_ptr node) + { + node_ptr x = NodeTraits::get_parent(node); + if(x){ + while(!is_header(x)) + x = NodeTraits::get_parent(x); + tree_algorithms::erase(x, node); + } + } + + //! Requires: header is the header of a tree. + //! + //! Effects: Unlinks the leftmost node from the tree, and + //! updates the header link to the new leftmost node. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + static node_ptr unlink_leftmost_without_rebalance(node_ptr header) + { return tree_algorithms::unlink_leftmost_without_rebalance(header); } + + //! Requires: node is a node of the tree or an node initialized + //! by init(...). + //! + //! Effects: Returns true if the node is initialized by init(). + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + static bool unique(const_node_ptr node) + { return tree_algorithms::unique(node); } + + //! Requires: node is a node of the tree but it's not the header. + //! + //! Effects: Returns the number of nodes of the subtree. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr node) + { return tree_algorithms::count(node); } + + //! Requires: header is the header node of the tree. + //! + //! Effects: Returns the number of nodes above the header. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t size(const_node_ptr header) + { return tree_algorithms::size(header); } + + //! Requires: p is a node from the tree except the header. + //! + //! Effects: Returns the next node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr next_node(node_ptr p) + { return tree_algorithms::next_node(p); } + + //! Requires: p is a node from the tree except the leftmost node. + //! + //! Effects: Returns the previous node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr prev_node(node_ptr p) + { return tree_algorithms::prev_node(p); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: After the function unique(node) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init(node_ptr node) + { tree_algorithms::init(node); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: Initializes the header to represent an empty tree. + //! unique(header) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init_header(node_ptr header) + { tree_algorithms::init_header(header); } + + //! Requires: header must be the header of a tree, z a node + //! of that tree and z != header. + //! + //! Effects: Erases node "z" from the tree with header "header". + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + template + static node_ptr erase(node_ptr header, node_ptr z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize) + { + //typename tree_algorithms::data_for_rebalance info; + tree_algorithms::erase(header, z); + --tree_size; + if (tree_size > 0 && + tree_size < alpha_by_maxsize(max_tree_size)){ + tree_algorithms::rebalance(header); + max_tree_size = tree_size; + } + return z; + } + + //! Requires: "cloner" must be a function + //! object taking a node_ptr and returning a new cloned node of it. "disposer" must + //! take a node_ptr and shouldn't throw. + //! + //! Effects: First empties target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Then, duplicates the entire tree pointed by "source_header" cloning each + //! source node with node_ptr Cloner::operator()(node_ptr) to obtain + //! the nodes of the target tree. If "cloner" throws, the cloned target nodes + //! are disposed using void disposer(node_ptr). + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clone + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer) + { + tree_algorithms::clone(source_header, target_header, cloner, disposer); + } + + //! Requires: "disposer" must be an object function + //! taking a node_ptr parameter and shouldn't throw. + //! + //! Effects: Empties the target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clear_and_dispose(node_ptr header, Disposer disposer) + { tree_algorithms::clear_and_dispose(header, disposer); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is + //! not less than "key" according to "comp" or "header" if that element does + //! not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr lower_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::lower_bound(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is greater + //! than "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr upper_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::upper_bound(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the element that is equivalent to + //! "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr find + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::find(header, key, comp); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an a pair of node_ptr delimiting a range containing + //! all elements that are equivalent to "key" according to "comp" or an + //! empty range that indicates the position where those elements would be + //! if they there are no equivalent elements. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static std::pair equal_range + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { return tree_algorithms::equal_range(header, key, comp); } + + //! Requires: "h" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. + //! + //! Effects: Inserts new_node into the tree before the upper bound + //! according to "comp". + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal_upper_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp + ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) + { + std::size_t depth; + tree_algorithms::insert_equal_upper_bound(h, new_node, comp, &depth); + rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size); + return new_node; + } + + //! Requires: "h" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. + //! + //! Effects: Inserts new_node into the tree before the lower bound + //! according to "comp". + //! + //! Complexity: Average complexity for insert element is at + //! most logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal_lower_bound + (node_ptr h, node_ptr new_node, NodePtrCompare comp + ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) + { + std::size_t depth; + tree_algorithms::insert_equal_lower_bound(h, new_node, comp, &depth); + rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size); + return new_node; + } + + //! Requires: "header" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from + //! the "header"'s tree. + //! + //! Effects: Inserts new_node into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case). + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if new_node is inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp + ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) + { + std::size_t depth; + tree_algorithms::insert_equal(header, hint, new_node, comp, &depth); + rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size); + return new_node; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (const_node_ptr header, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { + std::size_t depth; + std::pair ret = + tree_algorithms::insert_unique_check(header, key, comp, commit_data, &depth); + commit_data.depth = depth; + return ret; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! "hint" is node from the "header"'s tree. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" using "hint" as a hint to where it should be + //! inserted and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! If "hint" is the upper_bound the function has constant time + //! complexity (two comparisons in the worst case). + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic, but it is + //! amortized constant time if new_node should be inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (const_node_ptr header, node_ptr hint, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { + std::size_t depth; + std::pair ret = + tree_algorithms::insert_unique_check + (header, hint, key, comp, commit_data, &depth); + commit_data.depth = depth; + return ret; + } + + //! Requires: "header" must be the header node of a tree. + //! "commit_data" must have been obtained from a previous call to + //! "insert_unique_check". No objects should have been inserted or erased + //! from the set between the "insert_unique_check" that filled "commit_data" + //! and the call to "insert_commit". + //! + //! + //! Effects: Inserts new_node in the set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_unique_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + template + static void insert_unique_commit + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data + ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) + { + tree_algorithms::insert_unique_commit(header, new_value, commit_data); + rebalance_after_insertion(new_value, commit_data.depth, tree_size+1, h_alpha, max_tree_size); + } + + //! Requires: header must be the header of a tree. + //! + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + static void rebalance(node_ptr header) + { tree_algorithms::rebalance(header); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + static node_ptr rebalance_subtree(node_ptr old_root) + { return tree_algorithms::rebalance_subtree(old_root); } + + //! Requires: "n" must be a node inserted in a tree. + //! + //! Effects: Returns a pointer to the header node of the tree. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + static node_ptr get_header(node_ptr n) + { return tree_algorithms::get_header(n); } + + /// @cond + private: + + //! Requires: p is a node of a tree. + //! + //! Effects: Returns true if p is the header of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static bool is_header(const_node_ptr p) + { return tree_algorithms::is_header(p); } + + template + static void rebalance_after_insertion + ( node_ptr x, std::size_t depth + , std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) + { + if(tree_size > max_tree_size) + max_tree_size = tree_size; + + if(tree_size != 1 && depth > h_alpha(tree_size)){ + //Find the first non height-balanced node + //as described in the section 4.2 of the paper. + //This method is the alternative method described + //in the paper. Authors claim that this method + //may tend to yield more balanced trees on the average + //than the weight balanced method. + node_ptr s = x; + std::size_t size = 1; + + for(std::size_t i = 1; true; ++i){ + bool rebalance = false; + if(i == depth){ + BOOST_INTRUSIVE_INVARIANT_ASSERT(tree_size == count(s)); + rebalance = true; + } + else if(i > h_alpha(size)){ + node_ptr s_parent = NodeTraits::get_parent(s); + node_ptr s_parent_left = NodeTraits::get_left(s_parent); + size += 1 + tree_algorithms::count + ( s_parent_left == s ? NodeTraits::get_right(s_parent) : s_parent_left ); + s = s_parent; + rebalance = true; + } + if(rebalance){ + rebalance_subtree(s); + break; + } + } + } + } + + /// @endcond +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SGTREE_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/slist.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/slist.hpp new file mode 100644 index 0000000000..0577d7179c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/slist.hpp @@ -0,0 +1,1953 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_SLIST_HPP +#define BOOST_INTRUSIVE_SLIST_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //std::size_t +#include //std::pair + +namespace boost { +namespace intrusive { + +/// @cond + +template +struct slistopt +{ + typedef ValueTraits value_traits; + typedef SizeType size_type; + static const bool constant_time_size = ConstantTimeSize; + static const bool linear = Linear; + static const bool cache_last = CacheLast; +}; + +template +struct root_plus_last +{ + Node root_; + NodePtr last_; +}; + +template +struct root_plus_last +{ + Node root_; +}; + +template +struct slist_defaults + : pack_options + < none + , base_hook + , constant_time_size + , linear + , size_type + , cache_last + >::type +{}; + +/// @endcond + +//! The class template slist is an intrusive container, that encapsulates +//! a singly-linked list. You can use such a list to squeeze the last bit +//! of performance from your application. Unfortunately, the little gains +//! come with some huge drawbacks. A lot of member functions can't be +//! implemented as efficiently as for standard containers. To overcome +//! this limitation some other member functions with rather unusual semantics +//! have to be introduced. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<>, +//! \c linear<> and \c cache_last<>. +//! +//! The iterators of slist are forward iterators. slist provides a static +//! function called "previous" to compute the previous iterator of a given iterator. +//! This function has linear complexity. To improve the usability esp. with +//! the '*_after' functions, ++end() == begin() and previous(begin()) == end() +//! are defined. An new special function "before_begin()" is defined, which returns +//! an iterator that points one less the beginning of the list: ++before_begin() == begin() +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class slist_impl +{ + //Public typedefs + public: + typedef typename Config::value_traits value_traits; + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + /// @endcond + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::const_pointer const_pointer; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename Config::size_type size_type; + typedef slist_iterator iterator; + typedef slist_iterator const_iterator; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef typename detail::if_c + < Config::linear + , linear_slist_algorithms + , circular_slist_algorithms + >::type node_algorithms; + + static const bool constant_time_size = Config::constant_time_size; + static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; + static const bool linear = Config::linear; + static const bool cache_last = Config::cache_last; + + /// @cond + private: + typedef detail::size_holder size_traits; + + //! This class is + //! non-copyable + slist_impl (const slist_impl&); + + //! This class is + //! non-asignable + slist_impl &operator =(const slist_impl&); + + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + //Constant-time size is incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink))); + //Linear singly linked lists are incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(linear && ((int)real_value_traits::link_mode == (int)auto_unlink))); + //A list with cached last node is incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(cache_last && ((int)real_value_traits::link_mode == (int)auto_unlink))); + + node_ptr get_end_node() + { return node_ptr(linear ? node_ptr(0) : this->get_root_node()); } + + const_node_ptr get_end_node() const + { + return const_node_ptr + (linear ? const_node_ptr(0) : this->get_root_node()); } + + node_ptr get_root_node() + { return node_ptr(&data_.root_plus_size_.root_); } + + const_node_ptr get_root_node() const + { return const_node_ptr(&data_.root_plus_size_.root_); } + + node_ptr get_last_node() + { return this->get_last_node(detail::bool_()); } + + const_node_ptr get_last_node() const + { return this->get_last_node(detail::bool_()); } + + void set_last_node(node_ptr n) + { return this->set_last_node(n, detail::bool_()); } + + static node_ptr get_last_node(detail::bool_) + { return node_ptr(0); } + + static void set_last_node(node_ptr, detail::bool_) + {} + + node_ptr get_last_node(detail::bool_) + { return node_ptr(data_.root_plus_size_.last_); } + + const_node_ptr get_last_node(detail::bool_) const + { return const_node_ptr(data_.root_plus_size_.last_); } + + void set_last_node(node_ptr n, detail::bool_) + { data_.root_plus_size_.last_ = n; } + + static node_ptr uncast(const_node_ptr ptr) + { return node_ptr(const_cast(detail::get_pointer(ptr))); } + + void set_default_constructed_state() + { + node_algorithms::init_header(this->get_root_node()); + this->priv_size_traits().set_size(size_type(0)); + if(cache_last){ + this->set_last_node(this->get_root_node()); + } + } + + struct root_plus_size + : public size_traits + , public root_plus_last + {}; + + struct data_t + : public slist_impl::value_traits + { + typedef typename slist_impl::value_traits value_traits; + data_t(const value_traits &val_traits) + : value_traits(val_traits) + {} + + root_plus_size root_plus_size_; + } data_; + + size_traits &priv_size_traits() + { return data_.root_plus_size_; } + + const size_traits &priv_size_traits() const + { return data_.root_plus_size_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_.get_value_traits(*this); } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_; } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_.get_value_traits(*this); } + + /// @endcond + + public: + + const real_value_traits &get_real_value_traits() const + { return this->get_real_value_traits(detail::bool_()); } + + real_value_traits &get_real_value_traits() + { return this->get_real_value_traits(detail::bool_()); } + + public: + //! Effects: constructs an empty list. + //! + //! Complexity: Constant + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks). + slist_impl(const value_traits &v_traits = value_traits()) + : data_(v_traits) + { this->set_default_constructed_state(); } + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! + //! Effects: Constructs a list equal to [first,last). + //! + //! Complexity: Linear in std::distance(b, e). No copy constructors are called. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks). + template + slist_impl(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) + : data_(v_traits) + { + this->set_default_constructed_state(); + this->insert_after(this->cbefore_begin(), b, e); + } + + //! Effects: If it's a safe-mode + //! or auto-unlink value, the destructor does nothing + //! (ie. no code is generated). Otherwise it detaches all elements from this. + //! In this case the objects in the list are not deleted (i.e. no destructors + //! are called), but the hooks according to the value_traits template parameter + //! are set to their default value. + //! + //! Complexity: Linear to the number of elements in the list, if + //! it's a safe-mode or auto-unlink value. Otherwise constant. + ~slist_impl() + { this->clear(); } + + //! Effects: Erases all the elements of the container. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements of the list. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Note: Invalidates the iterators (but not the references) to the erased elements. + void clear() + { + if(safemode_or_autounlink){ + this->clear_and_dispose(detail::null_disposer()); + } + else{ + this->set_default_constructed_state(); + } + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements of the list. + //! + //! Note: Invalidates the iterators to the erased elements. + template + void clear_and_dispose(Disposer disposer) + { + const_iterator it(this->begin()), itend(this->end()); + while(it != itend){ + node_ptr to_erase(it.pointed_node()); + ++it; + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + } + this->set_default_constructed_state(); + } + + //! Requires: value must be an lvalue. + //! + //! Effects: Inserts the value in the front of the list. + //! No copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + void push_front(reference value) + { + node_ptr to_insert = get_real_value_traits().to_node_ptr(value); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(to_insert)); + if(cache_last){ + if(this->empty()){ + this->set_last_node(to_insert); + } + } + node_algorithms::link_after(this->get_root_node(), to_insert); + this->priv_size_traits().increment(); + } + + //! Requires: value must be an lvalue. + //! + //! Effects: Inserts the value in the back of the list. + //! No copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + //! This function is only available is cache_last<> is true. + void push_back(reference value) + { + BOOST_STATIC_ASSERT((cache_last != 0)); + this->insert_after(const_iterator(this->get_last_node(), this), value); + } + + //! Effects: Erases the first element of the list. + //! No destructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators (but not the references) to the erased element. + void pop_front() + { return this->pop_front_and_dispose(detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the first element of the list. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators to the erased element. + template + void pop_front_and_dispose(Disposer disposer) + { + node_ptr to_erase = node_traits::get_next(this->get_root_node()); + node_algorithms::unlink_after(this->get_root_node()); + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + if(cache_last){ + if(this->empty()){ + this->set_last_node(this->get_root_node()); + } + } + } + + //! Effects: Returns a reference to the first element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + reference front() + { return *this->get_real_value_traits().to_value_ptr(node_traits::get_next(this->get_root_node())); } + + //! Effects: Returns a const_reference to the first element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_reference front() const + { return *this->get_real_value_traits().to_value_ptr(uncast(node_traits::get_next(this->get_root_node()))); } + + //! Effects: Returns a reference to the last element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + //! This function is only available is cache_last<> is true. + reference back() + { + BOOST_STATIC_ASSERT((cache_last != 0)); + return *this->get_real_value_traits().to_value_ptr(this->get_last_node()); + } + + //! Effects: Returns a const_reference to the last element of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + //! This function is only available is cache_last<> is true. + const_reference back() const + { + BOOST_STATIC_ASSERT((cache_last != 0)); + return *this->get_real_value_traits().to_value_ptr(this->get_last_node()); + } + + //! Effects: Returns an iterator to the first element contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + iterator begin() + { return iterator (node_traits::get_next(this->get_root_node()), this); } + + //! Effects: Returns a const_iterator to the first element contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator begin() const + { return const_iterator (node_traits::get_next(this->get_root_node()), this); } + + //! Effects: Returns a const_iterator to the first element contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator cbegin() const + { return const_iterator(node_traits::get_next(this->get_root_node()), this); } + + //! Effects: Returns an iterator to the end of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + iterator end() + { return iterator(this->get_end_node(), this); } + + //! Effects: Returns a const_iterator to the end of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator end() const + { return const_iterator(uncast(this->get_end_node()), this); } + + //! Effects: Returns a const_iterator to the end of the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator cend() const + { return this->end(); } + + //! Effects: Returns an iterator that points to a position + //! before the first element. Equivalent to "end()" + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + iterator before_begin() + { return iterator(this->get_root_node(), this); } + + //! Effects: Returns an iterator that points to a position + //! before the first element. Equivalent to "end()" + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator before_begin() const + { return const_iterator(uncast(this->get_root_node()), this); } + + //! Effects: Returns an iterator that points to a position + //! before the first element. Equivalent to "end()" + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + const_iterator cbefore_begin() const + { return this->before_begin(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of slist. + //! + //! Effects: Returns a const reference to the slist associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static slist_impl &container_from_end_iterator(iterator end_iterator) + { return slist_impl::priv_container_from_end_iterator(end_iterator); } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of slist. + //! + //! Effects: Returns a const reference to the slist associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const slist_impl &container_from_end_iterator(const_iterator end_iterator) + { return slist_impl::priv_container_from_end_iterator(end_iterator); } + + //! Effects: Returns the number of the elements contained in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements contained in the list. + //! if constant_time_size is false. Constant time otherwise. + //! + //! Note: Does not affect the validity of iterators and references. + size_type size() const + { + if(constant_time_size) + return this->priv_size_traits().get_size(); + else + return node_algorithms::count(this->get_root_node()) - 1; + } + + //! Effects: Returns true if the list contains no elements. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + bool empty() const + { return node_algorithms::unique(this->get_root_node()); } + + //! Effects: Swaps the elements of x and *this. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements of both lists. + //! Constant-time if linear<> and/or cache_last<> options are used. + //! + //! Note: Does not affect the validity of iterators and references. + void swap(slist_impl& other) + { + if(cache_last){ + this->priv_swap_cache_last(other); + } + else{ + this->priv_swap_lists(this->get_root_node(), other.get_root_node(), detail::bool_()); + } + if(constant_time_size){ + size_type backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(other.priv_size_traits().get_size()); + other.priv_size_traits().set_size(backup); + } + } + + //! Effects: Moves backwards all the elements, so that the first + //! element becomes the second, the second becomes the third... + //! the last element becomes the first one. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements plus the number shifts. + //! + //! Note: Iterators Does not affect the validity of iterators and references. + void shift_backwards(size_type n = 1) + { this->priv_shift_backwards(n, detail::bool_()); } + + //! Effects: Moves forward all the elements, so that the second + //! element becomes the first, the third becomes the second... + //! the first element becomes the last one. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements plus the number shifts. + //! + //! Note: Does not affect the validity of iterators and references. + void shift_forward(size_type n = 1) + { this->priv_shift_forward(n, detail::bool_()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws. + template + void clone_from(const slist_impl &src, Cloner cloner, Disposer disposer) + { + this->clear_and_dispose(disposer); + detail::exception_disposer + rollback(*this, disposer); + const_iterator prev(this->cbefore_begin()); + const_iterator b(src.begin()), e(src.end()); + for(; b != e; ++b){ + prev = this->insert_after(prev, *cloner(*b)); + } + rollback.release(); + } + + //! Requires: value must be an lvalue and prev_p must point to an element + //! contained by the list or to end(). + //! + //! Effects: Inserts the value after the position pointed by prev_p. + //! No copy constructor is called. + //! + //! Returns: An iterator to the inserted element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Does not affect the validity of iterators and references. + iterator insert_after(const_iterator prev_p, reference value) + { + node_ptr n = get_real_value_traits().to_node_ptr(value); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(n)); + node_ptr prev_n(prev_p.pointed_node()); + node_algorithms::link_after(prev_n, n); + if(cache_last && (this->get_last_node() == prev_n)){ + this->set_last_node(n); + } + this->priv_size_traits().increment(); + return iterator (n, this); + } + + //! Requires: Dereferencing iterator must yield + //! an lvalue of type value_type and prev_p must point to an element + //! contained by the list or to the end node. + //! + //! Effects: Inserts the [first, last) + //! after the position prev_p. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements inserted. + //! + //! Note: Does not affect the validity of iterators and references. + template + void insert_after(const_iterator prev_p, Iterator first, Iterator last) + { + for (; first != last; ++first) + prev_p = this->insert_after(prev_p, *first); + } + + //! Requires: value must be an lvalue and p must point to an element + //! contained by the list or to end(). + //! + //! Effects: Inserts the value before the position pointed by p. + //! No copy constructor is called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements before p. + //! Constant-time if cache_last<> is true and p == end(). + //! + //! Note: Does not affect the validity of iterators and references. + iterator insert(const_iterator p, reference value) + { return this->insert_after(this->previous(p), value); } + + //! Requires: Dereferencing iterator must yield + //! an lvalue of type value_type and p must point to an element + //! contained by the list or to the end node. + //! + //! Effects: Inserts the pointed by b and e + //! before the position p. No copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements inserted plus linear + //! to the elements before b. + //! Linear to the number of elements to insert if cache_last<> option is true and p == end(). + //! + //! Note: Does not affect the validity of iterators and references. + template + void insert(const_iterator p, Iterator b, Iterator e) + { return this->insert_after(this->previous(p), b, e); } + + //! Effects: Erases the element after the element pointed by prev of + //! the list. No destructors are called. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased element. + iterator erase_after(const_iterator prev) + { return this->erase_after_and_dispose(prev, detail::null_disposer()); } + + //! Effects: Erases the range (before_first, last) from + //! the list. No destructors are called. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of erased elements if it's a safe-mode + //! , auto-unlink value or constant-time size is activated. Constant time otherwise. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased element. + iterator erase_after(const_iterator before_first, const_iterator last) + { + if(safemode_or_autounlink || constant_time_size){ + return this->erase_after_and_dispose(before_first, last, detail::null_disposer()); + } + else{ + node_ptr bfp = before_first.pointed_node(); + node_ptr lp = last.pointed_node(); + if(cache_last){ + if((lp == this->get_end_node())){ + this->set_last_node(bfp); + } + } + node_algorithms::unlink_after(bfp, lp); + return last.unconst(); + } + } + + //! Effects: Erases the range (before_first, last) from + //! the list. n must be std::distance(before_first, last) - 1. + //! No destructors are called. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: constant-time if link_mode is normal_link. + //! Linear to the elements (last - before_first) otherwise. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased element. + iterator erase_after(const_iterator before_first, const_iterator last, difference_type n) + { + BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(++const_iterator(before_first), last) == difference_type(n)); + if(safemode_or_autounlink){ + return this->erase_after(before_first, last); + } + else{ + node_ptr bfp = before_first.pointed_node(); + node_ptr lp = last.pointed_node(); + if(cache_last){ + if((lp == this->get_end_node())){ + this->set_last_node(bfp); + } + } + node_algorithms::unlink_after(bfp, lp); + if(constant_time_size){ + this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n); + } + return last.unconst(); + } + } + + //! Effects: Erases the element pointed by i of the list. + //! No destructors are called. + //! + //! Returns: the first element remaining beyond the removed element, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements before i. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased element. + iterator erase(const_iterator i) + { return this->erase_after(this->previous(i)); } + + //! Requires: first and last must be valid iterator to elements in *this. + //! + //! Effects: Erases the range pointed by b and e. + //! No destructors are called. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements before last. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased elements. + iterator erase(const_iterator first, const_iterator last) + { return this->erase_after(this->previous(first), last); } + + //! Effects: Erases the range [first, last) from + //! the list. n must be std::distance(first, last). + //! No destructors are called. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: linear to the elements before first if link_mode is normal_link + //! and constant_time_size is activated. Linear to the elements before last otherwise. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased element. + iterator erase(const_iterator first, const_iterator last, difference_type n) + { return this->erase_after(this->previous(first), last, n); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element after the element pointed by prev of + //! the list. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Invalidates the iterators to the erased element. + template + iterator erase_after_and_dispose(const_iterator prev, Disposer disposer) + { + const_iterator it(prev); + ++it; + node_ptr to_erase(it.pointed_node()); + ++it; + node_ptr prev_n(prev.pointed_node()); + node_algorithms::unlink_after(prev_n); + if(cache_last && (to_erase == this->get_last_node())){ + this->set_last_node(prev_n); + } + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + this->priv_size_traits().decrement(); + return it.unconst(); + } + + /// @cond + + template + static iterator s_erase_after_and_dispose(const_iterator prev, Disposer disposer) + { + BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits))); + const_iterator it(prev); + ++it; + node_ptr to_erase(it.pointed_node()); + ++it; + node_ptr prev_n(prev.pointed_node()); + node_algorithms::unlink_after(prev_n); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(real_value_traits::to_value_ptr(to_erase)); + return it.unconst(); + } + + static iterator s_erase_after(const_iterator prev) + { return s_erase_after_and_dispose(prev, detail::null_disposer()); } + + /// @endcond + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range (before_first, last) from + //! the list. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Lineal to the elements (last - before_first + 1). + //! + //! Note: Invalidates the iterators to the erased element. + template + iterator erase_after_and_dispose(const_iterator before_first, const_iterator last, Disposer disposer) + { + node_ptr bfp(before_first.pointed_node()), lp(last.pointed_node()); + node_ptr fp(node_traits::get_next(bfp)); + node_algorithms::unlink_after(bfp, lp); + while(fp != lp){ + node_ptr to_erase(fp); + fp = node_traits::get_next(fp); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + this->priv_size_traits().decrement(); + } + if(cache_last && (node_traits::get_next(bfp) == this->get_end_node())){ + this->set_last_node(bfp); + } + return last.unconst(); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed by i of the list. + //! No destructors are called. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Returns: the first element remaining beyond the removed element, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements before i. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased element. + template + iterator erase_and_dispose(const_iterator i, Disposer disposer) + { return this->erase_after_and_dispose(this->previous(i), disposer); } + + //! Requires: first and last must be valid iterator to elements in *this. + //! Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed by b and e. + //! No destructors are called. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: the first element remaining beyond the removed elements, + //! or end() if no such element exists. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of erased elements plus linear + //! to the elements before first. + //! + //! Note: Invalidates the iterators (but not the references) to the + //! erased elements. + template + iterator erase_and_dispose(const_iterator first, const_iterator last, Disposer disposer) + { return this->erase_after_and_dispose(this->previous(first), last, disposer); } + + //! Requires: Dereferencing iterator must yield + //! an lvalue of type value_type. + //! + //! Effects: Clears the list and inserts the range pointed by b and e. + //! No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements inserted plus + //! linear to the elements contained in the list if it's a safe-mode + //! or auto-unlink value. + //! Linear to the number of elements inserted in the list otherwise. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. + template + void assign(Iterator b, Iterator e) + { + this->clear(); + this->insert_after(this->cbefore_begin(), b, e); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Requires: Dereferencing iterator must yield + //! an lvalue of type value_type. + //! + //! Effects: Clears the list and inserts the range pointed by b and e. + //! No destructors or copy constructors are called. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements inserted plus + //! linear to the elements contained in the list. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. + template + void dispose_and_assign(Disposer disposer, Iterator b, Iterator e) + { + this->clear_and_dispose(disposer); + this->insert_after(this->cbefore_begin(), b, e, disposer); + } + + //! Requires: prev is an iterator to an element or x.end()/x.before_begin() in x. + //! + //! Effects: Transfers all the elements of list x to this list, after the + //! the element pointed by prev. No destructors or copy constructors are called. + //! + //! Returns: The last element inserted of x or prev if x is empty. + //! This iterator can be used as new "prev" iterator for a new splice_after call. + //! that will splice new values after the previously spliced values. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements contained in x. + //! Constant-time if cache_last<> option is true. + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + iterator splice_after(const_iterator prev, slist_impl &x) + { + if (!x.empty()){ + const_iterator last_x(x.previous(x.end())); //<- constant time if cache_last is active + node_ptr prev_n(prev.pointed_node()); + node_ptr last_x_n(last_x.pointed_node()); + if(cache_last){ + x.set_last_node(x.get_root_node()); + if(node_traits::get_next(prev_n) == this->get_end_node()){ + this->set_last_node(last_x_n); + } + } + node_algorithms::transfer_after( prev_n, x.before_begin().pointed_node(), last_x_n); + this->priv_size_traits().set_size(this->priv_size_traits().get_size() + x.priv_size_traits().get_size()); + x.priv_size_traits().set_size(size_type(0)); + return last_x.unconst(); + } + else{ + return prev.unconst(); + } + } + + //! Requires: prev must point to an element contained by this list or + //! to the before_begin() element. prev_ele must point to an element contained in list + //! x or must be x.before_begin(). + //! + //! Effects: Transfers the element after prev_ele, from list x to this list, + //! after the element pointed by prev. No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator prev_ele) + { + const_iterator elem = prev_ele; + this->splice_after(prev_pos, x, prev_ele, ++elem, 1); + } + + //! Requires: prev_pos must be a dereferenceable iterator in *this or be + //! before_begin(), and before_first and before_last belong to x and + //! ++before_first != x.end() && before_last != x.end(). + //! + //! Effects: Transfers the range (before_first, before_last] from list x to this + //! list, after the element pointed by prev_pos. + //! No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements transferred + //! if constant_time_size is true. Constant-time otherwise. + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last) + { + if(constant_time_size) + this->splice_after(prev_pos, x, before_first, before_last, std::distance(before_first, before_last)); + else + this->priv_splice_after + (prev_pos.pointed_node(), x, before_first.pointed_node(), before_last.pointed_node()); + } + + //! Requires: prev_pos must be a dereferenceable iterator in *this or be + //! before_begin(), and before_first and before_last belong to x and + //! ++before_first != x.end() && before_last != x.end() and + //! n == std::distance(before_first, before_last). + //! + //! Effects: Transfers the range (before_first, before_last] from list x to this + //! list, after the element pointed by p. No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last, difference_type n) + { + if(n){ + BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(before_first, before_last) == n); + this->priv_splice_after + (prev_pos.pointed_node(), x, before_first.pointed_node(), before_last.pointed_node()); + if(constant_time_size){ + this->priv_size_traits().set_size(this->priv_size_traits().get_size() + n); + x.priv_size_traits().set_size(x.priv_size_traits().get_size() - n); + } + } + } + + //! Requires: it is an iterator to an element in x. + //! + //! Effects: Transfers all the elements of list x to this list, before the + //! the element pointed by it. No destructors or copy constructors are called. + //! + //! Returns: The last element inserted of x or the previous element + //! of it if x is empty. + //! This iterator can be used as new "prev" iterator for a new splice call. + //! that will splice new values after the previously spliced values. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements contained in x plus linear to + //! the elements before it. + //! Linear to the elements before it if cache_last<> option is true. + //! Constant-time if cache_last<> option is true and it == end(). + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + iterator splice(const_iterator it, slist_impl &x) + { return this->splice_after(this->previous(it), x); } + + //! Requires: it p must be a valid iterator of *this. + //! elem must point to an element contained in list + //! x. + //! + //! Effects: Transfers the element elem, from list x to this list, + //! before the element pointed by pos. No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements before pos and before elem. + //! Linear to the elements before elem if cache_last<> option is true and pos == end(). + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice(const_iterator pos, slist_impl &x, const_iterator elem) + { return this->splice_after(this->previous(pos), x, x.previous(elem)); } + + //! Requires: pos must be a dereferenceable iterator in *this + //! and first and last belong to x and first and last a valid range on x. + //! + //! Effects: Transfers the range [first, last) from list x to this + //! list, before the element pointed by pos. + //! No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the sum of elements before pos, first, and last + //! plus linear to the number of elements transferred if constant_time_size is true. + //! Linear to the sum of elements before first, and last + //! plus linear to the number of elements transferred if constant_time_size is true + //! if cache_last<> is true and pos == end() + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last) + { return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last)); } + + //! Requires: pos must be a dereferenceable iterator in *this + //! and first and last belong to x and first and last a valid range on x. + //! n == std::distance(first, last). + //! + //! Effects: Transfers the range [first, last) from list x to this + //! list, before the element pointed by pos. + //! No destructors or copy constructors are called. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the sum of elements before pos, first, and last. + //! Linear to the sum of elements before first and last + //! if cache_last<> is true and pos == end(). + //! + //! Note: Iterators of values obtained from list x now point to elements of this + //! list. Iterators of this list and all the references are not invalidated. + void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last, difference_type n) + { return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last), n); } + + //! Effects: This function sorts the list *this according to std::less. + //! The sort is stable, that is, the relative order of equivalent elements is preserved. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the predicate throws. Basic guarantee. + //! + //! Complexity: The number of comparisons is approximately N log N, where N + //! is the list's size. + //! + //! Note: Iterators and references are not invalidated + template + void sort(Predicate p) + { + if (node_traits::get_next(node_traits::get_next(this->get_root_node())) + != this->get_root_node()) { + slist_impl carry; + slist_impl counter[64]; + int fill = 0; + const_iterator last_inserted; + while(!this->empty()){ + last_inserted = this->cbegin(); + carry.splice_after(carry.cbefore_begin(), *this, this->cbefore_begin()); + int i = 0; + while(i < fill && !counter[i].empty()) { + last_inserted = carry.merge(counter[i++], p); + } + BOOST_INTRUSIVE_INVARIANT_ASSERT(counter[i].empty()); + + node_ptr p = node_algorithms::get_previous_node + (last_inserted.pointed_node(), carry.cend().pointed_node()); + const_iterator last_element(p, this); + if(constant_time_size){ + counter[i].splice_after( counter[i].cbefore_begin(), carry + , carry.cbefore_begin(), last_element + , carry.size()); + } + else{ + counter[i].splice_after( counter[i].cbefore_begin(), carry + , carry.cbefore_begin(), last_element); + } + if(i == fill) + ++fill; + } + + for (int i = 1; i < fill; ++i) + last_inserted = counter[i].merge(counter[i-1], p); + BOOST_INTRUSIVE_INVARIANT_ASSERT(this->empty()); + + node_ptr p = node_algorithms::get_previous_node + (last_inserted.pointed_node(), counter[--fill].end().pointed_node()); + const_iterator last_element(p, this); + if(constant_time_size){ + this->splice_after( cbefore_begin(), counter[fill], counter[fill].cbefore_begin() + , last_element, counter[fill].size()); + } + else{ + this->splice_after( cbefore_begin(), counter[fill], counter[fill].cbefore_begin() + , last_element); + } + } + } + + //! Requires: p must be a comparison function that induces a strict weak + //! ordering and both *this and x must be sorted according to that ordering + //! The lists x and *this must be distinct. + //! + //! Effects: This function removes all of x's elements and inserts them + //! in order into *this. The merge is stable; that is, if an element from *this is + //! equivalent to one from x, then the element from *this will precede the one from x. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or std::less throws. Basic guarantee. + //! + //! Complexity: This function is linear time: it performs at most + //! size() + x.size() - 1 comparisons. + //! + //! Note: Iterators and references are not invalidated. + void sort() + { this->sort(std::less()); } + + //! Requires: p must be a comparison function that induces a strict weak + //! ordering and both *this and x must be sorted according to that ordering + //! The lists x and *this must be distinct. + //! + //! Effects: This function removes all of x's elements and inserts them + //! in order into *this. The merge is stable; that is, if an element from *this is + //! equivalent to one from x, then the element from *this will precede the one from x. + //! + //! Returns: An iterator to the last transferred value, end() is x is empty. + //! + //! Throws: If the predicate throws. Basic guarantee. + //! + //! Complexity: This function is linear time: it performs at most + //! size() + x.size() - 1 comparisons. + //! + //! Note: Iterators and references are not invalidated. + template + iterator merge(slist_impl& x, Predicate p) + { + const_iterator a(cbefore_begin()), e(cend()), ax(x.cbefore_begin()), ex(x.cend()); + const_iterator last_inserted(e); + const_iterator a_next; + while(++(a_next = a) != e && !x.empty()) { + const_iterator ix(ax); + const_iterator cx; + size_type n(0); + while(++(cx = ix) != ex && p(*cx, *a_next)){ + ++ix; ++n; + } + if(ax != ix){ + this->splice_after(a, x, ax, ix, n); + last_inserted = ix; + } + a = a_next; + } + if (!x.empty()){ + last_inserted = this->splice_after(a, x); + } + return last_inserted.unconst(); + } + + //! Effects: This function removes all of x's elements and inserts them + //! in order into *this according to std::less. The merge is stable; + //! that is, if an element from *this is equivalent to one from x, then the element + //! from *this will precede the one from x. + //! + //! Throws: if std::less throws. Basic guarantee. + //! + //! Complexity: This function is linear time: it performs at most + //! size() + x.size() - 1 comparisons. + //! + //! Note: Iterators and references are not invalidated + void merge(slist_impl& x) + { this->merge(x, std::less()); } + + //! Effects: Reverses the order of elements in the list. + //! + //! Throws: Nothing. + //! + //! Complexity: This function is linear to the contained elements. + //! + //! Note: Iterators and references are not invalidated + void reverse() + { + if(cache_last && !this->empty()){ + this->set_last_node(node_traits::get_next(this->get_root_node())); + } + this->priv_reverse(detail::bool_()); + } + + //! Effects: Removes all the elements that compare equal to value. + //! No destructors are called. + //! + //! Throws: If std::equal_to throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() comparisons for equality. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. This function is + //! linear time: it performs exactly size() comparisons for equality. + void remove(const_reference value) + { this->remove_if(detail::equal_to_value(value)); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes all the elements that compare equal to value. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If std::equal_to throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() comparisons for equality. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void remove_and_dispose(const_reference value, Disposer disposer) + { this->remove_and_dispose_if(detail::equal_to_value(value), disposer); } + + //! Effects: Removes all the elements for which a specified + //! predicate is satisfied. No destructors are called. + //! + //! Throws: If pred throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() calls to the predicate. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void remove_if(Pred pred) + { this->remove_and_dispose_if(pred, detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes all the elements for which a specified + //! predicate is satisfied. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If pred throws. Basic guarantee. + //! + //! Complexity: Linear time. It performs exactly size() comparisons for equality. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void remove_and_dispose_if(Pred pred, Disposer disposer) + { + const_iterator bcur(this->before_begin()), cur(this->begin()), e(this->end()); + + while(cur != e){ + if (pred(*cur)){ + cur = this->erase_after_and_dispose(bcur, disposer); + } + else{ + bcur = cur; + ++cur; + } + } + if(cache_last){ + this->set_last_node(bcur.pointed_node()); + } + } + + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that are equal from the list. No destructors are called. + //! + //! Throws: If std::equal_to throws. Basic guarantee. + //! + //! Complexity: Linear time (size()-1) comparisons calls to pred()). + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + void unique() + { this->unique_and_dispose(std::equal_to(), detail::null_disposer()); } + + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that satisfy some binary predicate from the list. + //! No destructors are called. + //! + //! Throws: If the predicate throws. Basic guarantee. + //! + //! Complexity: Linear time (size()-1) comparisons equality comparisons. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void unique(BinaryPredicate pred) + { this->unique_and_dispose(pred, detail::null_disposer()); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that satisfy some binary predicate from the list. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If std::equal_to throws. Basic guarantee. + //! + //! Complexity: Linear time (size()-1) comparisons equality comparisons. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void unique_and_dispose(Disposer disposer) + { this->unique(std::equal_to(), disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Removes adjacent duplicate elements or adjacent + //! elements that satisfy some binary predicate from the list. + //! Disposer::operator()(pointer) is called for every removed element. + //! + //! Throws: If the predicate throws. Basic guarantee. + //! + //! Complexity: Linear time (size()-1) comparisons equality comparisons. + //! + //! Note: The relative order of elements that are not removed is unchanged, + //! and iterators to elements that are not removed remain valid. + template + void unique_and_dispose(BinaryPredicate pred, Disposer disposer) + { + const_iterator end_n(this->cend()); + const_iterator bcur(this->cbegin()); + if(bcur != end_n){ + const_iterator cur(bcur); + ++cur; + while(cur != end_n) { + if (pred(*bcur, *cur)){ + cur = this->erase_after_and_dispose(bcur, disposer); + } + else{ + bcur = cur; + ++cur; + } + } + if(cache_last){ + this->set_last_node(bcur.pointed_node()); + } + } + } + + //! Requires: value must be a reference to a value inserted in a list. + //! + //! Effects: This function returns a const_iterator pointing to the element + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + //! This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + //BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value))); + return iterator (value_traits::to_node_ptr(value), 0); + } + + //! Requires: value must be a const reference to a value inserted in a list. + //! + //! Effects: This function returns an iterator pointing to the element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + //! This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + //BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(const_cast (value)))); + return const_iterator (value_traits::to_node_ptr(const_cast (value)), 0); + } + + //! Requires: value must be a reference to a value inserted in a list. + //! + //! Effects: This function returns a const_iterator pointing to the element + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + iterator iterator_to(reference value) + { + //BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(value))); + return iterator (value_traits::to_node_ptr(value), this); + } + + //! Requires: value must be a const reference to a value inserted in a list. + //! + //! Effects: This function returns an iterator pointing to the element. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: Iterators and references are not invalidated. + const_iterator iterator_to(const_reference value) const + { + //BOOST_INTRUSIVE_INVARIANT_ASSERT (!node_algorithms::inited(value_traits::to_node_ptr(const_cast (value)))); + return const_iterator (value_traits::to_node_ptr(const_cast (value)), this); + } + + //! Returns: The iterator to the element before i in the list. + //! Returns the end-iterator, if either i is the begin-iterator or the + //! list is empty. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements before i. + //! Constant if cache_last<> is true and i == end(). + iterator previous(iterator i) + { + if(cache_last && (i.pointed_node() == this->get_end_node())){ + return iterator(this->get_last_node(), this); + } + return iterator + (node_algorithms::get_previous_node + (this->before_begin().pointed_node(), i.pointed_node()), this); + } + + //! Returns: The const_iterator to the element before i in the list. + //! Returns the end-const_iterator, if either i is the begin-const_iterator or + //! the list is empty. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the number of elements before i. + //! Constant if cache_last<> is true and i == end(). + const_iterator previous(const_iterator i) const + { + if(cache_last && (i.pointed_node() == this->get_end_node())){ + return const_iterator(uncast(this->get_last_node()), this); + } + return const_iterator + (node_algorithms::get_previous_node + (this->before_begin().pointed_node(), i.pointed_node()), this); + } + + private: + void priv_splice_after(node_ptr prev_pos_n, slist_impl &x, node_ptr before_first_n, node_ptr before_last_n) + { + if (before_first_n != before_last_n && prev_pos_n != before_first_n && prev_pos_n != before_last_n) + { + if(cache_last){ + if(node_traits::get_next(prev_pos_n) == this->get_end_node()){ + this->set_last_node(before_last_n); + } + if(node_traits::get_next(before_last_n) == x.get_end_node()){ + x.set_last_node(before_first_n); + } + } + node_algorithms::transfer_after(prev_pos_n, before_first_n, before_last_n); + } + } + + void priv_reverse(detail::bool_) + { node_algorithms::reverse(this->get_root_node()); } + + void priv_reverse(detail::bool_) + { + node_ptr new_first = node_algorithms::reverse + (node_traits::get_next(this->get_root_node())); + node_traits::set_next(this->get_root_node(), new_first); + } + + void priv_shift_backwards(size_type n, detail::bool_) + { + node_ptr last = node_algorithms::move_forward(this->get_root_node(), (std::size_t)n); + if(cache_last && last){ + this->set_last_node(last); + } + } + + void priv_shift_backwards(size_type n, detail::bool_) + { + std::pair ret( + node_algorithms::move_first_n_forward + (node_traits::get_next(this->get_root_node()), (std::size_t)n)); + if(ret.first){ + node_traits::set_next(this->get_root_node(), ret.first); + if(cache_last){ + this->set_last_node(ret.second); + } + } + } + + void priv_shift_forward(size_type n, detail::bool_) + { + node_ptr last = node_algorithms::move_backwards(this->get_root_node(), (std::size_t)n); + if(cache_last && last){ + this->set_last_node(last); + } + } + + void priv_shift_forward(size_type n, detail::bool_) + { + std::pair ret( + node_algorithms::move_first_n_backwards + (node_traits::get_next(this->get_root_node()), (std::size_t)n)); + if(ret.first){ + node_traits::set_next(this->get_root_node(), ret.first); + if(cache_last){ + this->set_last_node(ret.second); + } + } + } + + void priv_swap_cache_last(slist_impl &other) + { + node_ptr other_last(other.get_last_node()); + node_ptr this_last(this->get_last_node()); + node_ptr other_bfirst(other.get_root_node()); + node_ptr this_bfirst(this->get_root_node()); + node_algorithms::transfer_after(this_bfirst, other_bfirst, other_last); + node_algorithms::transfer_after(other_bfirst, other_last != other_bfirst? other_last : this_bfirst, this_last); + node_ptr tmp(this->get_last_node()); + this->set_last_node(other.get_last_node()); + other.set_last_node(tmp); + if(this->get_last_node() == other_bfirst){ + this->set_last_node(this_bfirst); + } + if(other.get_last_node() == this_bfirst){ + other.set_last_node(other_bfirst); + } + } + + //circular version + static void priv_swap_lists(node_ptr this_node, node_ptr other_node, detail::bool_) + { node_algorithms::swap_nodes(this_node, other_node); } + + //linear version + static void priv_swap_lists(node_ptr this_node, node_ptr other_node, detail::bool_) + { node_algorithms::swap_trailing_nodes(this_node, other_node); } + + static slist_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) + { + //Obtaining the container from the end iterator is not possible with linear + //singly linked lists (because "end" is represented by the null pointer) + BOOST_STATIC_ASSERT(!linear); + root_plus_size *r = detail::parent_from_member + ( detail::get_pointer(end_iterator.pointed_node()), (&root_plus_size::root_)); + data_t *d = detail::parent_from_member + ( r, &data_t::root_plus_size_); + slist_impl *s = detail::parent_from_member(d, &slist_impl::data_); + return *s; + } +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator< +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const slist_impl &x, const slist_impl &y) +#else +(const slist_impl &x, const slist_impl &y) +#endif +{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +bool operator== +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const slist_impl &x, const slist_impl &y) +#else +(const slist_impl &x, const slist_impl &y) +#endif +{ + typedef slist_impl slist_type; + typedef typename slist_type::const_iterator const_iterator; + const bool C = slist_type::constant_time_size; + if(C && x.size() != y.size()){ + return false; + } + const_iterator end1 = x.end(); + + const_iterator i1 = x.begin(); + const_iterator i2 = y.begin(); + if(C){ + while (i1 != end1 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1; + } + else{ + const_iterator end2 = y.end(); + while (i1 != end1 && i2 != end2 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1 && i2 == end2; + } +} + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const slist_impl &x, const slist_impl &y) +#else +(const slist_impl &x, const slist_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const slist_impl &x, const slist_impl &y) +#else +(const slist_impl &x, const slist_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const slist_impl &x, const slist_impl &y) +#else +(const slist_impl &x, const slist_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const slist_impl &x, const slist_impl &y) +#else +(const slist_impl &x, const slist_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(slist_impl &x, slist_impl &y) +#else +(slist_impl &x, slist_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c slist that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_slist +{ + /// @cond + typedef typename pack_options + < slist_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4, O5 + #else + Options... + #endif + >::type packed_options; + typedef typename detail::get_value_traits + ::type value_traits; + typedef slist_impl + < + slistopt + < value_traits + , typename packed_options::size_type + , packed_options::constant_time_size + , packed_options::linear + , packed_options::cache_last + > + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class slist + : public make_slist::type +{ + typedef typename make_slist + ::type Base; + typedef typename Base::real_value_traits real_value_traits; + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + public: + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + slist(const value_traits &v_traits = value_traits()) + : Base(v_traits) + {} + + template + slist(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) + : Base(b, e, v_traits) + {} + + static slist &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const slist &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SLIST_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/slist_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/slist_hook.hpp new file mode 100644 index 0000000000..8164d6283e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/slist_hook.hpp @@ -0,0 +1,292 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_SLIST_HOOK_HPP +#define BOOST_INTRUSIVE_SLIST_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +template +struct get_slist_node_algo +{ + typedef circular_slist_algorithms > type; +}; + +/// @endcond + +//! Helper metafunction to define a \c slist_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_slist_base_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_slist_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::SlistBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from slist_base_hook in order to store objects in +//! in an list. slist_base_hook holds the data necessary to maintain the +//! list and provides an appropriate value_traits class for list. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<> and +//! \c link_mode<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! unique tag. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class slist_base_hook + : public make_slist_base_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + slist_base_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + slist_base_hook(const slist_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + slist_base_hook& operator=(const slist_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in an slist an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~slist_base_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(slist_base_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c slist::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +//! Helper metafunction to define a \c slist_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_slist_member_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_slist_node_algo + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Put a public data member slist_member_hook in order to store objects of this class in +//! an list. slist_member_hook holds the data necessary for maintaining the list and +//! provides an appropriate value_traits class for list. +//! +//! The hook admits the following options: \c void_pointer<> and +//! \c link_mode<>. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class slist_member_hook + : public make_slist_member_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + slist_member_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + slist_member_hook(const slist_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + slist_member_hook& operator=(const slist_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in an slist an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~slist_member_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(slist_member_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c slist::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SLIST_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splay_set.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splay_set.hpp new file mode 100644 index 0000000000..f86ae8b93f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splay_set.hpp @@ -0,0 +1,2336 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_SPLAY_SET_HPP +#define BOOST_INTRUSIVE_SPLAY_SET_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! The class template splay_set is an intrusive container, that mimics most of +//! the interface of std::set as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class splay_set_impl +{ + /// @cond + typedef splaytree_impl tree_type; + //! This class is + //! non-copyable + splay_set_impl (const splay_set_impl&); + + //! This class is + //! non-assignable + splay_set_impl &operator =(const splay_set_impl&); + + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor of the value_compare object throws. + splay_set_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty splay_set and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise amortized N * log N, where N is std::distance(last, first). + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + splay_set_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(true, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the splay_set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~splay_set_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of splay_set. + //! + //! Effects: Returns a const reference to the splay_set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static splay_set_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &splay_set_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of splay_set. + //! + //! Effects: Returns a const reference to the splay_set associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const splay_set_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &splay_set_impl::tree_); + } + + //! Precondition: it must be a valid iterator of set. + //! + //! Effects: Returns a reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static splay_set_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &splay_set_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of set. + //! + //! Effects: Returns a const reference to the set associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const splay_set_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &splay_set_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the splay_set. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the splay_set. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two splay_sets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(splay_set_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const splay_set_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to inserts value into the splay_set. + //! + //! Returns: If the value + //! is not already present inserts it and returns a pair containing the + //! iterator to the new value and true. If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert(reference value) + { return tree_.insert_unique(value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to to insert x into the splay_set, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: An iterator that points to the position where the + //! new element was inserted into the splay_set. + //! + //! Complexity: Amortized logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_unique(hint, value); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an arbitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the splay_set, using + //! a user provided key instead of the value itself. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that + //! part to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the splay_set. + template + std::pair insert_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(key, key_value_comp, commit_data); } + + //! Requires: key_value_comp must be a comparison function that induces + //! the same strict weak ordering as value_compare. The difference is that + //! key_value_comp compares an arbitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the splay_set, using + //! a user provided key instead of the value itself, using "hint" + //! as a hint to where it will be inserted. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Amortized logarithmic in general, but it's amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the key_value_comp ordering function throws. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! constructing that is used to impose the order is much cheaper to construct + //! than the value_type and this function offers the possibility to use that key + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. This can give a total + //! constant-time complexity to the insertion: check(O(1)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the splay_set. + template + std::pair insert_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { return tree_.insert_unique_check(hint, key, key_value_comp, commit_data); } + + //! Requires: value must be an lvalue of type value_type. commit_data + //! must have been obtained from a previous call to "insert_check". + //! No objects should have been inserted or erased from the splay_set between + //! the "insert_check" that filled "commit_data" and the call to "insert_commit". + //! + //! Effects: Inserts the value in the splay_set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Returns: An iterator to the newly inserted object. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + iterator insert_commit(reference value, const insert_commit_data &commit_data) + { return tree_.insert_unique_commit(value, commit_data); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the splay_set. + //! + //! Complexity: Insert range is amortized O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_unique(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is amortized + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size()) + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + this->count(key, comp)). + //! + //! Throws: If the comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is at most + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: If the internal value_compare ordering function throws. + //! + //! Complexity: Amortized O(log(size() + this->count(value)). Basic guarantee. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) + { return tree_.find(value) != end(); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp) != end(); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count_dont_splay(const_reference value)const + { return tree_.find_dont_splay(value) != end(); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count_dont_splay(const KeyType& key, KeyValueCompare comp)const + { return tree_.find_dont_splay(key, comp) != end(); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound_dont_splay(const_reference value) const + { return tree_.lower_bound_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound_dont_splay(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound_dont_splay(const_reference value) const + { return tree_.upper_bound_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound_dont_splay(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find_dont_splay(const_reference value) const + { return tree_.find_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.find_dont_splay(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range_dont_splay(const_reference value) const + { return tree_.equal_range_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range_dont_splay(key, comp); } + + //! Requires: value must be an lvalue and shall be in a splay_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the splay_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a splay_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! splay_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a splay_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the splay_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a splay_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! splay_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a splay_set/multisplay_set. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + //! Requires: i must be a valid iterator of *this. + //! + //! Effects: Rearranges the splay set so that the element pointed by i + //! is placed as the root of the tree, improving future searches of this value. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + void splay_up(iterator i) + { tree_.splay_up(i); } + + //! Effects: Rearranges the splay set so that if *this stores an element + //! with a key equivalent to value the element is placed as the root of the + //! tree. If the element is not present returns the last node compared with the key. + //! If the tree is empty, end() is returned. + //! + //! Complexity: Amortized logarithmic. + //! + //! Returns: An iterator to the new root of the tree, end() if the tree is empty. + //! + //! Throws: If the comparison functor throws. + template + iterator splay_down(const KeyType &key, KeyNodePtrCompare comp) + { return tree_.splay_down(key, comp); } + + //! Effects: Rearranges the splay set so that if *this stores an element + //! with a key equivalent to value the element is placed as the root of the + //! tree. + //! + //! Complexity: Amortized logarithmic. + //! + //! Returns: An iterator to the new root of the tree, end() if the tree is empty. + //! + //! Throws: If the predicate throws. + iterator splay_down(const value_type &value) + { return tree_.splay_down(value); } + + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + void rebalance() + { tree_.rebalance(); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + iterator rebalance_subtree(iterator root) + { return tree_.rebalance_subtree(root); } + + /// @cond + friend bool operator==(const splay_set_impl &x, const splay_set_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const splay_set_impl &x, const splay_set_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_set_impl &x, const splay_set_impl &y) +#else +(const splay_set_impl &x, const splay_set_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_set_impl &x, const splay_set_impl &y) +#else +(const splay_set_impl &x, const splay_set_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_set_impl &x, const splay_set_impl &y) +#else +(const splay_set_impl &x, const splay_set_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_set_impl &x, const splay_set_impl &y) +#else +(const splay_set_impl &x, const splay_set_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(splay_set_impl &x, splay_set_impl &y) +#else +(splay_set_impl &x, splay_set_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c splay_set that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_splay_set +{ + /// @cond + typedef splay_set_impl + < typename make_splaytree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class splay_set + : public make_splay_set::type +{ + typedef typename make_splay_set + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + splay_set( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + splay_set( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static splay_set &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const splay_set &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static splay_set &container_from_iterator(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const splay_set &container_from_iterator(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + +//! The class template splay_multiset is an intrusive container, that mimics most of +//! the interface of std::multiset as described in the C++ standard. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class splay_multiset_impl +{ + /// @cond + typedef splaytree_impl tree_type; + + //Non-copyable and non-assignable + splay_multiset_impl (const splay_multiset_impl&); + splay_multiset_impl &operator =(const splay_multiset_impl&); + typedef tree_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::value_compare value_compare; + typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::reverse_iterator reverse_iterator; + typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + tree_type tree_; + /// @endcond + + public: + //! Effects: Constructs an empty splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + splay_multiset_impl( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(cmp, v_traits) + {} + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty splay_multiset and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise amortized N * log N, where N is the distance between first and last. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor/operator() of the value_compare object throws. + template + splay_multiset_impl( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : tree_(false, b, e, cmp, v_traits) + {} + + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~splay_multiset_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return tree_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return tree_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return tree_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return tree_.cend(); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return tree_.rbegin(); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return tree_.crbegin(); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return tree_.rend(); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return tree_.crend(); } + + //! Precondition: end_iterator must be a valid end iterator + //! of splay_multiset. + //! + //! Effects: Returns a const reference to the splay_multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static splay_multiset_impl &container_from_end_iterator(iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &splay_multiset_impl::tree_); + } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of splay_multiset. + //! + //! Effects: Returns a const reference to the splay_multiset associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const splay_multiset_impl &container_from_end_iterator(const_iterator end_iterator) + { + return *detail::parent_from_member + ( &tree_type::container_from_end_iterator(end_iterator) + , &splay_multiset_impl::tree_); + } + + //! Precondition: it must be a valid iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static splay_multiset_impl &container_from_iterator(iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &splay_multiset_impl::tree_); + } + + //! Precondition: it must be a valid const_iterator of multiset. + //! + //! Effects: Returns a const reference to the multiset associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const splay_multiset_impl &container_from_iterator(const_iterator it) + { + return *detail::parent_from_member + ( &tree_type::container_from_iterator(it) + , &splay_multiset_impl::tree_); + } + + //! Effects: Returns the key_compare object used by the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If key_compare copy-constructor throws. + key_compare key_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns the value_compare object used by the splay_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return tree_.value_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return tree_.empty(); } + + //! Effects: Returns the number of elements stored in the splay_multiset. + //! + //! Complexity: Linear to elements contained in *this if, + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return tree_.size(); } + + //! Effects: Swaps the contents of two splay_multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison functor + //! found using ADL throws. Strong guarantee. + void swap(splay_multiset_impl& other) + { tree_.swap(other.tree_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const splay_multiset_impl &src, Cloner cloner, Disposer disposer) + { tree_.clone_from(src.tree_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the splay_multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(reference value) + { return tree_.insert_equal(this->end(), value); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts x into the splay_multiset, using pos as a hint to + //! where it will be inserted. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Amortized logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: If the internal value_compare ordering function throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(const_iterator hint, reference value) + { return tree_.insert_equal(hint, value); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a range into the splay_multiset. + //! + //! Returns: An iterator that points to the position where the new + //! element was inserted. + //! + //! Complexity: Insert range is amortized O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { tree_.insert_equal(b, e); } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity is constant time. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { return tree_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Complexity: Average complexity for erase range is amortized + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { return tree_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return tree_.erase(value); } + + //! Effects: Erases all the elements that compare equal with + //! the given key and the given comparison functor. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { return tree_.erase(key, comp); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased element. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { return tree_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Returns: An iterator to the element after the erased elements. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is amortized + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { return tree_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + this->count(value)). + //! + //! Throws: If the internal value_compare ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return tree_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + this->count(key, comp)). + //! + //! Throws: If comp ordering function throws. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { return tree_.erase_and_dispose(key, comp, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return tree_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return tree_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count(const_reference value) + { return tree_.count(value); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count(const KeyType& key, KeyValueCompare comp) + { return tree_.count(key, comp); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If the internal value_compare ordering function throws. + size_type count_dont_splay(const_reference value) const + { return tree_.count_dont_splay(value); } + + //! Effects: Returns the number of contained elements with the same key + //! compared with the given comparison functor. + //! + //! Complexity: Logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: If comp ordering function throws. + template + size_type count_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.count_dont_splay(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator lower_bound(const_reference value) + { return tree_.lower_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator lower_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.lower_bound(key, comp); } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator lower_bound_dont_splay(const_reference value) const + { return tree_.lower_bound_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is not less than k or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator lower_bound_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.lower_bound_dont_splay(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator upper_bound(const_reference value) + { return tree_.upper_bound(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns an iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator upper_bound(const KeyType& key, KeyValueCompare comp) + { return tree_.upper_bound(key, comp); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator upper_bound_dont_splay(const_reference value) const + { return tree_.upper_bound_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Returns a const_iterator to the first element whose + //! key according to the comparison functor is greater than key or + //! end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator upper_bound_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.upper_bound_dont_splay(key, comp); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + iterator find(const_reference value) + { return tree_.find(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyValueCompare comp) + { return tree_.find(key, comp); } + + //! Effects: Finds a const_iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + const_iterator find_dont_splay(const_reference value) const + { return tree_.find_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" according to the comparison functor or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.find_dont_splay(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair equal_range(const_reference value) + { return tree_.equal_range(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyValueCompare comp) + { return tree_.equal_range(key, comp); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If the internal value_compare ordering function throws. + std::pair + equal_range_dont_splay(const_reference value) const + { return tree_.equal_range_dont_splay(value); } + + //! Requires: comp must imply the same element order as + //! value_compare. Usually key is the part of the value_type + //! that is used in the ordering functor. + //! + //! Effects: Finds a range containing all elements whose key is k + //! according to the comparison functor or an empty range + //! that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If comp ordering function throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range_dont_splay(const KeyType& key, KeyValueCompare comp) const + { return tree_.equal_range_dont_splay(key, comp); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { return tree_type::s_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return tree_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return tree_.iterator_to(value); } + + //! Requires: value shall not be in a set/splay_multiset. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { tree_type::init_node(value); } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { return tree_.unlink_leftmost_without_rebalance(); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { tree_.replace_node(replace_this, with_this); } + + //! Requires: i must be a valid iterator of *this. + //! + //! Effects: Rearranges the splay set so that the element pointed by i + //! is placed as the root of the tree, improving future searches of this value. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + void splay_up(iterator i) + { tree_.splay_up(i); } + + //! Effects: Rearranges the splay set so that if *this stores an element + //! with a key equivalent to value the element is placed as the root of the + //! tree. If the element is not present returns the last node compared with the key. + //! If the tree is empty, end() is returned. + //! + //! Complexity: Amortized logarithmic. + //! + //! Returns: An iterator to the new root of the tree, end() if the tree is empty. + //! + //! Throws: If the comparison functor throws. + template + iterator splay_down(const KeyType &key, KeyNodePtrCompare comp) + { return tree_.splay_down(key, comp); } + + //! Effects: Rearranges the splay set so that if *this stores an element + //! with a key equivalent to value the element is placed as the root of the + //! tree. + //! + //! Complexity: Amortized logarithmic. + //! + //! Returns: An iterator to the new root of the tree, end() if the tree is empty. + //! + //! Throws: If the predicate throws. + iterator splay_down(const value_type &value) + { return tree_.splay_down(value); } + + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + void rebalance() + { tree_.rebalance(); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + iterator rebalance_subtree(iterator root) + { return tree_.rebalance_subtree(root); } + + /// @cond + friend bool operator==(const splay_multiset_impl &x, const splay_multiset_impl &y) + { return x.tree_ == y.tree_; } + + friend bool operator<(const splay_multiset_impl &x, const splay_multiset_impl &y) + { return x.tree_ < y.tree_; } + /// @endcond +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#else +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#else +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#else +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#else +(const splay_multiset_impl &x, const splay_multiset_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(splay_multiset_impl &x, splay_multiset_impl &y) +#else +(splay_multiset_impl &x, splay_multiset_impl &y) +#endif +{ x.swap(y); } + +//! Helper metafunction to define a \c splay_multiset that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_splay_multiset +{ + /// @cond + typedef splay_multiset_impl + < typename make_splaytree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class splay_multiset + : public make_splay_multiset::type +{ + typedef typename make_splay_multiset + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + splay_multiset( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + splay_multiset( Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(b, e, cmp, v_traits) + {} + + static splay_multiset &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const splay_multiset &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static splay_multiset &container_from_iterator(iterator it) + { return static_cast(Base::container_from_iterator(it)); } + + static const splay_multiset &container_from_iterator(const_iterator it) + { return static_cast(Base::container_from_iterator(it)); } +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SPLAY_SET_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splay_set_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splay_set_hook.hpp new file mode 100644 index 0000000000..17f18bc252 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splay_set_hook.hpp @@ -0,0 +1,290 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_SPLAY_SET_HOOK_HPP +#define BOOST_INTRUSIVE_SPLAY_SET_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +template +struct get_splay_set_node_algo +{ + typedef splaytree_algorithms > type; +}; +/// @endcond + +//! Helper metafunction to define a \c splay_set_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_splay_set_base_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_splay_set_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::SplaySetBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from splay_set_base_hook in order to store objects in +//! in a splay_set/splay_multiset. splay_set_base_hook holds the data necessary to maintain +//! the splay_set/splay_multiset and provides an appropriate value_traits class for splay_set/splay_multiset. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<>, +//! \c link_mode<> and \c optimize_size<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! unique tag. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class splay_set_base_hook + : public make_splay_set_base_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + splay_set_base_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + splay_set_base_hook(const splay_set_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + splay_set_base_hook& operator=(const splay_set_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~splay_set_base_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(splay_set_base_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +//! Helper metafunction to define a \c splay_set_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_splay_set_member_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_splay_set_node_algo + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Put a public data member splay_set_member_hook in order to store objects of this +//! class in a splay_set/splay_multiset. splay_set_member_hook holds the data +//! necessary for maintaining the splay_set/splay_multiset and provides an appropriate +//! value_traits class for splay_set/splay_multiset. +//! +//! The hook admits the following options: \c void_pointer<>, +//! \c link_mode<> and \c optimize_size<>. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class splay_set_member_hook + : public make_splay_set_member_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + splay_set_member_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + splay_set_member_hook(const splay_set_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + splay_set_member_hook& operator=(const splay_set_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in a set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~splay_set_member_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(splay_set_member_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SPLAY_SET_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splaytree.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splaytree.hpp new file mode 100644 index 0000000000..94a098557d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splaytree.hpp @@ -0,0 +1,1558 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_SPLAYTREE_HPP +#define BOOST_INTRUSIVE_SPLAYTREE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost { +namespace intrusive { + +/// @cond + +template +struct splaysetopt +{ + typedef ValueTraits value_traits; + typedef Compare compare; + typedef SizeType size_type; + static const bool constant_time_size = ConstantTimeSize; +}; + +template +struct splay_set_defaults + : pack_options + < none + , base_hook + , constant_time_size + , size_type + , compare > + >::type +{}; + +/// @endcond + +//! The class template splaytree is an intrusive splay tree container that +//! is used to construct intrusive splay_set and splay_multiset containers. The no-throw +//! guarantee holds only, if the value_compare object +//! doesn't throw. +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<> and +//! \c compare<>. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class splaytree_impl +{ + public: + typedef typename Config::value_traits value_traits; + /// @cond + static const bool external_value_traits = + detail::external_value_traits_is_true::value; + typedef typename detail::eval_if_c + < external_value_traits + , detail::eval_value_traits + , detail::identity + >::type real_value_traits; + /// @endcond + typedef typename real_value_traits::pointer pointer; + typedef typename real_value_traits::const_pointer const_pointer; + typedef typename std::iterator_traits::value_type value_type; + typedef value_type key_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename Config::size_type size_type; + typedef typename Config::compare value_compare; + typedef value_compare key_compare; + typedef tree_iterator iterator; + typedef tree_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef typename real_value_traits::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + typedef splaytree_algorithms node_algorithms; + + static const bool constant_time_size = Config::constant_time_size; + static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; + + /// @cond + private: + typedef detail::size_holder size_traits; + + //noncopyable + splaytree_impl (const splaytree_impl&); + splaytree_impl operator =(const splaytree_impl&); + + enum { safemode_or_autounlink = + (int)real_value_traits::link_mode == (int)auto_unlink || + (int)real_value_traits::link_mode == (int)safe_link }; + + //Constant-time size is incompatible with auto-unlink hooks! + BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink))); + + struct header_plus_size : public size_traits + { node header_; }; + + struct node_plus_pred_t : public detail::ebo_functor_holder + { + node_plus_pred_t(const value_compare &comp) + : detail::ebo_functor_holder(comp) + {} + header_plus_size header_plus_size_; + }; + + struct data_t : public splaytree_impl::value_traits + { + typedef typename splaytree_impl::value_traits value_traits; + data_t(const value_compare & comp, const value_traits &val_traits) + : value_traits(val_traits), node_plus_pred_(comp) + {} + node_plus_pred_t node_plus_pred_; + } data_; + + const value_compare &priv_comp() const + { return data_.node_plus_pred_.get(); } + + value_compare &priv_comp() + { return data_.node_plus_pred_.get(); } + + const node &priv_header() const + { return data_.node_plus_pred_.header_plus_size_.header_; } + + node &priv_header() + { return data_.node_plus_pred_.header_plus_size_.header_; } + + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(detail::get_pointer(ptr))); + } + + size_traits &priv_size_traits() + { return data_.node_plus_pred_.header_plus_size_; } + + const size_traits &priv_size_traits() const + { return data_.node_plus_pred_.header_plus_size_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_; } + + const real_value_traits &get_real_value_traits(detail::bool_) const + { return data_.get_value_traits(*this); } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_; } + + real_value_traits &get_real_value_traits(detail::bool_) + { return data_.get_value_traits(*this); } + + /// @endcond + + public: + + const real_value_traits &get_real_value_traits() const + { return this->get_real_value_traits(detail::bool_()); } + + real_value_traits &get_real_value_traits() + { return this->get_real_value_traits(detail::bool_()); } + + typedef typename node_algorithms::insert_commit_data insert_commit_data; + + //! Effects: Constructs an empty tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + splaytree_impl( value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + } + + //! Requires: Dereferencing iterator must yield an lvalue of type value_type. + //! cmp must be a comparison function that induces a strict weak ordering. + //! + //! Effects: Constructs an empty tree and inserts elements from + //! [b, e). + //! + //! Complexity: Linear in N if [b, e) is already sorted using + //! comp and otherwise amortized N * log N, where N is the distance between first and last. + //! + //! Throws: Nothing unless the copy constructor of the value_compare object throws. + template + splaytree_impl( bool unique, Iterator b, Iterator e + , value_compare cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : data_(cmp, v_traits) + { + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(size_type(0)); + if(unique) + this->insert_unique(b, e); + else + this->insert_equal(b, e); + } + + //! Effects: Detaches all elements from this. The objects in the set + //! are not deleted (i.e. no destructors are called), but the nodes according to + //! the value_traits template parameter are reinitialized and thus can be reused. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + ~splaytree_impl() + { this->clear(); } + + //! Effects: Returns an iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator begin() + { return iterator(node_algorithms::begin_node(&priv_header()), this); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator begin() const + { return cbegin(); } + + //! Effects: Returns a const_iterator pointing to the beginning of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return const_iterator(node_algorithms::begin_node(&priv_header()), this); } + + //! Effects: Returns an iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return iterator (node_ptr(&priv_header()), this); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return cend(); } + + //! Effects: Returns a const_iterator pointing to the end of the tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return const_iterator (uncast(const_node_ptr(&priv_header())), this); } + + //! Effects: Returns a reverse_iterator pointing to the beginning of the + //! reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rbegin() + { return reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a const_reverse_iterator pointing to the beginning + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crbegin() const + { return const_reverse_iterator(end()); } + + //! Effects: Returns a reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + reverse_iterator rend() + { return reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + + //! Effects: Returns a const_reverse_iterator pointing to the end + //! of the reversed tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_reverse_iterator crend() const + { return const_reverse_iterator(begin()); } + + //! Precondition: end_iterator must be a valid end iterator + //! of splaytree. + //! + //! Effects: Returns a const reference to the splaytree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static splaytree_impl &container_from_end_iterator(iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: end_iterator must be a valid end const_iterator + //! of splaytree. + //! + //! Effects: Returns a const reference to the splaytree associated to the end iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Constant. + static const splaytree_impl &container_from_end_iterator(const_iterator end_iterator) + { return priv_container_from_end_iterator(end_iterator); } + + //! Precondition: it must be a valid iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static splaytree_impl &container_from_iterator(iterator it) + { return priv_container_from_iterator(it); } + + //! Precondition: it must be a valid end const_iterator + //! of rbtree. + //! + //! Effects: Returns a const reference to the tree associated to the iterator + //! + //! Throws: Nothing. + //! + //! Complexity: Logarithmic. + static const splaytree_impl &container_from_iterator(const_iterator it) + { return priv_container_from_iterator(it); } + + //! Effects: Returns the value_compare object used by the tree. + //! + //! Complexity: Constant. + //! + //! Throws: If value_compare copy-constructor throws. + value_compare value_comp() const + { return priv_comp(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bool empty() const + { return this->cbegin() == this->cend(); } + + //! Effects: Returns the number of elements stored in the tree. + //! + //! Complexity: Linear to elements contained in *this. + //! + //! Throws: Nothing. + size_type size() const + { + if(constant_time_size){ + return this->priv_size_traits().get_size(); + } + else{ + return (size_type)node_algorithms::size(const_node_ptr(&priv_header())); + } + } + + //! Effects: Swaps the contents of two multisets. + //! + //! Complexity: Constant. + //! + //! Throws: If the comparison functor's swap call throws. + void swap(splaytree_impl& other) + { + //This can throw + using std::swap; + swap(priv_comp(), priv_comp()); + //These can't throw + node_algorithms::swap_tree(node_ptr(&priv_header()), node_ptr(&other.priv_header())); + if(constant_time_size){ + size_type backup = this->priv_size_traits().get_size(); + this->priv_size_traits().set_size(other.priv_size_traits().get_size()); + other.priv_size_traits().set_size(backup); + } + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree before the lower bound. + //! + //! Complexity: Average complexity for insert element is amortized + //! logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + return iterator(node_algorithms::insert_equal_lower_bound + (node_ptr(&priv_header()), to_insert, key_node_comp), this); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator. + //! + //! Effects: Inserts x into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case) + //! + //! Complexity: Amortized logarithmic in general, but it is amortized + //! constant time if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_equal(const_iterator hint, reference value) + { + detail::key_nodeptr_comp + key_node_comp(priv_comp(), this); + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + return iterator(node_algorithms::insert_equal + (node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Inserts a each element of a range into the tree + //! before the upper bound of the key of each element. + //! + //! Complexity: Insert range is in general amortized O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_equal(Iterator b, Iterator e) + { + if(this->empty()){ + iterator end(this->end()); + for (; b != e; ++b) + this->insert_equal(end, *b); + } + } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the tree if the value + //! is not already present. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert_unique(reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(value, commit_data); + if(!ret.second) + return ret; + return std::pair (insert_unique_commit(value, commit_data), true); + } + + //! Requires: value must be an lvalue, and "hint" must be + //! a valid iterator + //! + //! Effects: Tries to insert x into the tree, using "hint" as a hint + //! to where it will be inserted. + //! + //! Complexity: Amortized logarithmic in general, but it is amortized + //! constant time (two comparisons in the worst case) + //! if t is inserted immediately before hint. + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert_unique(const_iterator hint, reference value) + { + insert_commit_data commit_data; + std::pair ret = insert_unique_check(hint, value, commit_data); + if(!ret.second) + return ret.first; + return insert_unique_commit(value, commit_data); + } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Tries to insert each element of a range into the tree. + //! + //! Complexity: Insert range is in general amortized O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: Nothing. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert_unique(Iterator b, Iterator e) + { + for (; b != e; ++b) + this->insert_unique(*b); + } + + std::pair insert_unique_check + (const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + (node_algorithms::insert_unique_check + (node_ptr(&priv_header()), key, comp, commit_data)); + return std::pair(iterator(ret.first, this), ret.second); + } + + std::pair insert_unique_check + (const_iterator hint, const_reference value, insert_commit_data &commit_data) + { return insert_unique_check(hint, value, priv_comp(), commit_data); } + + template + std::pair insert_unique_check + (const_iterator hint, const KeyType &key + ,KeyValueCompare key_value_comp, insert_commit_data &commit_data) + { + detail::key_nodeptr_comp + comp(key_value_comp, this); + std::pair ret = + node_algorithms::insert_unique_check + (node_ptr(&priv_header()), hint.pointed_node(), key, comp, commit_data); + return std::pair(iterator(ret.first, this), ret.second); + } + + iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) + { + node_ptr to_insert(get_real_value_traits().to_node_ptr(value)); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert)); + this->priv_size_traits().increment(); + node_algorithms::insert_unique_commit + (node_ptr(&priv_header()), to_insert, commit_data); + return iterator(to_insert, this); + } + + //! Effects: Erases the element pointed to by pos. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator i) + { + iterator ret(i); + ++ret; + node_ptr to_erase(i.pointed_node()); + if(safemode_or_autounlink) + BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase)); + node_algorithms::erase(&priv_header(), to_erase); + this->priv_size_traits().decrement(); + if(safemode_or_autounlink) + node_algorithms::init(to_erase); + return ret; + } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average complexity for erase range is amortized + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + iterator erase(iterator b, iterator e) + { size_type n; return private_erase(b, e, n); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return this->erase(value, priv_comp()); } + + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyValueCompare comp) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by pos. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average complexity for erase element is constant time. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator i, Disposer disposer) + { + node_ptr to_erase(i.pointed_node()); + iterator ret(this->erase(i)); + disposer(get_real_value_traits().to_value_ptr(to_erase)); + return ret; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average complexity for erase range is amortized + //! O(log(size() + N)), where N is the number of elements in the range. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(iterator b, iterator e, Disposer disposer) + { size_type n; return private_erase(b, e, n, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { + std::pair p = this->equal_range(value); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "comp". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Amortized O(log(size() + N). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer) + { + std::pair p = this->equal_range(key, comp); + size_type n; + private_erase(p.first, p.second, n, disposer); + return n; + } + + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { + if(safemode_or_autounlink){ + this->clear_and_dispose(detail::null_disposer()); + } + else{ + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + } + + //! Effects: Erases all of the elements calling disposer(p) for + //! each node to be erased. + //! Complexity: Amortized O(log(size() + N)), + //! where N is the number of elements in the container. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. Calls N times to disposer functor. + template + void clear_and_dispose(Disposer disposer) + { + node_algorithms::clear_and_dispose(node_ptr(&priv_header()) + , detail::node_disposer(disposer, this)); + node_algorithms::init_header(&priv_header()); + this->priv_size_traits().set_size(0); + } + + //! Effects: Returns the number of contained elements with the given value + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given value. + //! + //! Throws: Nothing. + size_type count(const_reference value) + { return this->count(value, priv_comp()); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: Nothing. + template + size_type count(const KeyType &key, KeyValueCompare comp) + { + std::pair ret = this->equal_range(key, comp); + return std::distance(ret.first, ret.second); + } + + //! Effects: Returns the number of contained elements with the given value + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given value. + //! + //! Throws: Nothing. + size_type count_dont_splay(const_reference value) const + { return this->count_dont_splay(value, priv_comp()); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Amortized logarithmic to the number of elements contained plus lineal + //! to number of objects with the given key. + //! + //! Throws: Nothing. + template + size_type count_dont_splay(const KeyType &key, KeyValueCompare comp) const + { + std::pair ret = this->equal_range_dont_splay(key, comp); + return std::distance(ret.first, ret.second); + } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + iterator lower_bound(const_reference value) + { return this->lower_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator lower_bound_dont_splay(const_reference value) const + { return this->lower_bound_dont_splay(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + iterator lower_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns a const iterator to the first element whose + //! key is not less than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator lower_bound_dont_splay(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::lower_bound + (const_node_ptr(&priv_header()), key, key_node_comp, false), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + iterator upper_bound(const_reference value) + { return this->upper_bound(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + template + iterator upper_bound(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator(node_algorithms::upper_bound + (const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator upper_bound_dont_splay(const_reference value) const + { return this->upper_bound_dont_splay(value, priv_comp()); } + + //! Effects: Returns an iterator to the first element whose + //! key is greater than k according to comp or end() if that element + //! does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator upper_bound_dont_splay(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator(node_algorithms::upper_bound_dont_splay + (const_node_ptr(&priv_header()), key, key_node_comp, false), this); + } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + iterator find(const_reference value) + { return this->find(value, priv_comp()); } + + //! Effects: Finds an iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + template + iterator find(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp), this); + } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + const_iterator find_dont_splay(const_reference value) const + { return this->find_dont_splay(value, priv_comp()); } + + //! Effects: Finds a const_iterator to the first element whose key is + //! k or end() if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + const_iterator find_dont_splay(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + return const_iterator + (node_algorithms::find(const_node_ptr(&priv_header()), key, key_node_comp, false), this); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + std::pair equal_range(const_reference value) + { return this->equal_range(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + template + std::pair equal_range(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp)); + return std::pair(iterator(ret.first, this), iterator(ret.second, this)); + } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + std::pair + equal_range_dont_splay(const_reference value) const + { return this->equal_range_dont_splay(value, priv_comp()); } + + //! Effects: Finds a range containing all elements whose key is k or + //! an empty range that indicates the position where those elements would be + //! if they there is no elements with key k. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + template + std::pair + equal_range_dont_splay(const KeyType &key, KeyValueCompare comp) const + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + std::pair ret + (node_algorithms::equal_range(const_node_ptr(&priv_header()), key, key_node_comp, false)); + return std::pair(const_iterator(ret.first, this), const_iterator(ret.second, this)); + } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes equivalent to the original nodes. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. Copies the predicate from the source container. + //! + //! If cloner throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. + template + void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer) + { + this->clear_and_dispose(disposer); + if(!src.empty()){ + detail::exception_disposer + rollback(*this, disposer); + node_algorithms::clone + (const_node_ptr(&src.priv_header()) + ,node_ptr(&this->priv_header()) + ,detail::node_cloner(cloner, this) + ,detail::node_disposer(disposer, this)); + this->priv_size_traits().set_size(src.priv_size_traits().get_size()); + this->priv_comp() = src.priv_comp(); + rollback.release(); + } + } + + //! Effects: Unlinks the leftmost node from the tree. + //! + //! Complexity: Average complexity is constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function breaks the tree and the tree can + //! only be used for more unlink_leftmost_without_rebalance calls. + //! This function is normally used to achieve a step by step + //! controlled destruction of the tree. + pointer unlink_leftmost_without_rebalance() + { + node_ptr to_be_disposed(node_algorithms::unlink_leftmost_without_rebalance + (node_ptr(&priv_header()))); + if(!to_be_disposed) + return 0; + this->priv_size_traits().decrement(); + if(safemode_or_autounlink)//If this is commented does not work with normal_link + node_algorithms::init(to_be_disposed); + return get_real_value_traits().to_value_ptr(to_be_disposed); + } + + //! Requires: i must be a valid iterator of *this. + //! + //! Effects: Rearranges the splay set so that the element pointed by i + //! is placed as the root of the tree, improving future searches of this value. + //! + //! Complexity: Amortized logarithmic. + //! + //! Throws: Nothing. + void splay_up(iterator i) + { return node_algorithms::splay_up(i.pointed_node(), &priv_header()); } + + //! Effects: Rearranges the splay set so that if *this stores an element + //! with a key equivalent to value the element is placed as the root of the + //! tree. If the element is not present returns the last node compared with the key. + //! If the tree is empty, end() is returned. + //! + //! Complexity: Amortized logarithmic. + //! + //! Returns: An iterator to the new root of the tree, end() if the tree is empty. + //! + //! Throws: If the comparison functor throws. + template + iterator splay_down(const KeyType &key, KeyValueCompare comp) + { + detail::key_nodeptr_comp + key_node_comp(comp, this); + node_ptr r = node_algorithms::splay_down(&priv_header(), key, key_node_comp); + return iterator(r, this); + } + + //! Effects: Rearranges the splay set so that if *this stores an element + //! with a key equivalent to value the element is placed as the root of the + //! tree. + //! + //! Complexity: Amortized logarithmic. + //! + //! Returns: An iterator to the new root of the tree, end() if the tree is empty. + //! + //! Throws: If the predicate throws. + iterator splay_down(const value_type &value) + { return this->splay_down(value, priv_comp()); } + + //! Requires: replace_this must be a valid iterator of *this + //! and with_this must not be inserted in any tree. + //! + //! Effects: Replaces replace_this in its position in the + //! tree with with_this. The tree does not need to be rebalanced. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! with_this is not equivalent to *replace_this according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + void replace_node(iterator replace_this, reference with_this) + { + node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this) + , node_ptr(&priv_header()) + , get_real_value_traits().to_node_ptr(with_this)); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static iterator s_iterator_to(reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return iterator (value_traits::to_node_ptr(value), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_iterator s_iterator_to(const_reference value) + { + BOOST_STATIC_ASSERT((!stateful_value_traits)); + return const_iterator (value_traits::to_node_ptr(const_cast (value)), 0); + } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator i belonging to the set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator iterator_to(reference value) + { return iterator (value_traits::to_node_ptr(value), this); } + + //! Requires: value must be an lvalue and shall be in a set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator i belonging to the + //! set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator iterator_to(const_reference value) const + { return const_iterator (value_traits::to_node_ptr(const_cast (value)), this); } + + //! Requires: value shall not be in a tree. + //! + //! Effects: init_node puts the hook of a value in a well-known default + //! state. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This function puts the hook in the well-known default state + //! used by auto_unlink and safe hooks. + static void init_node(reference value) + { node_algorithms::init(value_traits::to_node_ptr(value)); } + + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + void rebalance() + { node_algorithms::rebalance(node_ptr(&priv_header())); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear to the elements in the subtree. + iterator rebalance_subtree(iterator root) + { return iterator(node_algorithms::rebalance_subtree(root.pointed_node()), this); } + +/* + //! Effects: removes x from a tree of the appropriate type. It has no effect, + //! if x is not in such a tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Constant time. + //! + //! Note: This static function is only usable with the "safe mode" + //! hook and non-constant time size lists. Otherwise, the user must use + //! the non-static "erase(reference )" member. If the user calls + //! this function with a non "safe mode" or constant time size list + //! a compilation error will be issued. + template + static void remove_node(T& value) + { + //This function is only usable for safe mode hooks and non-constant + //time lists. + //BOOST_STATIC_ASSERT((!(safemode_or_autounlink && constant_time_size))); + BOOST_STATIC_ASSERT((!constant_time_size)); + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + node_ptr to_remove(value_traits::to_node_ptr(value)); + node_algorithms::unlink_and_rebalance(to_remove); + if(safemode_or_autounlink) + node_algorithms::init(to_remove); + } +*/ + + /// @cond + private: + template + iterator private_erase(iterator b, iterator e, size_type &n, Disposer disposer) + { + for(n = 0; b != e; ++n) + this->erase_and_dispose(b++, disposer); + return b; + } + + iterator private_erase(iterator b, iterator e, size_type &n) + { + for(n = 0; b != e; ++n) + this->erase(b++); + return b; + } + /// @endcond + + private: + static splaytree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) + { + header_plus_size *r = detail::parent_from_member + ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + node_plus_pred_t *n = detail::parent_from_member + (r, &node_plus_pred_t::header_plus_size_); + data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); + splaytree_impl *rb = detail::parent_from_member(d, &splaytree_impl::data_); + return *rb; + } + + static splaytree_impl &priv_container_from_iterator(const const_iterator &it) + { return priv_container_from_end_iterator(it.end_iterator_from_it()); } +}; + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator< +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splaytree_impl &x, const splaytree_impl &y) +#else +(const splaytree_impl &x, const splaytree_impl &y) +#endif +{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +bool operator== +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splaytree_impl &x, const splaytree_impl &y) +#else +(const splaytree_impl &x, const splaytree_impl &y) +#endif +{ + typedef splaytree_impl tree_type; + typedef typename tree_type::const_iterator const_iterator; + + if(tree_type::constant_time_size && x.size() != y.size()){ + return false; + } + const_iterator end1 = x.end(); + const_iterator i1 = x.begin(); + const_iterator i2 = y.begin(); + if(tree_type::constant_time_size){ + while (i1 != end1 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1; + } + else{ + const_iterator end2 = y.end(); + while (i1 != end1 && i2 != end2 && *i1 == *i2) { + ++i1; + ++i2; + } + return i1 == end1 && i2 == end2; + } +} + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator!= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splaytree_impl &x, const splaytree_impl &y) +#else +(const splaytree_impl &x, const splaytree_impl &y) +#endif +{ return !(x == y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator> +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splaytree_impl &x, const splaytree_impl &y) +#else +(const splaytree_impl &x, const splaytree_impl &y) +#endif +{ return y < x; } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator<= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splaytree_impl &x, const splaytree_impl &y) +#else +(const splaytree_impl &x, const splaytree_impl &y) +#endif +{ return !(y < x); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline bool operator>= +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(const splaytree_impl &x, const splaytree_impl &y) +#else +(const splaytree_impl &x, const splaytree_impl &y) +#endif +{ return !(x < y); } + +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +inline void swap +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +(splaytree_impl &x, splaytree_impl &y) +#else +(splaytree_impl &x, splaytree_impl &y) +#endif +{ x.swap(y); } + +/// @cond + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_splaytree_opt +{ + typedef typename pack_options + < splay_set_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + typedef typename detail::get_value_traits + ::type value_traits; + + typedef splaysetopt + < value_traits + , typename packed_options::compare + , typename packed_options::size_type + , packed_options::constant_time_size + > type; +}; +/// @endcond + +//! Helper metafunction to define a \c splaytree that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_splaytree +{ + /// @cond + typedef splaytree_impl + < typename make_splaytree_opt::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class splaytree + : public make_splaytree::type +{ + typedef typename make_splaytree + ::type Base; + + public: + typedef typename Base::value_compare value_compare; + typedef typename Base::value_traits value_traits; + typedef typename Base::real_value_traits real_value_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + splaytree( const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(cmp, v_traits) + {} + + template + splaytree( bool unique, Iterator b, Iterator e + , const value_compare &cmp = value_compare() + , const value_traits &v_traits = value_traits()) + : Base(unique, b, e, cmp, v_traits) + {} + + static splaytree &container_from_end_iterator(iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } + + static const splaytree &container_from_end_iterator(const_iterator end_iterator) + { return static_cast(Base::container_from_end_iterator(end_iterator)); } +}; + +#endif + + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SPLAYTREE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splaytree_algorithms.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splaytree_algorithms.hpp new file mode 100644 index 0000000000..e727ab6d13 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/splaytree_algorithms.hpp @@ -0,0 +1,893 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +// The implementation of splay trees is based on the article and code published +// in C++ Users Journal "Implementing Splay Trees in C++" (September 1, 2005). +// +// The code has been modified and (supposely) improved by Ion Gaztanaga. +// Here is the header of the file used as base code: +// +// splay_tree.h -- implementation of a STL complatible splay tree. +// +// Copyright (c) 2004 Ralf Mattethat +// +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. +// This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. +// +// Please send questions, comments, complaints, performance data, etc to +// ralf.mattethat@teknologisk.dk +// +// Requirements for element type +// * must be copy-constructible +// * destructor must not throw exception +// +// Methods marked with note A only throws an exception if the evaluation of the +// predicate throws an exception. If an exception is thrown the call has no +// effect on the containers state +// +// Methods marked with note B only throws an exception if the coppy constructor +// or assignment operator of the predicate throws an exception. If an exception +// is thrown the call has no effect on the containers state +// +// iterators are only invalidated, if the element pointed to by the iterator +// is deleted. The same goes for element references +// + +#ifndef BOOST_INTRUSIVE_SPLAYTREE_ALGORITHMS_HPP +#define BOOST_INTRUSIVE_SPLAYTREE_ALGORITHMS_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond +namespace detail { + +template +struct splaydown_rollback +{ + typedef typename NodeTraits::node_ptr node_ptr; + splaydown_rollback( const node_ptr *pcur_subtree, node_ptr header + , node_ptr leftmost , node_ptr rightmost) + : pcur_subtree_(pcur_subtree) , header_(header) + , leftmost_(leftmost) , rightmost_(rightmost) + {} + + void release() + { pcur_subtree_ = 0; } + + ~splaydown_rollback() + { + if(pcur_subtree_){ + //Exception can only be thrown by comp, but + //tree invariants still hold. *pcur_subtree is the current root + //so link it to the header. + NodeTraits::set_parent(*pcur_subtree_, header_); + NodeTraits::set_parent(header_, *pcur_subtree_); + //Recover leftmost/rightmost pointers + NodeTraits::set_left (header_, leftmost_); + NodeTraits::set_right(header_, rightmost_); + } + } + const node_ptr *pcur_subtree_; + node_ptr header_, leftmost_, rightmost_; +}; + +} //namespace detail { +/// @endcond + +//! A splay tree is an implementation of a binary search tree. The tree is +//! self balancing using the splay algorithm as described in +//! +//! "Self-Adjusting Binary Search Trees +//! by Daniel Dominic Sleator and Robert Endre Tarjan +//! AT&T Bell Laboratories, Murray Hill, NJ +//! Journal of the ACM, Vol 32, no 3, July 1985, pp 652-686 + +//! splaytree_algorithms is configured with a NodeTraits class, which encapsulates the +//! information about the node to be manipulated. NodeTraits must support the +//! following interface: +//! +//! Typedefs: +//! +//! node: The type of the node that forms the circular list +//! +//! node_ptr: A pointer to a node +//! +//! const_node_ptr: A pointer to a const node +//! +//! Static functions: +//! +//! static node_ptr get_parent(const_node_ptr n); +//! +//! static void set_parent(node_ptr n, node_ptr parent); +//! +//! static node_ptr get_left(const_node_ptr n); +//! +//! static void set_left(node_ptr n, node_ptr left); +//! +//! static node_ptr get_right(const_node_ptr n); +//! +//! static void set_right(node_ptr n, node_ptr right); +template +class splaytree_algorithms +{ + /// @cond + private: + typedef detail::tree_algorithms tree_algorithms; + /// @endcond + + public: + typedef typename NodeTraits::node node; + typedef NodeTraits node_traits; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + + //! This type is the information that will be + //! filled by insert_unique_check + typedef typename tree_algorithms::insert_commit_data insert_commit_data; + + /// @cond + private: + static node_ptr uncast(const_node_ptr ptr) + { + return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + } + /// @endcond + + public: + static node_ptr begin_node(const_node_ptr header) + { return tree_algorithms::begin_node(header); } + + static node_ptr end_node(const_node_ptr header) + { return tree_algorithms::end_node(header); } + + //! Requires: node is a node of the tree or an node initialized + //! by init(...). + //! + //! Effects: Returns true if the node is initialized by init(). + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + static bool unique(const_node_ptr node) + { return tree_algorithms::unique(node); } + + static void unlink(node_ptr node) + { tree_algorithms::unlink(node); } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr node2) + { + if(node1 == node2) + return; + + node_ptr header1(tree_algorithms::get_header(node1)), header2(tree_algorithms::get_header(node2)); + swap_nodes(node1, header1, node2, header2); + } + + //! Requires: node1 and node2 can't be header nodes + //! of two trees with header header1 and header2. + //! + //! Effects: Swaps two nodes. After the function node1 will be inserted + //! in the position node2 before the function. node2 will be inserted in the + //! position node1 had before the function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! node1 and node2 are not equivalent according to the ordering rules. + //! + //!Experimental function + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) + { tree_algorithms::swap_nodes(node1, header1, node2, header2); } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing and comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) + { + if(node_to_be_replaced == new_node) + return; + replace_node(node_to_be_replaced, tree_algorithms::get_header(node_to_be_replaced), new_node); + } + + //! Requires: node_to_be_replaced must be inserted in a tree + //! with header "header" and new_node must not be inserted in a tree. + //! + //! Effects: Replaces node_to_be_replaced in its position in the + //! tree with new_node. The tree does not need to be rebalanced + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This function will break container ordering invariants if + //! new_node is not equivalent to node_to_be_replaced according to the + //! ordering rules. This function is faster than erasing and inserting + //! the node, since no rebalancing or comparison is needed. + //! + //!Experimental function + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) + { tree_algorithms::replace_node(node_to_be_replaced, header, new_node); } + + //! Requires: p is a node from the tree except the header. + //! + //! Effects: Returns the next node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr next_node(node_ptr p) + { return tree_algorithms::next_node(p); } + + //! Requires: p is a node from the tree except the leftmost node. + //! + //! Effects: Returns the previous node of the tree. + //! + //! Complexity: Average constant time. + //! + //! Throws: Nothing. + static node_ptr prev_node(node_ptr p) + { return tree_algorithms::prev_node(p); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: After the function unique(node) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init(node_ptr node) + { tree_algorithms::init(node); } + + //! Requires: node must not be part of any tree. + //! + //! Effects: Initializes the header to represent an empty tree. + //! unique(header) == true. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Nodes: If node is inserted in a tree, this function corrupts the tree. + static void init_header(node_ptr header) + { tree_algorithms::init_header(header); } + + //! Requires: "disposer" must be an object function + //! taking a node_ptr parameter and shouldn't throw. + //! + //! Effects: Empties the target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clear_and_dispose(node_ptr header, Disposer disposer) + { tree_algorithms::clear_and_dispose(header, disposer); } + + //! Requires: node is a node of the tree but it's not the header. + //! + //! Effects: Returns the number of nodes of the subtree. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t count(const_node_ptr node) + { return tree_algorithms::count(node); } + + //! Requires: header is the header node of the tree. + //! + //! Effects: Returns the number of nodes above the header. + //! + //! Complexity: Linear time. + //! + //! Throws: Nothing. + static std::size_t size(const_node_ptr header) + { return tree_algorithms::size(header); } + + //! Requires: header1 and header2 must be the header nodes + //! of two trees. + //! + //! Effects: Swaps two trees. After the function header1 will contain + //! links to the second tree and header2 will have links to the first tree. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + static void swap_tree(node_ptr header1, node_ptr header2) + { return tree_algorithms::swap_tree(header1, header2); } + + //! Requires: "header" must be the header node of a tree. + //! "commit_data" must have been obtained from a previous call to + //! "insert_unique_check". No objects should have been inserted or erased + //! from the set between the "insert_unique_check" that filled "commit_data" + //! and the call to "insert_commit". + //! + //! + //! Effects: Inserts new_node in the set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_unique_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + static void insert_unique_commit + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data) + { tree_algorithms::insert_unique_commit(header, new_value, commit_data); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares KeyType with a node_ptr. + //! + //! Effects: Checks if there is an equivalent node to "key" in the + //! tree according to "comp" and obtains the needed information to realize + //! a constant-time node insertion if there is no equivalent node. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing a node_ptr to the already present node + //! and false. If there is not equivalent key can be inserted returns true + //! in the returned pair's boolean and fills "commit_data" that is meant to + //! be used with the "insert_commit" function to achieve a constant-time + //! insertion function. + //! + //! Complexity: Average complexity is at most logarithmic. + //! + //! Throws: If "comp" throws. + //! + //! Notes: This function is used to improve performance when constructing + //! a node is expensive and the user does not want to have two equivalent nodes + //! in the tree: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the order is much cheaper to construct + //! than the node and this function offers the possibility to use that part + //! to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the node and use + //! "insert_commit" to insert the node in constant-time. This gives a total + //! logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)). + //! + //! "commit_data" remains valid for a subsequent "insert_unique_commit" only + //! if no more objects are inserted or erased from the set. + template + static std::pair insert_unique_check + (node_ptr header, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { + splay_down(header, key, comp); + return tree_algorithms::insert_unique_check(header, key, comp, commit_data); + } + + template + static std::pair insert_unique_check + (node_ptr header, node_ptr hint, const KeyType &key + ,KeyNodePtrCompare comp, insert_commit_data &commit_data) + { + splay_down(header, key, comp); + return tree_algorithms::insert_unique_check(header, hint, key, comp, commit_data); + } + + static bool is_header(const_node_ptr p) + { return tree_algorithms::is_header(p); } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the element that is equivalent to + //! "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr find + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true) + { + if(splay) + splay_down(uncast(header), key, comp); + node_ptr end = uncast(header); + node_ptr y = lower_bound(header, key, comp, false); + node_ptr r = (y == end || comp(key, y)) ? end : y; + return r; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an a pair of node_ptr delimiting a range containing + //! all elements that are equivalent to "key" according to "comp" or an + //! empty range that indicates the position where those elements would be + //! if they there are no equivalent elements. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static std::pair equal_range + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true) + { + //if(splay) + //splay_down(uncast(header), key, comp); + std::pair ret = + tree_algorithms::equal_range(header, key, comp); + + if(splay) + splay_up(ret.first, uncast(header)); + return ret; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is + //! not less than "key" according to "comp" or "header" if that element does + //! not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr lower_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true) + { + //if(splay) + //splay_down(uncast(header), key, comp); + node_ptr y = tree_algorithms::lower_bound(header, key, comp); + if(splay) + splay_up(y, uncast(header)); + return y; + } + + //! Requires: "header" must be the header node of a tree. + //! KeyNodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. + //! + //! Effects: Returns an node_ptr to the first element that is greater + //! than "key" according to "comp" or "header" if that element does not exist. + //! + //! Complexity: Logarithmic. + //! + //! Throws: If "comp" throws. + template + static node_ptr upper_bound + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool splay = true) + { + //if(splay) + //splay_down(uncast(header), key, comp); + node_ptr y = tree_algorithms::upper_bound(header, key, comp); + if(splay) + splay_up(y, uncast(header)); + return y; + } + + //! Requires: "header" must be the header node of a tree. + //! NodePtrCompare is a function object that induces a strict weak + //! ordering compatible with the strict weak ordering used to create the + //! the tree. NodePtrCompare compares two node_ptrs. "hint" is node from + //! the "header"'s tree. + //! + //! Effects: Inserts new_node into the tree, using "hint" as a hint to + //! where it will be inserted. If "hint" is the upper_bound + //! the insertion takes constant time (two comparisons in the worst case). + //! + //! Complexity: Logarithmic in general, but it is amortized + //! constant time if new_node is inserted immediately before "hint". + //! + //! Throws: If "comp" throws. + template + static node_ptr insert_equal + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp) + { + splay_down(header, new_node, comp); + return tree_algorithms::insert_equal(header, hint, new_node, comp); + } + + template + static node_ptr insert_equal_upper_bound + (node_ptr header, node_ptr new_node, NodePtrCompare comp) + { + splay_down(header, new_node, comp); + return tree_algorithms::insert_equal_upper_bound(header, new_node, comp); + } + + template + static node_ptr insert_equal_lower_bound + (node_ptr header, node_ptr new_node, NodePtrCompare comp) + { + splay_down(header, new_node, comp); + return tree_algorithms::insert_equal_lower_bound(header, new_node, comp); + } + + //! Requires: "cloner" must be a function + //! object taking a node_ptr and returning a new cloned node of it. "disposer" must + //! take a node_ptr and shouldn't throw. + //! + //! Effects: First empties target tree calling + //! void disposer::operator()(node_ptr) for every node of the tree + //! except the header. + //! + //! Then, duplicates the entire tree pointed by "source_header" cloning each + //! source node with node_ptr Cloner::operator()(node_ptr) to obtain + //! the nodes of the target tree. If "cloner" throws, the cloned target nodes + //! are disposed using void disposer(node_ptr). + //! + //! Complexity: Linear to the number of element of the source tree plus the. + //! number of elements of tree target tree when calling this function. + //! + //! Throws: If cloner functor throws. If this happens target nodes are disposed. + template + static void clone + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer) + { tree_algorithms::clone(source_header, target_header, cloner, disposer); } + + // delete node | complexity : constant | exception : nothrow + static void erase(node_ptr header, node_ptr z, bool splay = true) + { +// node_base* n = t->right; +// if( t->left != 0 ){ +// node_base* l = t->previous(); +// splay_up( l , t ); +// n = t->left; +// n->right = t->right; +// if( n->right != 0 ) +// n->right->parent = n; +// } +// +// if( n != 0 ) +// n->parent = t->parent; +// +// if( t->parent->left == t ) +// t->parent->left = n; +// else // must be ( t->parent->right == t ) +// t->parent->right = n; +// +// if( data_->parent == t ) +// data_->parent = find_leftmost(); + //posibility 1 + if(splay && NodeTraits::get_left(z) != 0 ){ + node_ptr l = prev_node(z); + splay_up(l, header); + } + /* + //possibility 2 + if(splay && NodeTraits::get_left(z) != 0 ){ + node_ptr l = NodeTraits::get_left(z); + splay_up(l, header); + }*//* + if(splay && NodeTraits::get_left(z) != 0 ){ + node_ptr l = prev_node(z); + splay_up_impl(l, z); + }*/ + /* + //possibility 4 + if(splay){ + splay_up(z, header); + }*/ + + //if(splay) + //splay_up(z, header); + tree_algorithms::erase(header, z); + } + + // bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow + static void splay_up(node_ptr n, node_ptr header) + { + if(n == header){ // do a splay for the right most node instead + // this is to boost performance of equal_range/count on equivalent containers in the case + // where there are many equal elements at the end + n = NodeTraits::get_right(header); + } + + node_ptr t = header; + + if( n == t ) return; + + for( ;; ){ + node_ptr p = NodeTraits::get_parent(n); + node_ptr g = NodeTraits::get_parent(p); + + if( p == t ) break; + + if( g == t ){ + // zig + rotate(n); + } + else if ((NodeTraits::get_left(p) == n && NodeTraits::get_left(g) == p) || + (NodeTraits::get_right(p) == n && NodeTraits::get_right(g) == p) ){ + // zig-zig + rotate(p); + rotate(n); + } + else{ + // zig-zag + rotate(n); + rotate(n); + } + } + } + + // top-down splay | complexity : logarithmic | exception : strong, note A + template + static node_ptr splay_down(node_ptr header, const KeyType &key, KeyNodePtrCompare comp) + { + if(!NodeTraits::get_parent(header)) + return header; + //Most splay tree implementations use a dummy/null node to implement. + //this function. This has some problems for a generic library like Intrusive: + // + // * The node might not have a default constructor. + // * The default constructor could throw. + // + //We already have a header node. Leftmost and rightmost nodes of the tree + //are not changed when splaying (because the invariants of the tree don't + //change) We can back up them, use the header as the null node and + //reassign old values after the function has been completed. + node_ptr t = NodeTraits::get_parent(header); + //Check if tree has a single node + if(!NodeTraits::get_left(t) && !NodeTraits::get_right(t)) + return t; + //Backup leftmost/rightmost + node_ptr leftmost = NodeTraits::get_left(header); + node_ptr rightmost = NodeTraits::get_right(header); + + { + detail::splaydown_rollback rollback(&t, header, leftmost, rightmost); + node_ptr null = header; + node_ptr l = null; + node_ptr r = null; + + for( ;; ){ + if(comp(key, t)){ + if(NodeTraits::get_left(t) == 0 ) + break; + if(comp(key, NodeTraits::get_left(t))){ + t = tree_algorithms::rotate_right(t); + + if(NodeTraits::get_left(t) == 0) + break; + link_right(t, r); + } + else if(comp(NodeTraits::get_left(t), key)){ + link_right(t, r); + + if(NodeTraits::get_right(t) == 0 ) + break; + link_left(t, l); + } + else{ + link_right(t, r); + } + } + else if(comp(t, key)){ + if(NodeTraits::get_right(t) == 0 ) + break; + + if(comp(NodeTraits::get_right(t), key)){ + t = tree_algorithms::rotate_left( t ); + + if(NodeTraits::get_right(t) == 0 ) + break; + link_left(t, l); + } + else if(comp(key, NodeTraits::get_right(t))){ + link_left(t, l); + + if(NodeTraits::get_left(t) == 0) + break; + + link_right(t, r); + } + else{ + link_left(t, l); + } + } + else{ + break; + } + } + + assemble(t, l, r, null); + rollback.release(); + } + + //t is the current root + NodeTraits::set_parent(header, t); + NodeTraits::set_parent(t, header); + //Recover leftmost/rightmost pointers + NodeTraits::set_left (header, leftmost); + NodeTraits::set_right(header, rightmost); + return t; + } + + //! Requires: header must be the header of a tree. + //! + //! Effects: Rebalances the tree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + static void rebalance(node_ptr header) + { tree_algorithms::rebalance(header); } + + //! Requires: old_root is a node of a tree. + //! + //! Effects: Rebalances the subtree rooted at old_root. + //! + //! Returns: The new root of the subtree. + //! + //! Throws: Nothing. + //! + //! Complexity: Linear. + static node_ptr rebalance_subtree(node_ptr old_root) + { return tree_algorithms::rebalance_subtree(old_root); } + + + //! Requires: "n" must be a node inserted in a tree. + //! + //! Effects: Returns a pointer to the header node of the tree. + //! + //! Complexity: Logarithmic. + //! + //! Throws: Nothing. + static node_ptr get_header(node_ptr n) + { return tree_algorithms::get_header(n); } + + private: + + /// @cond + + // assemble the three sub-trees into new tree pointed to by t | complexity : constant | exception : nothrow + static void assemble( node_ptr t, node_ptr l, node_ptr r, const_node_ptr null_node ) + { + NodeTraits::set_right(l, NodeTraits::get_left(t)); + NodeTraits::set_left(r, NodeTraits::get_right(t)); + + if(NodeTraits::get_right(l) != 0){ + NodeTraits::set_parent(NodeTraits::get_right(l), l); + } + + if(NodeTraits::get_left(r) != 0){ + NodeTraits::set_parent(NodeTraits::get_left(r), r); + } + + NodeTraits::set_left (t, NodeTraits::get_right(null_node)); + NodeTraits::set_right(t, NodeTraits::get_left(null_node)); + + if( NodeTraits::get_left(t) != 0 ){ + NodeTraits::set_parent(NodeTraits::get_left(t), t); + } + + if( NodeTraits::get_right(t) ){ + NodeTraits::set_parent(NodeTraits::get_right(t), t); + } + } + + // break link to left child node and attach it to left tree pointed to by l | complexity : constant | exception : nothrow + static void link_left(node_ptr& t, node_ptr& l) + { + NodeTraits::set_right(l, t); + NodeTraits::set_parent(t, l); + l = t; + t = NodeTraits::get_right(t); + } + + // break link to right child node and attach it to right tree pointed to by r | complexity : constant | exception : nothrow + static void link_right(node_ptr& t, node_ptr& r) + { + NodeTraits::set_left(r, t); + NodeTraits::set_parent(t, r); + r = t; + t = NodeTraits::get_left(t); + } + + // rotate n with its parent | complexity : constant | exception : nothrow + static void rotate(node_ptr n) + { + node_ptr p = NodeTraits::get_parent(n); + node_ptr g = NodeTraits::get_parent(p); + //Test if g is header before breaking tree + //invariants that would make is_header invalid + bool g_is_header = is_header(g); + + if(NodeTraits::get_left(p) == n){ + NodeTraits::set_left(p, NodeTraits::get_right(n)); + if(NodeTraits::get_left(p) != 0) + NodeTraits::set_parent(NodeTraits::get_left(p), p); + NodeTraits::set_right(n, p); + } + else{ // must be ( p->right == n ) + NodeTraits::set_right(p, NodeTraits::get_left(n)); + if(NodeTraits::get_right(p) != 0) + NodeTraits::set_parent(NodeTraits::get_right(p), p); + NodeTraits::set_left(n, p); + } + + NodeTraits::set_parent(p, n); + NodeTraits::set_parent(n, g); + + if(g_is_header){ + if(NodeTraits::get_parent(g) == p) + NodeTraits::set_parent(g, n); + else{//must be ( g->right == p ) + BOOST_INTRUSIVE_INVARIANT_ASSERT(0); + NodeTraits::set_right(g, n); + } + } + else{ + if(NodeTraits::get_left(g) == p) + NodeTraits::set_left(g, n); + else //must be ( g->right == p ) + NodeTraits::set_right(g, n); + } + } + + /// @endcond +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_SPLAYTREE_ALGORITHMS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/trivial_value_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/trivial_value_traits.hpp new file mode 100644 index 0000000000..3d8797e7ee --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/trivial_value_traits.hpp @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP +#define BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP + +#include + +namespace boost { +namespace intrusive { + +//!This value traits template is used to create value traits +//!from user defined node traits where value_traits::value_type and +//!node_traits::node should be equal +template +struct trivial_value_traits +{ + typedef NodeTraits node_traits; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename node_traits::node value_type; + typedef node_ptr pointer; + typedef const_node_ptr const_pointer; + static const link_mode_type link_mode = LinkMode; + static node_ptr to_node_ptr (value_type &value) { return node_ptr(&value); } + static const_node_ptr to_node_ptr (const value_type &value) { return const_node_ptr(&value); } + static pointer to_value_ptr(node_ptr n) { return pointer(n); } + static const_pointer to_value_ptr(const_node_ptr n) { return const_pointer(n); } +}; + +} //namespace intrusive +} //namespace boost + +#endif //BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/unordered_set.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/unordered_set.hpp new file mode 100644 index 0000000000..8f1f9d1464 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/unordered_set.hpp @@ -0,0 +1,2071 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_UNORDERED_SET_HPP +#define BOOST_INTRUSIVE_UNORDERED_SET_HPP + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +//! The class template unordered_set is an intrusive container, that mimics most of +//! the interface of std::tr1::unordered_set as described in the C++ TR1. +//! +//! unordered_set is a semi-intrusive container: each object to be stored in the +//! container must contain a proper hook, but the container also needs +//! additional auxiliary memory to work: unordered_set needs a pointer to an array +//! of type `bucket_type` to be passed in the constructor. This bucket array must +//! have at least the same lifetime as the container. This makes the use of +//! unordered_set more complicated than purely intrusive containers. +//! `bucket_type` is default-constructible, copyable and assignable +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<> +//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>. +//! +//! unordered_set only provides forward iterators but it provides 4 iterator types: +//! iterator and const_iterator to navigate through the whole container and +//! local_iterator and const_local_iterator to navigate through the values +//! stored in a single bucket. Local iterators are faster and smaller. +//! +//! It's not recommended to use non constant-time size unordered_sets because several +//! key functions, like "empty()", become non-constant time functions. Non +//! constant-time size unordered_sets are mainly provided to support auto-unlink hooks. +//! +//! unordered_set, unlike std::unordered_set, does not make automatic rehashings nor +//! offers functions related to a load factor. Rehashing can be explicitly requested +//! and the user must provide a new bucket array that will be used from that moment. +//! +//! Since no automatic rehashing is done, iterators are never invalidated when +//! inserting or erasing elements. Iterators are only invalidated when rehasing. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class unordered_set_impl +{ + /// @cond + private: + typedef hashtable_impl table_type; + + //! This class is + //! non-copyable + unordered_set_impl (const unordered_set_impl&); + + //! This class is + //! non-assignable + unordered_set_impl &operator =(const unordered_set_impl&); + + typedef table_type implementation_defined; + /// @endcond + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::bucket_traits bucket_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::key_type key_type; + typedef typename implementation_defined::key_equal key_equal; + typedef typename implementation_defined::hasher hasher; + typedef typename implementation_defined::bucket_type bucket_type; + typedef typename implementation_defined::bucket_ptr bucket_ptr; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::local_iterator local_iterator; + typedef typename implementation_defined::const_local_iterator const_local_iterator; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + table_type table_; + /// @endcond + + public: + + //! Requires: buckets must not be being used by any other resource. + //! + //! Effects: Constructs an empty unordered_set_impl, storing a reference + //! to the bucket array and copies of the hasher and equal functors. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor or invocation of Hash or Equal throws. + //! + //! Notes: buckets array must be disposed only after + //! *this is disposed. + unordered_set_impl( const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : table_(b_traits, hash_func, equal_func, v_traits) + {} + + //! Requires: buckets must not be being used by any other resource + //! and Dereferencing iterator must yield an lvalue of type value_type. + //! + //! Effects: Constructs an empty unordered_set and inserts elements from + //! [b, e). + //! + //! Complexity: If N is std::distance(b, e): Average case is O(N) + //! (with a good hash function and with buckets_len >= N),worst case O(N2). + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor or invocation of hasher or key_equal throws. + //! + //! Notes: buckets array must be disposed only after + //! *this is disposed. + template + unordered_set_impl( Iterator b + , Iterator e + , const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : table_(b_traits, hash_func, equal_func, v_traits) + { table_.insert_unique(b, e); } + + //! Effects: Detaches all elements from this. The objects in the unordered_set + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements in the unordered_set, if + //! it's a safe-mode or auto-unlink value. Otherwise constant. + //! + //! Throws: Nothing. + ~unordered_set_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the unordered_set. + //! + //! Complexity: Constant time if `cache_begin<>` is true. Amortized + //! constant time with worst case (empty unordered_set) O(this->bucket_count()) + //! + //! Throws: Nothing. + iterator begin() + { return table_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning + //! of the unordered_set. + //! + //! Complexity: Constant time if `cache_begin<>` is true. Amortized + //! constant time with worst case (empty unordered_set) O(this->bucket_count()) + //! + //! Throws: Nothing. + const_iterator begin() const + { return table_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning + //! of the unordered_set. + //! + //! Complexity: Constant time if `cache_begin<>` is true. Amortized + //! constant time with worst case (empty unordered_set) O(this->bucket_count()) + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return table_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return table_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return table_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return table_.cend(); } + + //! Effects: Returns the hasher object used by the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: If hasher copy-constructor throws. + hasher hash_function() const + { return table_.hash_function(); } + + //! Effects: Returns the key_equal object used by the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: If key_equal copy-constructor throws. + key_equal key_eq() const + { return table_.key_eq(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: if constant-time size and cache_last options are disabled, + //! average constant time (worst case, with empty() == true: O(this->bucket_count()). + //! Otherwise constant. + //! + //! Throws: Nothing. + bool empty() const + { return table_.empty(); } + + //! Effects: Returns the number of elements stored in the unordered_set. + //! + //! Complexity: Linear to elements contained in *this if + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return table_.size(); } + + //! Requires: the hasher and the equality function unqualified swap + //! call should not throw. + //! + //! Effects: Swaps the contents of two unordered_sets. + //! Swaps also the contained bucket array and equality and hasher functors. + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison or hash functors + //! found using ADL throw. Basic guarantee. + void swap(unordered_set_impl& other) + { table_.swap(other.table_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes that compare equal and produce the same + //! hash than the original node. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. The hash function and the equality + //! predicate are copied from the source. + //! + //! If store_hash option is true, this method does not use the hash function. + //! + //! If any operation throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner or hasher throw or hash or equality predicate copying + //! throws. Basic guarantee. + template + void clone_from(const unordered_set_impl &src, Cloner cloner, Disposer disposer) + { table_.clone_from(src.table_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Tries to inserts value into the unordered_set. + //! + //! Returns: If the value + //! is not already present inserts it and returns a pair containing the + //! iterator to the new value and true. If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + std::pair insert(reference value) + { return table_.insert_unique(value); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Equivalent to this->insert(t) for each element in [b, e). + //! + //! Complexity: Average case O(N), where N is std::distance(b, e). + //! Worst case O(N*this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { table_.insert_unique(b, e); } + + //! Requires: "hasher" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hasher" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Checks if a value can be inserted in the unordered_set, using + //! a user provided key instead of the value itself. + //! + //! Returns: If there is an equivalent value + //! returns a pair containing an iterator to the already present value + //! and false. If the value can be inserted returns true in the returned + //! pair boolean and fills "commit_data" that is meant to be used with + //! the "insert_commit" function. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hasher or key_value_equal throw. Strong guarantee. + //! + //! Notes: This function is used to improve performance when constructing + //! a value_type is expensive: if there is an equivalent value + //! the constructed object must be discarded. Many times, the part of the + //! node that is used to impose the hash or the equality is much cheaper to + //! construct than the value_type and this function offers the possibility to + //! use that the part to check if the insertion will be successful. + //! + //! If the check is successful, the user can construct the value_type and use + //! "insert_commit" to insert the object in constant-time. + //! + //! "commit_data" remains valid for a subsequent "insert_commit" only if no more + //! objects are inserted or erased from the unordered_set. + //! + //! After a successful rehashing insert_commit_data remains valid. + template + std::pair insert_check + (const KeyType &key, KeyHasher hasher, KeyValueEqual key_value_equal, insert_commit_data &commit_data) + { return table_.insert_unique_check(key, hasher, key_value_equal, commit_data); } + + //! Requires: value must be an lvalue of type value_type. commit_data + //! must have been obtained from a previous call to "insert_check". + //! No objects should have been inserted or erased from the unordered_set between + //! the "insert_check" that filled "commit_data" and the call to "insert_commit". + //! + //! Effects: Inserts the value in the unordered_set using the information obtained + //! from the "commit_data" that a previous "insert_check" filled. + //! + //! Returns: An iterator to the newly inserted object. + //! + //! Complexity: Constant time. + //! + //! Throws: Nothing. + //! + //! Notes: This function has only sense if a "insert_check" has been + //! previously executed to fill "commit_data". No value should be inserted or + //! erased between the "insert_check" and "insert_commit" calls. + //! + //! After a successful rehashing insert_commit_data remains valid. + iterator insert_commit(reference value, const insert_commit_data &commit_data) + { return table_.insert_unique_commit(value, commit_data); } + + //! Effects: Erases the element pointed to by i. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased element. No destructors are called. + void erase(const_iterator i) + { table_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average case O(std::distance(b, e)), + //! worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void erase(const_iterator b, const_iterator e) + { table_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return table_.erase(value); } + + //! Requires: "hasher" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hasher" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Erases all the elements that have the same hash and + //! compare equal with the given key. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) + { return table_.erase(key, hash_func, equal_func); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by i. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(const_iterator i, Disposer disposer) + { return table_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average case O(std::distance(b, e)), + //! worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) + { return table_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return table_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "equal_func". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func, Disposer disposer) + { return table_.erase_and_dispose(key, hash_func, equal_func, disposer); } + + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return table_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all of the elements. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return table_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given value + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + size_type count(const_reference value) const + { return table_.find(value) != end(); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. + template + size_type count(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const + { return table_.find(key, hash_func, equal_func) != end(); } + + //! Effects: Finds an iterator to the first element is equal to + //! "value" or end() if that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + iterator find(const_reference value) + { return table_.find(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the given hasher and equality functor or end() if + //! that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) + { return table_.find(key, hash_func, equal_func); } + + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" or end() if that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + const_iterator find(const_reference value) const + { return table_.find(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the given hasher and equality functor or end() if + //! that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const + { return table_.find(key, hash_func, equal_func); } + + //! Effects: Returns a range containing all elements with values equivalent + //! to value. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(value)). Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + std::pair equal_range(const_reference value) + { return table_.equal_range(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Returns a range containing all elements with equivalent + //! keys. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(key, hash_func, hash_func)). + //! Worst case O(this->size()). + //! + //! Throws: If hash_func or the equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) + { return table_.equal_range(key, hash_func, equal_func); } + + //! Effects: Returns a range containing all elements with values equivalent + //! to value. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(value)). Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + std::pair + equal_range(const_reference value) const + { return table_.equal_range(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "equal_func" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "equal_func" compares an arbitrary key with the contained values. + //! + //! Effects: Returns a range containing all elements with equivalent + //! keys. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(key, hash_func, equal_func)). + //! Worst case O(this->size()). + //! + //! Throws: If the hash_func or equal_func throw. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const + { return table_.equal_range(key, hash_func, equal_func); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: If the internal hash function throws. + iterator iterator_to(reference value) + { return table_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator belonging to the + //! unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: If the internal hash function throws. + const_iterator iterator_to(const_reference value) const + { return table_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid local_iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static local_iterator s_local_iterator_to(reference value) + { return table_type::s_local_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_local_iterator belonging to + //! the unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_local_iterator s_local_iterator_to(const_reference value) + { return table_type::s_local_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid local_iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + local_iterator local_iterator_to(reference value) + { return table_.local_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_local_iterator belonging to + //! the unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_local_iterator local_iterator_to(const_reference value) const + { return table_.local_iterator_to(value); } + + //! Effects: Returns the number of buckets passed in the constructor + //! or the last rehash function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + size_type bucket_count() const + { return table_.bucket_count(); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns the number of elements in the nth bucket. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + size_type bucket_size(size_type n) const + { return table_.bucket_size(n); } + + //! Effects: Returns the index of the bucket in which elements + //! with keys equivalent to k would be found, if any such element existed. + //! + //! Complexity: Constant. + //! + //! Throws: If the hash functor throws. + //! + //! Note: the return value is in the range [0, this->bucket_count()). + size_type bucket(const value_type& k) const + { return table_.bucket(k); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! Effects: Returns the index of the bucket in which elements + //! with keys equivalent to k would be found, if any such element existed. + //! + //! Complexity: Constant. + //! + //! Throws: If hash_func throws. + //! + //! Note: the return value is in the range [0, this->bucket_count()). + template + size_type bucket(const KeyType& k, KeyHasher hash_func) const + { return table_.bucket(k, hash_func); } + + //! Effects: Returns the bucket array pointer passed in the constructor + //! or the last rehash function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bucket_ptr bucket_pointer() const + { return table_.bucket_pointer(); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + local_iterator begin(size_type n) + { return table_.begin(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator begin(size_type n) const + { return table_.begin(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator cbegin(size_type n) const + { return table_.cbegin(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + local_iterator end(size_type n) + { return table_.end(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator end(size_type n) const + { return table_.end(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator cend(size_type n) const + { return table_.cend(n); } + + //! Requires: new_buckets must be a pointer to a new bucket array + //! or the same as the old bucket array. new_size is the length of the + //! the array pointed by new_buckets. If new_buckets == this->bucket_pointer() + //! n can be bigger or smaller than this->bucket_count(). + //! + //! Effects: Updates the internal reference with the new bucket erases + //! the values from the old bucket and inserts then in the new one. + //! + //! If store_hash option is true, this method does not use the hash function. + //! + //! Complexity: Average case linear in this->size(), worst case quadratic. + //! + //! Throws: If the hasher functor throws. Basic guarantee. + void rehash(const bucket_traits &new_bucket_traits) + { table_.rehash(new_bucket_traits); } + + //! Requires: + //! + //! Effects: + //! + //! Complexity: + //! + //! Throws: + //! + //! Note: this method is only available if incremental option is activated. + bool incremental_rehash(bool grow = true) + { return table_.incremental_rehash(grow); } + + //! Note: this method is only available if incremental option is activated. + bool incremental_rehash(const bucket_traits &new_bucket_traits) + { return table_.incremental_rehash(new_bucket_traits); } + + //! Requires: + //! + //! Effects: + //! + //! Complexity: + //! + //! Throws: + size_type split_count() const + { return table_.split_count(); } + + //! Effects: Returns the nearest new bucket count optimized for + //! the container that is bigger than n. This suggestion can be used + //! to create bucket arrays with a size that will usually improve + //! container's performance. If such value does not exist, the + //! higher possible value is returned. + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static size_type suggested_upper_bucket_count(size_type n) + { return table_type::suggested_upper_bucket_count(n); } + + //! Effects: Returns the nearest new bucket count optimized for + //! the container that is smaller than n. This suggestion can be used + //! to create bucket arrays with a size that will usually improve + //! container's performance. If such value does not exist, the + //! lower possible value is returned. + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static size_type suggested_lower_bucket_count(size_type n) + { return table_type::suggested_lower_bucket_count(n); } +}; + +//! Helper metafunction to define an \c unordered_set that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_unordered_set +{ + /// @cond + typedef unordered_set_impl + < typename make_hashtable_opt + ::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class unordered_set + : public make_unordered_set::type +{ + typedef typename make_unordered_set + ::type Base; + + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + public: + typedef typename Base::value_traits value_traits; + typedef typename Base::bucket_traits bucket_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + typedef typename Base::bucket_ptr bucket_ptr; + typedef typename Base::size_type size_type; + typedef typename Base::hasher hasher; + typedef typename Base::key_equal key_equal; + + unordered_set ( const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : Base(b_traits, hash_func, equal_func, v_traits) + {} + + template + unordered_set ( Iterator b + , Iterator e + , const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : Base(b, e, b_traits, hash_func, equal_func, v_traits) + {} +}; + +#endif + + +//! The class template unordered_multiset is an intrusive container, that mimics most of +//! the interface of std::tr1::unordered_multiset as described in the C++ TR1. +//! +//! unordered_multiset is a semi-intrusive container: each object to be stored in the +//! container must contain a proper hook, but the container also needs +//! additional auxiliary memory to work: unordered_multiset needs a pointer to an array +//! of type `bucket_type` to be passed in the constructor. This bucket array must +//! have at least the same lifetime as the container. This makes the use of +//! unordered_multiset more complicated than purely intrusive containers. +//! `bucket_type` is default-constructible, copyable and assignable +//! +//! The template parameter \c T is the type to be managed by the container. +//! The user can specify additional options and if no options are provided +//! default options are used. +//! +//! The container supports the following options: +//! \c base_hook<>/member_hook<>/value_traits<>, +//! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<> +//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>. +//! +//! unordered_multiset only provides forward iterators but it provides 4 iterator types: +//! iterator and const_iterator to navigate through the whole container and +//! local_iterator and const_local_iterator to navigate through the values +//! stored in a single bucket. Local iterators are faster and smaller. +//! +//! It's not recommended to use non constant-time size unordered_multisets because several +//! key functions, like "empty()", become non-constant time functions. Non +//! constant-time size unordered_multisets are mainly provided to support auto-unlink hooks. +//! +//! unordered_multiset, unlike std::unordered_set, does not make automatic rehashings nor +//! offers functions related to a load factor. Rehashing can be explicitly requested +//! and the user must provide a new bucket array that will be used from that moment. +//! +//! Since no automatic rehashing is done, iterators are never invalidated when +//! inserting or erasing elements. Iterators are only invalidated when rehasing. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) +template +#else +template +#endif +class unordered_multiset_impl +{ + /// @cond + private: + typedef hashtable_impl table_type; + /// @endcond + + //! This class is + //! non-copyable + unordered_multiset_impl (const unordered_multiset_impl&); + + //! This class is + //! non-assignable + unordered_multiset_impl &operator =(const unordered_multiset_impl&); + + typedef table_type implementation_defined; + + public: + typedef typename implementation_defined::value_type value_type; + typedef typename implementation_defined::value_traits value_traits; + typedef typename implementation_defined::bucket_traits bucket_traits; + typedef typename implementation_defined::pointer pointer; + typedef typename implementation_defined::const_pointer const_pointer; + typedef typename implementation_defined::reference reference; + typedef typename implementation_defined::const_reference const_reference; + typedef typename implementation_defined::difference_type difference_type; + typedef typename implementation_defined::size_type size_type; + typedef typename implementation_defined::key_type key_type; + typedef typename implementation_defined::key_equal key_equal; + typedef typename implementation_defined::hasher hasher; + typedef typename implementation_defined::bucket_type bucket_type; + typedef typename implementation_defined::bucket_ptr bucket_ptr; + typedef typename implementation_defined::iterator iterator; + typedef typename implementation_defined::const_iterator const_iterator; + typedef typename implementation_defined::insert_commit_data insert_commit_data; + typedef typename implementation_defined::local_iterator local_iterator; + typedef typename implementation_defined::const_local_iterator const_local_iterator; + typedef typename implementation_defined::node_traits node_traits; + typedef typename implementation_defined::node node; + typedef typename implementation_defined::node_ptr node_ptr; + typedef typename implementation_defined::const_node_ptr const_node_ptr; + typedef typename implementation_defined::node_algorithms node_algorithms; + + /// @cond + private: + table_type table_; + /// @endcond + + public: + + //! Requires: buckets must not be being used by any other resource. + //! + //! Effects: Constructs an empty unordered_multiset, storing a reference + //! to the bucket array and copies of the hasher and equal functors. + //! + //! Complexity: Constant. + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor or invocation of Hash or Equal throws. + //! + //! Notes: buckets array must be disposed only after + //! *this is disposed. + unordered_multiset_impl ( const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : table_(b_traits, hash_func, equal_func, v_traits) + {} + + //! Requires: buckets must not be being used by any other resource + //! and Dereferencing iterator must yield an lvalue of type value_type. + //! + //! Effects: Constructs an empty unordered_multiset and inserts elements from + //! [b, e). + //! + //! Complexity: If N is std::distance(b, e): Average case is O(N) + //! (with a good hash function and with buckets_len >= N),worst case O(N2). + //! + //! Throws: If value_traits::node_traits::node + //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) + //! or the copy constructor or invocation of hasher or key_equal throws. + //! + //! Notes: buckets array must be disposed only after + //! *this is disposed. + template + unordered_multiset_impl ( Iterator b + , Iterator e + , const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : table_(b_traits, hash_func, equal_func, v_traits) + { table_.insert_equal(b, e); } + + //! Effects: Detaches all elements from this. The objects in the unordered_multiset + //! are not deleted (i.e. no destructors are called). + //! + //! Complexity: Linear to the number of elements in the unordered_multiset, if + //! it's a safe-mode or auto-unlink value. Otherwise constant. + //! + //! Throws: Nothing. + ~unordered_multiset_impl() + {} + + //! Effects: Returns an iterator pointing to the beginning of the unordered_multiset. + //! + //! Complexity: Constant time if `cache_begin<>` is true. Amortized + //! constant time with worst case (empty unordered_set) O(this->bucket_count()) + //! + //! Throws: Nothing. + iterator begin() + { return table_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning + //! of the unordered_multiset. + //! + //! Complexity: Constant time if `cache_begin<>` is true. Amortized + //! constant time with worst case (empty unordered_set) O(this->bucket_count()) + //! + //! Throws: Nothing. + const_iterator begin() const + { return table_.begin(); } + + //! Effects: Returns a const_iterator pointing to the beginning + //! of the unordered_multiset. + //! + //! Complexity: Constant time if `cache_begin<>` is true. Amortized + //! constant time with worst case (empty unordered_set) O(this->bucket_count()) + //! + //! Throws: Nothing. + const_iterator cbegin() const + { return table_.cbegin(); } + + //! Effects: Returns an iterator pointing to the end of the unordered_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + iterator end() + { return table_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the unordered_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator end() const + { return table_.end(); } + + //! Effects: Returns a const_iterator pointing to the end of the unordered_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_iterator cend() const + { return table_.cend(); } + + //! Effects: Returns the hasher object used by the unordered_set. + //! + //! Complexity: Constant. + //! + //! Throws: If hasher copy-constructor throws. + hasher hash_function() const + { return table_.hash_function(); } + + //! Effects: Returns the key_equal object used by the unordered_multiset. + //! + //! Complexity: Constant. + //! + //! Throws: If key_equal copy-constructor throws. + key_equal key_eq() const + { return table_.key_eq(); } + + //! Effects: Returns true is the container is empty. + //! + //! Complexity: if constant-time size and cache_last options are disabled, + //! average constant time (worst case, with empty() == true: O(this->bucket_count()). + //! Otherwise constant. + //! + //! Throws: Nothing. + bool empty() const + { return table_.empty(); } + + //! Effects: Returns the number of elements stored in the unordered_multiset. + //! + //! Complexity: Linear to elements contained in *this if + //! constant-time size option is enabled. Constant-time otherwise. + //! + //! Throws: Nothing. + size_type size() const + { return table_.size(); } + + //! Requires: the hasher and the equality function unqualified swap + //! call should not throw. + //! + //! Effects: Swaps the contents of two unordered_multisets. + //! Swaps also the contained bucket array and equality and hasher functors. + //! + //! + //! Complexity: Constant. + //! + //! Throws: If the swap() call for the comparison or hash functors + //! found using ADL throw. Basic guarantee. + void swap(unordered_multiset_impl& other) + { table_.swap(other.table_); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! Cloner should yield to nodes that compare equal and produce the same + //! hash than the original node. + //! + //! Effects: Erases all the elements from *this + //! calling Disposer::operator()(pointer), clones all the + //! elements from src calling Cloner::operator()(const_reference ) + //! and inserts them on *this. The hash function and the equality + //! predicate are copied from the source. + //! + //! If store_hash option is true, this method does not use the hash function. + //! + //! If any operation throws, all cloned elements are unlinked and disposed + //! calling Disposer::operator()(pointer). + //! + //! Complexity: Linear to erased plus inserted elements. + //! + //! Throws: If cloner or hasher throw or hash or equality predicate copying + //! throws. Basic guarantee. + template + void clone_from(const unordered_multiset_impl &src, Cloner cloner, Disposer disposer) + { table_.clone_from(src.table_, cloner, disposer); } + + //! Requires: value must be an lvalue + //! + //! Effects: Inserts value into the unordered_multiset. + //! + //! Returns: An iterator to the new inserted value. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Strong guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + iterator insert(reference value) + { return table_.insert_equal(value); } + + //! Requires: Dereferencing iterator must yield an lvalue + //! of type value_type. + //! + //! Effects: Equivalent to this->insert(t) for each element in [b, e). + //! + //! Complexity: Insert range is in general O(N * log(N)), where N is the + //! size of the range. However, it is linear in N if the range is already sorted + //! by value_comp(). + //! + //! Throws: If the internal hasher or the equality functor throws. Basic guarantee. + //! + //! Note: Does not affect the validity of iterators and references. + //! No copy-constructors are called. + template + void insert(Iterator b, Iterator e) + { table_.insert_equal(b, e); } + + //! Effects: Erases the element pointed to by i. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased element. No destructors are called. + void erase(const_iterator i) + { table_.erase(i); } + + //! Effects: Erases the range pointed to by b end e. + //! + //! Complexity: Average case O(std::distance(b, e)), + //! worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void erase(const_iterator b, const_iterator e) + { table_.erase(b, e); } + + //! Effects: Erases all the elements with the given value. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + size_type erase(const_reference value) + { return table_.erase(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Erases all the elements that have the same hash and + //! compare equal with the given key. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If the hash_func or the equal_func functors throws. + //! Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) + { return table_.erase(key, hash_func, equal_func); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the element pointed to by i. + //! Disposer::operator()(pointer) is called for the removed element. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + void erase_and_dispose(const_iterator i, Disposer disposer) + { table_.erase_and_dispose(i, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases the range pointed to by b end e. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Complexity: Average case O(std::distance(b, e)), + //! worst case O(this->size()). + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) + { table_.erase_and_dispose(b, e, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given value. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. Basic guarantee. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + size_type erase_and_dispose(const_reference value, Disposer disposer) + { return table_.erase_and_dispose(value, disposer); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements with the given key. + //! according to the comparison functor "equal_func". + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Returns: The number of erased elements. + //! + //! Complexity: Average case O(this->count(value)). + //! Worst case O(this->size()). + //! + //! Throws: If hash_func or equal_func throw. Basic guarantee. + //! + //! Note: Invalidates the iterators + //! to the erased elements. + template + size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func, Disposer disposer) + { return table_.erase_and_dispose(key, hash_func, equal_func, disposer); } + + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! if it's a safe-mode or auto-unlink value_type. Constant time otherwise. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + void clear() + { return table_.clear(); } + + //! Requires: Disposer::operator()(pointer) shouldn't throw. + //! + //! Effects: Erases all the elements of the container. + //! + //! Complexity: Linear to the number of elements on the container. + //! Disposer::operator()(pointer) is called for the removed elements. + //! + //! Throws: Nothing. + //! + //! Note: Invalidates the iterators (but not the references) + //! to the erased elements. No destructors are called. + template + void clear_and_dispose(Disposer disposer) + { return table_.clear_and_dispose(disposer); } + + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + size_type count(const_reference value) const + { return table_.count(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Returns the number of contained elements with the given key + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + template + size_type count(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const + { return table_.count(key, hash_func, equal_func); } + + //! Effects: Finds an iterator to the first element whose value is + //! "value" or end() if that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + iterator find(const_reference value) + { return table_.find(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the given hasher and equality functor or end() if + //! that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + iterator find(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) + { return table_.find(key, hash_func, equal_func); } + + //! Effects: Finds a const_iterator to the first element whose key is + //! "key" or end() if that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + const_iterator find(const_reference value) const + { return table_.find(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Finds an iterator to the first element whose key is + //! "key" according to the given hasher and equality functor or end() if + //! that element does not exist. + //! + //! Complexity: Average case O(1), worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + const_iterator find(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const + { return table_.find(key, hash_func, equal_func); } + + //! Effects: Returns a range containing all elements with values equivalent + //! to value. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(value)). Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + std::pair equal_range(const_reference value) + { return table_.equal_range(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Returns a range containing all elements with equivalent + //! keys. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(key, hash_func, equal_func)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair equal_range + (const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) + { return table_.equal_range(key, hash_func, equal_func); } + + //! Effects: Returns a range containing all elements with values equivalent + //! to value. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(value)). Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + std::pair + equal_range(const_reference value) const + { return table_.equal_range(value); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! "key_value_equal" must be a equality function that induces + //! the same equality as key_equal. The difference is that + //! "key_value_equal" compares an arbitrary key with the contained values. + //! + //! Effects: Returns a range containing all elements with equivalent + //! keys. Returns std::make_pair(this->end(), this->end()) if no such + //! elements exist. + //! + //! Complexity: Average case O(this->count(key, hash_func, equal_func)). + //! Worst case O(this->size()). + //! + //! Throws: If the internal hasher or the equality functor throws. + //! + //! Note: This function is used when constructing a value_type + //! is expensive and the value_type can be compared with a cheaper + //! key type. Usually this key is part of the value_type. + template + std::pair + equal_range(const KeyType& key, KeyHasher hash_func, KeyValueEqual equal_func) const + { return table_.equal_range(key, hash_func, equal_func); } + + //! Requires: value must be an lvalue and shall be in a unordered_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid iterator belonging to the unordered_multiset + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: If the hash function throws. + iterator iterator_to(reference value) + { return table_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_multiset of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_iterator belonging to the + //! unordered_multiset that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: If the hash function throws. + const_iterator iterator_to(const_reference value) const + { return table_.iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid local_iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static local_iterator s_local_iterator_to(reference value) + { return table_type::s_local_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_local_iterator belonging to + //! the unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: This static function is available only if the value traits + //! is stateless. + static const_local_iterator s_local_iterator_to(const_reference value) + { return table_type::s_local_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid local_iterator belonging to the unordered_set + //! that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + local_iterator local_iterator_to(reference value) + { return table_.local_iterator_to(value); } + + //! Requires: value must be an lvalue and shall be in a unordered_set of + //! appropriate type. Otherwise the behavior is undefined. + //! + //! Effects: Returns: a valid const_local_iterator belonging to + //! the unordered_set that points to the value + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + const_local_iterator local_iterator_to(const_reference value) const + { return table_.local_iterator_to(value); } + + //! Effects: Returns the number of buckets passed in the constructor + //! or the last rehash function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + size_type bucket_count() const + { return table_.bucket_count(); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns the number of elements in the nth bucket. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + size_type bucket_size(size_type n) const + { return table_.bucket_size(n); } + + //! Effects: Returns the index of the bucket in which elements + //! with keys equivalent to k would be found, if any such element existed. + //! + //! Complexity: Constant. + //! + //! Throws: If the hash functor throws. + //! + //! Note: the return value is in the range [0, this->bucket_count()). + size_type bucket(const value_type& k) const + { return table_.bucket(k); } + + //! Requires: "hash_func" must be a hash function that induces + //! the same hash values as the stored hasher. The difference is that + //! "hash_func" hashes the given key instead of the value_type. + //! + //! Effects: Returns the index of the bucket in which elements + //! with keys equivalent to k would be found, if any such element existed. + //! + //! Complexity: Constant. + //! + //! Throws: If the hash functor throws. + //! + //! Note: the return value is in the range [0, this->bucket_count()). + template + size_type bucket(const KeyType& k, const KeyHasher &hash_func) const + { return table_.bucket(k, hash_func); } + + //! Effects: Returns the bucket array pointer passed in the constructor + //! or the last rehash function. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + bucket_ptr bucket_pointer() const + { return table_.bucket_pointer(); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + local_iterator begin(size_type n) + { return table_.begin(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator begin(size_type n) const + { return table_.begin(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the beginning + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator cbegin(size_type n) const + { return table_.cbegin(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + local_iterator end(size_type n) + { return table_.end(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator end(size_type n) const + { return table_.end(n); } + + //! Requires: n is in the range [0, this->bucket_count()). + //! + //! Effects: Returns a const_local_iterator pointing to the end + //! of the sequence stored in the bucket n. + //! + //! Complexity: Constant. + //! + //! Throws: Nothing. + //! + //! Note: [this->begin(n), this->end(n)) is a valid range + //! containing all of the elements in the nth bucket. + const_local_iterator cend(size_type n) const + { return table_.cend(n); } + + //! Requires: new_buckets must be a pointer to a new bucket array + //! or the same as the old bucket array. new_size is the length of the + //! the array pointed by new_buckets. If new_buckets == this->bucket_pointer() + //! n can be bigger or smaller than this->bucket_count(). + //! + //! Effects: Updates the internal reference with the new bucket erases + //! the values from the old bucket and inserts then in the new one. + //! + //! If store_hash option is true, this method does not use the hash function. + //! + //! Complexity: Average case linear in this->size(), worst case quadratic. + //! + //! Throws: If the hasher functor throws. + void rehash(const bucket_traits &new_bucket_traits) + { table_.rehash(new_bucket_traits); } + + //! Requires: + //! + //! Effects: + //! + //! Complexity: + //! + //! Throws: + //! + //! Note: this method is only available if incremental option is activated. + bool incremental_rehash(bool grow = true) + { return table_.incremental_rehash(grow); } + + //! Note: this method is only available if incremental option is activated. + bool incremental_rehash(const bucket_traits &new_bucket_traits) + { return table_.incremental_rehash(new_bucket_traits); } + + //! Requires: + //! + //! Effects: + //! + //! Complexity: + //! + //! Throws: + size_type split_count() const + { return table_.split_count(); } + + //! Effects: Returns the nearest new bucket count optimized for + //! the container that is bigger than n. This suggestion can be used + //! to create bucket arrays with a size that will usually improve + //! container's performance. If such value does not exist, the + //! higher possible value is returned. + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static size_type suggested_upper_bucket_count(size_type n) + { return table_type::suggested_upper_bucket_count(n); } + + //! Effects: Returns the nearest new bucket count optimized for + //! the container that is smaller than n. This suggestion can be used + //! to create bucket arrays with a size that will usually improve + //! container's performance. If such value does not exist, the + //! lower possible value is returned. + //! + //! Complexity: Amortized constant time. + //! + //! Throws: Nothing. + static size_type suggested_lower_bucket_count(size_type n) + { return table_type::suggested_lower_bucket_count(n); } +}; + +//! Helper metafunction to define an \c unordered_multiset that yields to the same type when the +//! same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_unordered_multiset +{ + /// @cond + typedef unordered_multiset_impl + < typename make_hashtable_opt + ::type + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED + +#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class unordered_multiset + : public make_unordered_multiset::type +{ + typedef typename make_unordered_multiset + ::type Base; + //Assert if passed value traits are compatible with the type + BOOST_STATIC_ASSERT((detail::is_same::value)); + + public: + typedef typename Base::value_traits value_traits; + typedef typename Base::bucket_traits bucket_traits; + typedef typename Base::iterator iterator; + typedef typename Base::const_iterator const_iterator; + typedef typename Base::bucket_ptr bucket_ptr; + typedef typename Base::size_type size_type; + typedef typename Base::hasher hasher; + typedef typename Base::key_equal key_equal; + + unordered_multiset( const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : Base(b_traits, hash_func, equal_func, v_traits) + {} + + template + unordered_multiset( Iterator b + , Iterator e + , const bucket_traits &b_traits + , const hasher & hash_func = hasher() + , const key_equal &equal_func = key_equal() + , const value_traits &v_traits = value_traits()) + : Base(b, e, b_traits, hash_func, equal_func, v_traits) + {} +}; + +#endif + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_UNORDERED_SET_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive/unordered_set_hook.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/unordered_set_hook.hpp new file mode 100644 index 0000000000..0d5d4e89eb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive/unordered_set_hook.hpp @@ -0,0 +1,425 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Olaf Krzikalla 2004-2006. +// (C) Copyright Ion Gaztanaga 2006-2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_UNORDERED_SET_HOOK_HPP +#define BOOST_INTRUSIVE_UNORDERED_SET_HOOK_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace intrusive { + +/// @cond + +template +struct unordered_node + : public slist_node +{ + typedef typename boost::pointer_to_other + < VoidPointer + , unordered_node + >::type node_ptr; + node_ptr prev_in_group_; + std::size_t hash_; +}; + +template +struct unordered_node + : public slist_node +{ + typedef typename boost::pointer_to_other + < VoidPointer + , unordered_node + >::type node_ptr; + node_ptr prev_in_group_; +}; + +template +struct unordered_node + : public slist_node +{ + typedef typename boost::pointer_to_other + < VoidPointer + , unordered_node + >::type node_ptr; + std::size_t hash_; +}; + +template +struct unordered_node_traits + : public slist_node_traits +{ + typedef slist_node_traits reduced_slist_node_traits; + typedef unordered_node node; + typedef typename boost::pointer_to_other + ::type node_ptr; + typedef typename boost::pointer_to_other + ::type const_node_ptr; + + static const bool store_hash = StoreHash; + static const bool optimize_multikey = OptimizeMultiKey; + + static node_ptr get_next(const_node_ptr n) + { return node_ptr(&static_cast(*n->next_)); } + + static void set_next(node_ptr n, node_ptr next) + { n->next_ = next; } + + static node_ptr get_prev_in_group(const_node_ptr n) + { return n->prev_in_group_; } + + static void set_prev_in_group(node_ptr n, node_ptr prev) + { n->prev_in_group_ = prev; } + + static std::size_t get_hash(const_node_ptr n) + { return n->hash_; } + + static void set_hash(node_ptr n, std::size_t h) + { n->hash_ = h; } +}; + +template +struct unordered_group_adapter +{ + typedef typename NodeTraits::node node; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; + + static node_ptr get_next(const_node_ptr n) + { return NodeTraits::get_prev_in_group(n); } + + static void set_next(node_ptr n, node_ptr next) + { NodeTraits::set_prev_in_group(n, next); } +}; + +template +struct unordered_algorithms + : public circular_slist_algorithms +{ + typedef circular_slist_algorithms base_type; + typedef unordered_group_adapter group_traits; + typedef circular_slist_algorithms group_algorithms; + + static void init(typename base_type::node_ptr n) + { + base_type::init(n); + group_algorithms::init(n); + } + + static void init_header(typename base_type::node_ptr n) + { + base_type::init_header(n); + group_algorithms::init_header(n); + } + + static void unlink(typename base_type::node_ptr n) + { + base_type::unlink(n); + group_algorithms::unlink(n); + } +}; + +template +struct get_uset_node_algo +{ + typedef typename detail::if_c + < (StoreHash || OptimizeMultiKey) + , unordered_node_traits + , slist_node_traits + >::type node_traits_type; + typedef typename detail::if_c + < OptimizeMultiKey + , unordered_algorithms + , circular_slist_algorithms + >::type type; +}; +/// @endcond + +//! Helper metafunction to define a \c unordered_set_base_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_unordered_set_base_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_uset_node_algo + , typename packed_options::tag + , packed_options::link_mode + , detail::UsetBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Derive a class from unordered_set_base_hook in order to store objects in +//! in an unordered_set/unordered_multi_set. unordered_set_base_hook holds the data necessary to maintain +//! the unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set. +//! +//! The hook admits the following options: \c tag<>, \c void_pointer<>, +//! \c link_mode<>, \c store_hash<> and \c optimize_multikey<>. +//! +//! \c tag<> defines a tag to identify the node. +//! The same tag value can be used in different classes, but if a class is +//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its +//! unique tag. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c store_hash<> will tell the hook to store the hash of the value +//! to speed up rehashings. +//! +//! \c optimize_multikey<> will tell the hook to store a link to form a group +//! with other value with the same value to speed up searches and insertions +//! in unordered_multisets with a great number of with equivalent keys. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class unordered_set_base_hook + : public make_unordered_set_base_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + unordered_set_base_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + unordered_set_base_hook(const unordered_set_base_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + unordered_set_base_hook& operator=(const unordered_set_base_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in an unordered_set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~unordered_set_base_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(unordered_set_base_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c unordered_set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + + +//! Helper metafunction to define a \c unordered_set_member_hook that yields to the same +//! type when the same options (either explicitly or implicitly) are used. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct make_unordered_set_member_hook +{ + /// @cond + typedef typename pack_options + < hook_defaults, + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + + typedef detail::generic_hook + < get_uset_node_algo< typename packed_options::void_pointer + , packed_options::store_hash + , packed_options::optimize_multikey + > + , member_tag + , packed_options::link_mode + , detail::NoBaseHook + > implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +//! Put a public data member unordered_set_member_hook in order to store objects of this class in +//! an unordered_set/unordered_multi_set. unordered_set_member_hook holds the data necessary for maintaining the +//! unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set. +//! +//! The hook admits the following options: \c void_pointer<>, +//! \c link_mode<> and \c store_hash<>. +//! +//! \c void_pointer<> is the pointer type that will be used internally in the hook +//! and the the container configured to use this hook. +//! +//! \c link_mode<> will specify the linking mode of the hook (\c normal_link, +//! \c auto_unlink or \c safe_link). +//! +//! \c store_hash<> will tell the hook to store the hash of the value +//! to speed up rehashings. +#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template +#else +template +#endif +class unordered_set_member_hook + : public make_unordered_set_member_hook< + #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type +{ + #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. + //! + //! Throws: Nothing. + unordered_set_member_hook(); + + //! Effects: If link_mode is \c auto_unlink or \c safe_link + //! initializes the node to an unlinked state. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing a copy-constructor + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + unordered_set_member_hook(const unordered_set_member_hook& ); + + //! Effects: Empty function. The argument is ignored. + //! + //! Throws: Nothing. + //! + //! Rationale: Providing an assignment operator + //! makes classes using the hook STL-compliant without forcing the + //! user to do some additional work. \c swap can be used to emulate + //! move-semantics. + unordered_set_member_hook& operator=(const unordered_set_member_hook& ); + + //! Effects: If link_mode is \c normal_link, the destructor does + //! nothing (ie. no code is generated). If link_mode is \c safe_link and the + //! object is stored in an unordered_set an assertion is raised. If link_mode is + //! \c auto_unlink and \c is_linked() is true, the node is unlinked. + //! + //! Throws: Nothing. + ~unordered_set_member_hook(); + + //! Effects: Swapping two nodes swaps the position of the elements + //! related to those nodes in one or two containers. That is, if the node + //! this is part of the element e1, the node x is part of the element e2 + //! and both elements are included in the containers s1 and s2, then after + //! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 + //! at the position of e1. If one element is not in a container, then + //! after the swap-operation the other element is not in a container. + //! Iterators to e1 and e2 related to those nodes are invalidated. + //! + //! Complexity: Constant + //! + //! Throws: Nothing. + void swap_nodes(unordered_set_member_hook &other); + + //! Precondition: link_mode must be \c safe_link or \c auto_unlink. + //! + //! Returns: true, if the node belongs to a container, false + //! otherwise. This function can be used to test whether \c unordered_set::iterator_to + //! will return a valid iterator. + //! + //! Complexity: Constant + bool is_linked() const; + + //! Effects: Removes the node if it's inserted in a container. + //! This function is only allowed if link_mode is \c auto_unlink. + //! + //! Throws: Nothing. + void unlink(); + #endif +}; + +} //namespace intrusive +} //namespace boost + +#include + +#endif //BOOST_INTRUSIVE_UNORDERED_SET_HOOK_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/intrusive_ptr.hpp b/deal.II/contrib/boost/include/boost-1.37.0/intrusive_ptr.hpp new file mode 100644 index 0000000000..338e672f1e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/intrusive_ptr.hpp @@ -0,0 +1,311 @@ +#ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED +#define BOOST_INTRUSIVE_PTR_HPP_INCLUDED + +// +// intrusive_ptr.hpp +// +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation. +// + +#include + +#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash +# pragma warning(push) +# pragma warning(disable:4284) // odd return type for operator-> +#endif + +#include +#include +#include + +#include // for std::less + +#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_NO_IOSFWD) +#include // for std::basic_ostream +#else +#include +#endif +#endif + + +namespace boost +{ + +// +// intrusive_ptr +// +// A smart pointer that uses intrusive reference counting. +// +// Relies on unqualified calls to +// +// void intrusive_ptr_add_ref(T * p); +// void intrusive_ptr_release(T * p); +// +// (p != 0) +// +// The object is responsible for destroying itself. +// + +template class intrusive_ptr +{ +private: + + typedef intrusive_ptr this_type; + +public: + + typedef T element_type; + + intrusive_ptr(): p_(0) + { + } + + intrusive_ptr(T * p, bool add_ref = true): p_(p) + { + if(p_ != 0 && add_ref) intrusive_ptr_add_ref(p_); + } + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + intrusive_ptr( intrusive_ptr const & rhs, typename detail::sp_enable_if_convertible::type = detail::sp_empty() ) + +#else + + intrusive_ptr( intrusive_ptr const & rhs ) + +#endif + : p_( rhs.get() ) + { + if( p_ != 0 ) intrusive_ptr_add_ref( p_ ); + } + +#endif + + intrusive_ptr(intrusive_ptr const & rhs): p_(rhs.p_) + { + if(p_ != 0) intrusive_ptr_add_ref(p_); + } + + ~intrusive_ptr() + { + if(p_ != 0) intrusive_ptr_release(p_); + } + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) + + template intrusive_ptr & operator=(intrusive_ptr const & rhs) + { + this_type(rhs).swap(*this); + return *this; + } + +#endif + + intrusive_ptr & operator=(intrusive_ptr const & rhs) + { + this_type(rhs).swap(*this); + return *this; + } + + intrusive_ptr & operator=(T * rhs) + { + this_type(rhs).swap(*this); + return *this; + } + + void reset() + { + this_type().swap( *this ); + } + + void reset( T * rhs ) + { + this_type( rhs ).swap( *this ); + } + + T * get() const + { + return p_; + } + + T & operator*() const + { + BOOST_ASSERT( p_ != 0 ); + return *p_; + } + + T * operator->() const + { + BOOST_ASSERT( p_ != 0 ); + return p_; + } + +#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530) + + operator bool () const + { + return p_ != 0; + } + +#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return p_ == 0? 0: &this_type::get; + } + +#else + + typedef T * this_type::*unspecified_bool_type; + + operator unspecified_bool_type () const + { + return p_ == 0? 0: &this_type::p_; + } + +#endif + + // operator! is a Borland-specific workaround + bool operator! () const + { + return p_ == 0; + } + + void swap(intrusive_ptr & rhs) + { + T * tmp = p_; + p_ = rhs.p_; + rhs.p_ = tmp; + } + +private: + + T * p_; +}; + +template inline bool operator==(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return a.get() == b.get(); +} + +template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return a.get() != b.get(); +} + +template inline bool operator==(intrusive_ptr const & a, U * b) +{ + return a.get() == b; +} + +template inline bool operator!=(intrusive_ptr const & a, U * b) +{ + return a.get() != b; +} + +template inline bool operator==(T * a, intrusive_ptr const & b) +{ + return a == b.get(); +} + +template inline bool operator!=(T * a, intrusive_ptr const & b) +{ + return a != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return a.get() != b.get(); +} + +#endif + +template inline bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return std::less()(a.get(), b.get()); +} + +template void swap(intrusive_ptr & lhs, intrusive_ptr & rhs) +{ + lhs.swap(rhs); +} + +// mem_fn support + +template T * get_pointer(intrusive_ptr const & p) +{ + return p.get(); +} + +template intrusive_ptr static_pointer_cast(intrusive_ptr const & p) +{ + return static_cast(p.get()); +} + +template intrusive_ptr const_pointer_cast(intrusive_ptr const & p) +{ + return const_cast(p.get()); +} + +template intrusive_ptr dynamic_pointer_cast(intrusive_ptr const & p) +{ + return dynamic_cast(p.get()); +} + +// operator<< + +#if !defined(BOOST_NO_IOSTREAM) + +#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) + +template std::ostream & operator<< (std::ostream & os, intrusive_ptr const & p) +{ + os << p.get(); + return os; +} + +#else + +// in STLport's no-iostreams mode no iostream symbols can be used +#ifndef _STLP_NO_IOSTREAMS + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) +// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL +using std::basic_ostream; +template basic_ostream & operator<< (basic_ostream & os, intrusive_ptr const & p) +# else +template std::basic_ostream & operator<< (std::basic_ostream & os, intrusive_ptr const & p) +# endif +{ + os << p.get(); + return os; +} + +#endif // _STLP_NO_IOSTREAMS + +#endif // __GNUC__ < 3 + +#endif // !defined(BOOST_NO_IOSTREAM) + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/io/ios_state.hpp b/deal.II/contrib/boost/include/boost-1.37.0/io/ios_state.hpp new file mode 100644 index 0000000000..9c45c0b587 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/io/ios_state.hpp @@ -0,0 +1,431 @@ +// Boost io/ios_state.hpp header file --------------------------------------// + +// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution +// are subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or a copy at .) + +// See for the library's home page. + +#ifndef BOOST_IO_IOS_STATE_HPP +#define BOOST_IO_IOS_STATE_HPP + +#include // self include +#include + +#include // for std::ios_base, std::basic_ios, etc. +#ifndef BOOST_NO_STD_LOCALE +#include // for std::locale +#endif +#include // for std::basic_ostream +#include // for std::basic_streambuf +#include // for std::char_traits + + +namespace boost +{ +namespace io +{ + + +// Basic stream state saver class declarations -----------------------------// + +class ios_flags_saver +{ +public: + typedef ::std::ios_base state_type; + typedef ::std::ios_base::fmtflags aspect_type; + + explicit ios_flags_saver( state_type &s ) + : s_save_( s ), a_save_( s.flags() ) + {} + ios_flags_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.flags(a) ) + {} + ~ios_flags_saver() + { this->restore(); } + + void restore() + { s_save_.flags( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + + ios_flags_saver& operator=(const ios_flags_saver&); +}; + +class ios_precision_saver +{ +public: + typedef ::std::ios_base state_type; + typedef ::std::streamsize aspect_type; + + explicit ios_precision_saver( state_type &s ) + : s_save_( s ), a_save_( s.precision() ) + {} + ios_precision_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.precision(a) ) + {} + ~ios_precision_saver() + { this->restore(); } + + void restore() + { s_save_.precision( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + + ios_precision_saver& operator=(const ios_precision_saver&); +}; + +class ios_width_saver +{ +public: + typedef ::std::ios_base state_type; + typedef ::std::streamsize aspect_type; + + explicit ios_width_saver( state_type &s ) + : s_save_( s ), a_save_( s.width() ) + {} + ios_width_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.width(a) ) + {} + ~ios_width_saver() + { this->restore(); } + + void restore() + { s_save_.width( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + ios_width_saver& operator=(const ios_width_saver&); +}; + + +// Advanced stream state saver class template declarations -----------------// + +template < typename Ch, class Tr > +class basic_ios_iostate_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::ios_base::iostate aspect_type; + + explicit basic_ios_iostate_saver( state_type &s ) + : s_save_( s ), a_save_( s.rdstate() ) + {} + basic_ios_iostate_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.rdstate() ) + { s.clear(a); } + ~basic_ios_iostate_saver() + { this->restore(); } + + void restore() + { s_save_.clear( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; +}; + +template < typename Ch, class Tr > +class basic_ios_exception_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::ios_base::iostate aspect_type; + + explicit basic_ios_exception_saver( state_type &s ) + : s_save_( s ), a_save_( s.exceptions() ) + {} +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + basic_ios_exception_saver( state_type &s, aspect_type a ) +#else + basic_ios_exception_saver( state_type &s, aspect_type const &a ) +#endif + : s_save_( s ), a_save_( s.exceptions() ) + { s.exceptions(a); } + ~basic_ios_exception_saver() + { this->restore(); } + + void restore() + { s_save_.exceptions( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; +}; + +template < typename Ch, class Tr > +class basic_ios_tie_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::basic_ostream * aspect_type; + + explicit basic_ios_tie_saver( state_type &s ) + : s_save_( s ), a_save_( s.tie() ) + {} + basic_ios_tie_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.tie(a) ) + {} + ~basic_ios_tie_saver() + { this->restore(); } + + void restore() + { s_save_.tie( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; +}; + +template < typename Ch, class Tr > +class basic_ios_rdbuf_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::basic_streambuf * aspect_type; + + explicit basic_ios_rdbuf_saver( state_type &s ) + : s_save_( s ), a_save_( s.rdbuf() ) + {} + basic_ios_rdbuf_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.rdbuf(a) ) + {} + ~basic_ios_rdbuf_saver() + { this->restore(); } + + void restore() + { s_save_.rdbuf( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; +}; + +template < typename Ch, class Tr > +class basic_ios_fill_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef typename state_type::char_type aspect_type; + + explicit basic_ios_fill_saver( state_type &s ) + : s_save_( s ), a_save_( s.fill() ) + {} + basic_ios_fill_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.fill(a) ) + {} + ~basic_ios_fill_saver() + { this->restore(); } + + void restore() + { s_save_.fill( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; +}; + +#ifndef BOOST_NO_STD_LOCALE +template < typename Ch, class Tr > +class basic_ios_locale_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::locale aspect_type; + + explicit basic_ios_locale_saver( state_type &s ) + : s_save_( s ), a_save_( s.getloc() ) + {} + basic_ios_locale_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.imbue(a) ) + {} + ~basic_ios_locale_saver() + { this->restore(); } + + void restore() + { s_save_.imbue( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; +}; +#endif + + +// User-defined stream state saver class declarations ----------------------// + +class ios_iword_saver +{ +public: + typedef ::std::ios_base state_type; + typedef int index_type; + typedef long aspect_type; + + explicit ios_iword_saver( state_type &s, index_type i ) + : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) + {} + ios_iword_saver( state_type &s, index_type i, aspect_type const &a ) + : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) + { s.iword(i) = a; } + ~ios_iword_saver() + { this->restore(); } + + void restore() + { s_save_.iword( i_save_ ) = a_save_; } + +private: + state_type & s_save_; + aspect_type const a_save_; + index_type const i_save_; + + ios_iword_saver& operator=(const ios_iword_saver&); +}; + +class ios_pword_saver +{ +public: + typedef ::std::ios_base state_type; + typedef int index_type; + typedef void * aspect_type; + + explicit ios_pword_saver( state_type &s, index_type i ) + : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) + {} + ios_pword_saver( state_type &s, index_type i, aspect_type const &a ) + : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) + { s.pword(i) = a; } + ~ios_pword_saver() + { this->restore(); } + + void restore() + { s_save_.pword( i_save_ ) = a_save_; } + +private: + state_type & s_save_; + aspect_type const a_save_; + index_type const i_save_; + + ios_pword_saver operator=(const ios_pword_saver&); +}; + + +// Combined stream state saver class (template) declarations ---------------// + +class ios_base_all_saver +{ +public: + typedef ::std::ios_base state_type; + + explicit ios_base_all_saver( state_type &s ) + : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) + , a3_save_( s.width() ) + {} + + ~ios_base_all_saver() + { this->restore(); } + + void restore() + { + s_save_.width( a3_save_ ); + s_save_.precision( a2_save_ ); + s_save_.flags( a1_save_ ); + } + +private: + state_type & s_save_; + state_type::fmtflags const a1_save_; + ::std::streamsize const a2_save_; + ::std::streamsize const a3_save_; + + ios_base_all_saver& operator=(const ios_base_all_saver&); +}; + +template < typename Ch, class Tr > +class basic_ios_all_saver +{ +public: + typedef ::std::basic_ios state_type; + + explicit basic_ios_all_saver( state_type &s ) + : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) + , a3_save_( s.width() ), a4_save_( s.rdstate() ) + , a5_save_( s.exceptions() ), a6_save_( s.tie() ) + , a7_save_( s.rdbuf() ), a8_save_( s.fill() ) + #ifndef BOOST_NO_STD_LOCALE + , a9_save_( s.getloc() ) + #endif + {} + + ~basic_ios_all_saver() + { this->restore(); } + + void restore() + { + #ifndef BOOST_NO_STD_LOCALE + s_save_.imbue( a9_save_ ); + #endif + s_save_.fill( a8_save_ ); + s_save_.rdbuf( a7_save_ ); + s_save_.tie( a6_save_ ); + s_save_.exceptions( a5_save_ ); + s_save_.clear( a4_save_ ); + s_save_.width( a3_save_ ); + s_save_.precision( a2_save_ ); + s_save_.flags( a1_save_ ); + } + +private: + state_type & s_save_; + typename state_type::fmtflags const a1_save_; + ::std::streamsize const a2_save_; + ::std::streamsize const a3_save_; + typename state_type::iostate const a4_save_; + typename state_type::iostate const a5_save_; + ::std::basic_ostream * const a6_save_; + ::std::basic_streambuf * const a7_save_; + typename state_type::char_type const a8_save_; + #ifndef BOOST_NO_STD_LOCALE + ::std::locale const a9_save_; + #endif +}; + +class ios_all_word_saver +{ +public: + typedef ::std::ios_base state_type; + typedef int index_type; + + ios_all_word_saver( state_type &s, index_type i ) + : s_save_( s ), i_save_( i ), a1_save_( s.iword(i) ) + , a2_save_( s.pword(i) ) + {} + + ~ios_all_word_saver() + { this->restore(); } + + void restore() + { + s_save_.pword( i_save_ ) = a2_save_; + s_save_.iword( i_save_ ) = a1_save_; + } + +private: + state_type & s_save_; + index_type const i_save_; + long const a1_save_; + void * const a2_save_; + + ios_all_word_saver& operator=(const ios_all_word_saver&); +}; + + +} // namespace io +} // namespace boost + + +#endif // BOOST_IO_IOS_STATE_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/io_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/io_fwd.hpp new file mode 100644 index 0000000000..417b81e3e1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/io_fwd.hpp @@ -0,0 +1,67 @@ +// Boost io_fwd.hpp header file --------------------------------------------// + +// Copyright 2002 Daryle Walker. Use, modification, and distribution are subject +// to the Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or a copy at .) + +// See for the library's home page. + +#ifndef BOOST_IO_FWD_HPP +#define BOOST_IO_FWD_HPP + +#include // for std::char_traits (declaration) + + +namespace boost +{ +namespace io +{ + + +// From -------------------------------------------// + +class ios_flags_saver; +class ios_precision_saver; +class ios_width_saver; +class ios_base_all_saver; + +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_iostate_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_exception_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_tie_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_rdbuf_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_fill_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_locale_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_all_saver; + +typedef basic_ios_iostate_saver ios_iostate_saver; +typedef basic_ios_iostate_saver wios_iostate_saver; +typedef basic_ios_exception_saver ios_exception_saver; +typedef basic_ios_exception_saver wios_exception_saver; +typedef basic_ios_tie_saver ios_tie_saver; +typedef basic_ios_tie_saver wios_tie_saver; +typedef basic_ios_rdbuf_saver ios_rdbuf_saver; +typedef basic_ios_rdbuf_saver wios_rdbuf_saver; +typedef basic_ios_fill_saver ios_fill_saver; +typedef basic_ios_fill_saver wios_fill_saver; +typedef basic_ios_locale_saver ios_locale_saver; +typedef basic_ios_locale_saver wios_locale_saver; +typedef basic_ios_all_saver ios_all_saver; +typedef basic_ios_all_saver wios_all_saver; + +class ios_iword_saver; +class ios_pword_saver; +class ios_all_word_saver; + + +} // namespace io +} // namespace boost + + +#endif // BOOST_IO_FWD_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/categories.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/categories.hpp new file mode 100644 index 0000000000..fbf8669e3c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/categories.hpp @@ -0,0 +1,175 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains category and mode tags for classifying filters, devices and +// standard stream and stream buffers types. + +#ifndef BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED +#define BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +namespace boost { namespace iostreams { + +//------------------Tags for dispatch according to i/o mode-------------------// + +struct any_tag { }; +namespace detail { struct two_sequence : virtual any_tag { }; } +namespace detail { struct random_access : virtual any_tag { }; } +namespace detail { struct one_head : virtual any_tag { }; } +namespace detail { struct two_head : virtual any_tag { }; } +struct input : virtual any_tag { }; +struct output : virtual any_tag { }; +struct bidirectional : virtual input, virtual output, detail::two_sequence { }; +struct dual_use : virtual input, virtual output { }; // Pseudo-mode. +struct input_seekable : virtual input, virtual detail::random_access { }; +struct output_seekable : virtual output, virtual detail::random_access { }; +struct seekable + : virtual input_seekable, + virtual output_seekable, + detail::one_head + { }; +struct dual_seekable + : virtual input_seekable, + virtual output_seekable, + detail::two_head + { }; +struct bidirectional_seekable + : input_seekable, output_seekable, + bidirectional, detail::two_head + { }; + +//------------------Tags for use as i/o categories----------------------------// + +struct device_tag : virtual any_tag { }; +struct filter_tag : virtual any_tag { }; + + // + // Tags for optional behavior. + // + +struct peekable_tag : virtual any_tag { }; // Devices. +struct closable_tag : virtual any_tag { }; +struct flushable_tag : virtual any_tag { }; +struct localizable_tag : virtual any_tag { }; +struct optimally_buffered_tag : virtual any_tag { }; +struct direct_tag : virtual any_tag { }; // Devices. +struct multichar_tag : virtual any_tag { }; // Filters. + +struct source_tag : device_tag, input { }; +struct sink_tag : device_tag, output { }; +struct bidirectional_device_tag : device_tag, bidirectional { }; +struct seekable_device_tag : virtual device_tag, seekable { }; + +struct input_filter_tag : filter_tag, input { }; +struct output_filter_tag : filter_tag, output { }; +struct bidirectional_filter_tag : filter_tag, bidirectional { }; +struct seekable_filter_tag : filter_tag, seekable { }; +struct dual_use_filter_tag : filter_tag, dual_use { }; + +struct multichar_input_filter_tag + : multichar_tag, + input_filter_tag + { }; +struct multichar_output_filter_tag + : multichar_tag, + output_filter_tag + { }; +struct multichar_bidirectional_filter_tag + : multichar_tag, + bidirectional_filter_tag + { }; +struct multichar_seekable_filter_tag + : multichar_tag, + seekable_filter_tag + { }; +struct multichar_dual_use_filter_tag + : filter_tag, + dual_use + { }; + + // + // Tags for standard streams and streambufs. + // + +struct std_io_tag : virtual localizable_tag { }; +struct istream_tag + : virtual device_tag, + virtual peekable_tag, + virtual std_io_tag + { }; +struct ostream_tag + : virtual device_tag, + virtual std_io_tag + { }; +struct iostream_tag + : istream_tag, + ostream_tag + { }; +struct streambuf_tag + : device_tag, + peekable_tag, + std_io_tag + { }; +struct ifstream_tag + : input_seekable, + closable_tag, + istream_tag + { }; +struct ofstream_tag + : output_seekable, + closable_tag, + ostream_tag + { }; +struct fstream_tag + : seekable, + closable_tag, + iostream_tag + { }; +struct filebuf_tag + : seekable, + closable_tag, + streambuf_tag + { }; +struct istringstream_tag + : input_seekable, + istream_tag + { }; +struct ostringstream_tag + : output_seekable, + ostream_tag + { }; +struct stringstream_tag + : dual_seekable, + iostream_tag + { }; +struct stringbuf_tag + : dual_seekable, + streambuf_tag + { }; +struct generic_istream_tag + : input_seekable, + istream_tag + { }; +struct generic_ostream_tag + : output_seekable, + ostream_tag + { }; +struct generic_iostream_tag + : seekable, + iostream_tag + { }; +struct generic_streambuf_tag + : seekable, + streambuf_tag + { }; + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_CATEGORIES_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/chain.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/chain.hpp new file mode 100644 index 0000000000..faea8f8670 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/chain.hpp @@ -0,0 +1,585 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_CHAIN_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CHAIN_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include // unary_function. +#include // advance. +#include +#include // allocator, auto_ptr. +#include +#include // logic_error, out_of_range. +#include +#include // BOOST_MSVC, template friends, +#include // BOOST_NESTED_TEMPLATE +#include +#include +#include +#include +#include // pubsync. +#include +#include +#include +#include // is_filter. +#include +#include +#include +#include +#include +#include +#include // VC6.5 requires this +#if BOOST_WORKAROUND(BOOST_MSVC, < 1310) // #include order +# include +#endif + +// Sometimes type_info objects must be compared by name. Borrowed from +// Boost.Python and Boost.Function. +#if (defined(__GNUC__) && __GNUC__ >= 3) || \ + defined(_AIX) || \ + (defined(__sgi) && defined(__host_mips)) || \ + (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC)) \ + /**/ +# include +# define BOOST_IOSTREAMS_COMPARE_TYPE_ID(X,Y) \ + (std::strcmp((X).name(),(Y).name()) == 0) +#else +# define BOOST_IOSTREAMS_COMPARE_TYPE_ID(X,Y) ((X)==(Y)) +#endif + +// Deprecated +#define BOOST_IOSTREAMS_COMPONENT_TYPE(chain, index) \ + chain.component_type( index ) \ + /**/ + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) +# define BOOST_IOSTREAMS_COMPONENT(chain, index, target) \ + chain.component< target >( index ) \ + /**/ +#else +# define BOOST_IOSTREAMS_COMPONENT(chain, index, target) \ + chain.component( index, ::boost::type< target >() ) \ + /**/ +#endif + +namespace boost { namespace iostreams { + +//--------------Definition of chain and wchain--------------------------------// + +namespace detail { + +template class chain_client; + +// +// Concept name: Chain. +// Description: Represents a chain of stream buffers which provides access +// to the first buffer in the chain and send notifications when the +// streambufs are added to or removed from chain. +// Refines: Closable device with mode equal to typename Chain::mode. +// Models: chain, converting_chain. +// Example: +// +// class chain { +// public: +// typedef xxx chain_type; +// typedef xxx client_type; +// typedef xxx mode; +// bool is_complete() const; // Ready for i/o. +// template +// void push( const T& t, // Adds a stream buffer to +// streamsize, // chain, based on t, with +// streamsize ); // given buffer and putback +// // buffer sizes. Pass -1 to +// // request default size. +// protected: +// void register_client(client_type* client); // Associate client. +// void notify(); // Notify client. +// }; +// + +// +// Description: Represents a chain of filters with an optional device at the +// end. +// Template parameters: +// Self - A class deriving from the current instantiation of this template. +// This is an example of the Curiously Recurring Template Pattern. +// Ch - The character type. +// Tr - The character traits type. +// Alloc - The allocator type. +// Mode - A mode tag. +// +template +class chain_base { +public: + typedef Ch char_type; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) + typedef Alloc allocator_type; + typedef Mode mode; + struct category + : Mode, + device_tag + { }; + typedef chain_client client_type; + friend class chain_client; +private: + typedef linked_streambuf streambuf_type; + typedef std::list list_type; + typedef chain_base my_type; +protected: + chain_base() : pimpl_(new chain_impl) { } + chain_base(const chain_base& rhs): pimpl_(rhs.pimpl_) { } +public: + + //----------Buffer sizing-------------------------------------------------// + + // Sets the size of the buffer created for the devices to be added to this + // chain. Does not affect the size of the buffer for devices already + // added. + void set_device_buffer_size(int n) { pimpl_->device_buffer_size_ = n; } + + // Sets the size of the buffer created for the filters to be added + // to this chain. Does not affect the size of the buffer for filters already + // added. + void set_filter_buffer_size(int n) { pimpl_->filter_buffer_size_ = n; } + + // Sets the size of the putback buffer for filters and devices to be added + // to this chain. Does not affect the size of the buffer for filters or + // devices already added. + void set_pback_size(int n) { pimpl_->pback_size_ = n; } + + //----------Device interface----------------------------------------------// + + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); + + //----------Direct component access---------------------------------------// + + const std::type_info& component_type(int n) const + { + if (static_cast(n) >= size()) + throw std::out_of_range("bad chain offset"); + return (*boost::next(list().begin(), n))->component_type(); + } + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) + // Deprecated. + template + const std::type_info& component_type() const { return component_type(N); } + + template + T* component(int n) const { return component(n, boost::type()); } + + // Deprecated. + template + T* component() const { return component(N); } +#endif + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) + private: +#endif + template + T* component(int n, boost::type) const + { + if (static_cast(n) >= size()) + throw std::out_of_range("bad chain offset"); + streambuf_type* link = *boost::next(list().begin(), n); + if (BOOST_IOSTREAMS_COMPARE_TYPE_ID(link->component_type(), typeid(T))) + return static_cast(link->component_impl()); + else + return 0; + } +public: + + //----------Container-like interface--------------------------------------// + + typedef typename list_type::size_type size_type; + streambuf_type& front() { return *list().front(); } + BOOST_IOSTREAMS_DEFINE_PUSH(push, mode, char_type, push_impl) + void pop(); + bool empty() const { return list().empty(); } + size_type size() const { return list().size(); } + void reset(); + + //----------Additional i/o functions--------------------------------------// + + // Returns true if this chain is non-empty and its final link + // is a source or sink, i.e., if it is ready to perform i/o. + bool is_complete() const; + bool auto_close() const; + void set_auto_close(bool close); + bool sync() { return front().BOOST_IOSTREAMS_PUBSYNC() != -1; } + bool strict_sync(); +private: + template + void push_impl(const T& t, int buffer_size = -1, int pback_size = -1) + { + typedef typename iostreams::category_of::type category; + typedef typename unwrap_ios::type policy_type; + typedef stream_buffer< + policy_type, + BOOST_IOSTREAMS_CHAR_TRAITS(char_type), + Alloc, Mode + > streambuf_t; + typedef typename list_type::iterator iterator; + BOOST_STATIC_ASSERT((is_convertible::value)); + if (is_complete()) + throw std::logic_error("chain complete"); + streambuf_type* prev = !empty() ? list().back() : 0; + buffer_size = + buffer_size != -1 ? + buffer_size : + iostreams::optimal_buffer_size(t); + pback_size = + pback_size != -1 ? + pback_size : + pimpl_->pback_size_; + std::auto_ptr + buf(new streambuf_t(t, buffer_size, pback_size)); + list().push_back(buf.get()); + buf.release(); + if (is_device::value) { + pimpl_->flags_ |= f_complete | f_open; + for ( iterator first = list().begin(), + last = list().end(); + first != last; + ++first ) + { + (*first)->set_needs_close(); + } + } + if (prev) prev->set_next(list().back()); + notify(); + } + + list_type& list() { return pimpl_->links_; } + const list_type& list() const { return pimpl_->links_; } + void register_client(client_type* client) { pimpl_->client_ = client; } + void notify() { if (pimpl_->client_) pimpl_->client_->notify(); } + + //----------Nested classes------------------------------------------------// + + static void close(streambuf_type* b, BOOST_IOS::openmode m) + { + if (m == BOOST_IOS::out && is_convertible::value) + b->BOOST_IOSTREAMS_PUBSYNC(); + b->close(m); + } + + static void set_next(streambuf_type* b, streambuf_type* next) + { b->set_next(next); } + + static void set_auto_close(streambuf_type* b, bool close) + { b->set_auto_close(close); } + + struct closer : public std::unary_function { + closer(BOOST_IOS::openmode m) : mode_(m) { } + void operator() (streambuf_type* b) + { + close(b, mode_); + } + BOOST_IOS::openmode mode_; + }; + friend struct closer; + + enum flags { + f_complete = 1, + f_open = 2, + f_auto_close = 4 + }; + + struct chain_impl { + chain_impl() + : client_(0), device_buffer_size_(default_device_buffer_size), + filter_buffer_size_(default_filter_buffer_size), + pback_size_(default_pback_buffer_size), + flags_(f_auto_close) + { } + ~chain_impl() { try { close(); reset(); } catch (...) { } } + void close() + { + if ((flags_ & f_open) != 0) { + flags_ &= ~f_open; + stream_buffer< basic_null_device > null; + if ((flags_ & f_complete) == 0) { + null.open(basic_null_device()); + set_next(links_.back(), &null); + } + links_.front()->BOOST_IOSTREAMS_PUBSYNC(); + try { + boost::iostreams::detail::execute_foreach( + links_.rbegin(), links_.rend(), + closer(BOOST_IOS::in) + ); + } catch (...) { + try { + boost::iostreams::detail::execute_foreach( + links_.begin(), links_.end(), + closer(BOOST_IOS::out) + ); + } catch (...) { } + throw; + } + boost::iostreams::detail::execute_foreach( + links_.begin(), links_.end(), + closer(BOOST_IOS::out) + ); + } + } + void reset() + { + typedef typename list_type::iterator iterator; + for ( iterator first = links_.begin(), + last = links_.end(); + first != last; + ++first ) + { + if ( (flags_ & f_complete) == 0 || + (flags_ & f_auto_close) == 0 ) + { + set_auto_close(*first, false); + } + streambuf_type* buf = 0; + std::swap(buf, *first); + delete buf; + } + links_.clear(); + flags_ &= ~f_complete; + flags_ &= ~f_open; + } + list_type links_; + client_type* client_; + int device_buffer_size_, + filter_buffer_size_, + pback_size_; + int flags_; + }; + friend struct chain_impl; + + //----------Member data---------------------------------------------------// + +private: + shared_ptr pimpl_; +}; + +} // End namespace detail. + +// +// Macro: BOOST_IOSTREAMS_DECL_CHAIN(name, category) +// Description: Defines a template derived from chain_base appropriate for a +// particular i/o category. The template has the following parameters: +// Ch - The character type. +// Tr - The character traits type. +// Alloc - The allocator type. +// Macro parameters: +// name_ - The name of the template to be defined. +// category_ - The i/o category of the template to be defined. +// +#define BOOST_IOSTREAMS_DECL_CHAIN(name_, default_char_) \ + template< typename Mode, typename Ch = default_char_, \ + typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS(Ch), \ + typename Alloc = std::allocator > \ + class name_ : public boost::iostreams::detail::chain_base< \ + name_, \ + Ch, Tr, Alloc, Mode \ + > \ + { \ + public: \ + struct category : device_tag, Mode { }; \ + typedef Mode mode; \ + private: \ + typedef boost::iostreams::detail::chain_base< \ + name_, \ + Ch, Tr, Alloc, Mode \ + > base_type; \ + public: \ + typedef Ch char_type; \ + typedef Tr traits_type; \ + typedef typename traits_type::int_type int_type; \ + typedef typename traits_type::off_type off_type; \ + name_() { } \ + name_(const name_& rhs) { *this = rhs; } \ + name_& operator=(const name_& rhs) \ + { base_type::operator=(rhs); return *this; } \ + }; \ + /**/ +BOOST_IOSTREAMS_DECL_CHAIN(chain, char) +BOOST_IOSTREAMS_DECL_CHAIN(wchain, wchar_t) +#undef BOOST_IOSTREAMS_DECL_CHAIN + +//--------------Definition of chain_client------------------------------------// + +namespace detail { + +// +// Template name: chain_client +// Description: Class whose instances provide access to an underlying chain +// using an interface similar to the chains. +// Subclasses: the various stream and stream buffer templates. +// +template +class chain_client { +public: + typedef Chain chain_type; + typedef typename chain_type::char_type char_type; + typedef typename chain_type::traits_type traits_type; + typedef typename chain_type::size_type size_type; + typedef typename chain_type::mode mode; + + chain_client(chain_type* chn = 0) : chain_(chn ) { } + chain_client(chain_client* client) : chain_(client->chain_) { } + virtual ~chain_client() { } + + const std::type_info& component_type(int n) const + { return chain_->component_type(n); } + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) + // Deprecated. + template + const std::type_info& component_type() const + { return chain_->BOOST_NESTED_TEMPLATE component_type(); } + + template + T* component(int n) const + { return chain_->BOOST_NESTED_TEMPLATE component(n); } + + // Deprecated. + template + T* component() const + { return chain_->BOOST_NESTED_TEMPLATE component(); } +#else + template + T* component(int n, boost::type t) const + { return chain_->component(n, t); } +#endif + + bool is_complete() const { return chain_->is_complete(); } + bool auto_close() const { return chain_->auto_close(); } + void set_auto_close(bool close) { chain_->set_auto_close(close); } + bool strict_sync() { return chain_->strict_sync(); } + void set_device_buffer_size(std::streamsize n) + { chain_->set_device_buffer_size(n); } + void set_filter_buffer_size(std::streamsize n) + { chain_->set_filter_buffer_size(n); } + void set_pback_size(std::streamsize n) { chain_->set_pback_size(n); } + BOOST_IOSTREAMS_DEFINE_PUSH(push, mode, char_type, push_impl) + void pop() { chain_->pop(); } + bool empty() const { return chain_->empty(); } + size_type size() { return chain_->size(); } + void reset() { chain_->reset(); } + + // Returns a copy of the underlying chain. + chain_type filters() { return *chain_; } + chain_type filters() const { return *chain_; } +protected: + template + void push_impl(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()) + { chain_->push(t BOOST_IOSTREAMS_PUSH_ARGS()); } + chain_type& ref() { return *chain_; } + void set_chain(chain_type* c) + { chain_ = c; chain_->register_client(this); } +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) && \ + (!BOOST_WORKAROUND(__BORLANDC__, < 0x600)) + template + friend class chain_base; +#else + public: +#endif + virtual void notify() { } +private: + chain_type* chain_; +}; + +//--------------Implementation of chain_base----------------------------------// + +template +inline std::streamsize chain_base::read + (char_type* s, std::streamsize n) +{ return iostreams::read(*list().front(), s, n); } + +template +inline std::streamsize chain_base::write + (const char_type* s, std::streamsize n) +{ return iostreams::write(*list().front(), s, n); } + +template +inline std::streampos chain_base::seek + (stream_offset off, BOOST_IOS::seekdir way) +{ return iostreams::seek(*list().front(), off, way); } + +template +void chain_base::reset() +{ + using namespace std; + pimpl_->close(); + pimpl_->reset(); +} + +template +bool chain_base::is_complete() const +{ + return (pimpl_->flags_ & f_complete) != 0; +} + +template +bool chain_base::auto_close() const +{ + return (pimpl_->flags_ & f_auto_close) != 0; +} + +template +void chain_base::set_auto_close(bool close) +{ + pimpl_->flags_ = + (pimpl_->flags_ & ~f_auto_close) | + (close ? f_auto_close : 0); +} + +template +bool chain_base::strict_sync() +{ + typedef typename list_type::iterator iterator; + bool result = true; + for ( iterator first = list().begin(), + last = list().end(); + first != last; + ++first ) + { + bool s = (*first)->strict_sync(); + result = result && s; + } + return result; +} + +template +void chain_base::pop() +{ + assert(!empty()); + if (auto_close()) + pimpl_->close(); + streambuf_type* buf = 0; + std::swap(buf, list().back()); + buf->set_auto_close(false); + buf->set_next(0); + delete buf; + list().pop_back(); + pimpl_->flags_ &= ~f_complete; + if (auto_close() || list().empty()) + pimpl_->flags_ &= ~f_open; +} + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CHAIN_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/char_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/char_traits.hpp new file mode 100644 index 0000000000..4234907e47 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/char_traits.hpp @@ -0,0 +1,73 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED +#define BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include // EOF. +#include // std::char_traits. +#include +#include +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS +# include +#endif + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::wint_t; } +#endif + +namespace boost { namespace iostreams { + +// Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines +// the EOF and WEOF macros to not std:: qualify the wint_t type (and so does +// Sun C++ 5.8 + STLport 4). Fix by placing the def in this scope. +// NOTE: Use BOOST_WORKAROUND? +#if (defined(__QNX__) && defined(BOOST_DINKUMWARE_STDLIB)) \ + || defined(__SUNPRO_CC) +using ::std::wint_t; +#endif + +const int WOULD_BLOCK = (int) (EOF - 1); + +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS +const std::wint_t WWOULD_BLOCK = (std::wint_t) (WEOF - 1); +#endif + +template +struct char_traits; + +template<> +struct char_traits : BOOST_IOSTREAMS_CHAR_TRAITS(char) { + static char newline() { return '\n'; } + static int good() { return '\n'; } + static int would_block() { return WOULD_BLOCK; } + static bool is_good(int c) { return c != EOF && c != WOULD_BLOCK; } + static bool is_eof(int c) { return c == EOF; } + static bool would_block(int c) { return c == WOULD_BLOCK; } +}; + +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS +template<> +struct char_traits : std::char_traits { + static wchar_t newline() { return L'\n'; } + static std::wint_t good() { return L'\n'; } + static std::wint_t would_block() { return WWOULD_BLOCK; } + static bool is_good(std::wint_t c) { return c != WEOF && c != WWOULD_BLOCK; } + static bool is_eof(std::wint_t c) { return c == WEOF; } + static bool would_block(std::wint_t c) { return c == WWOULD_BLOCK; } +}; +#endif + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_CHAR_TRAITS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/checked_operations.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/checked_operations.hpp new file mode 100644 index 0000000000..2c999c370a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/checked_operations.hpp @@ -0,0 +1,151 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains implementations of get, read, put, write and seek which +// check a device's mode at runtime instead of compile time. + +#ifndef BOOST_IOSTREAMS_DETAIL_CHECKED_OPERATIONS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CHECKED_OPERATIONS_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct read_write_if_impl; + +template +struct seek_if_impl; + +} // End namespace detail. + +template +typename int_type_of::type get_if(T& t) +{ + typedef typename detail::dispatch::type tag; + return detail::read_write_if_impl::get(t); +} + +template +inline std::streamsize +read_if(T& t, typename char_type_of::type* s, std::streamsize n) +{ + typedef typename detail::dispatch::type tag; + return detail::read_write_if_impl::read(t, s, n); +} + +template +bool put_if(T& t, typename char_type_of::type c) +{ + typedef typename detail::dispatch::type tag; + return detail::read_write_if_impl::put(t, c); +} + +template +inline std::streamsize write_if + (T& t, const typename char_type_of::type* s, std::streamsize n) +{ + typedef typename detail::dispatch::type tag; + return detail::read_write_if_impl::write(t, s, n); +} + +template +inline std::streampos +seek_if( T& t, stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) +{ + using namespace detail; + typedef typename dispatch::type tag; + return seek_if_impl::seek(t, off, way, which); +} + +namespace detail { + +//------------------Specializations of read_write_if_impl---------------------// + +template<> +struct read_write_if_impl { + template + static typename int_type_of::type get(T& t) + { return iostreams::get(t); } + + template + static std::streamsize + read(T& t, typename char_type_of::type* s, std::streamsize n) + { return iostreams::read(t, s, n); } + + template + static bool put(T&, typename char_type_of::type) + { throw cant_write(); } + + template + static std::streamsize + write(T&, const typename char_type_of::type*, std::streamsize) + { throw cant_write(); } +}; + +template<> +struct read_write_if_impl { + template + static typename int_type_of::type get(T&) + { throw cant_read(); } + + template + static std::streamsize + read(T&, typename char_type_of::type*, std::streamsize) + { throw cant_read(); } + + template + static bool put(T& t, typename char_type_of::type c) + { return iostreams::put(t, c); } + + template + static std::streamsize + write( T& t, const typename char_type_of::type* s, + std::streamsize n ) + { return iostreams::write(t, s, n); } +}; + +//------------------Specializations of seek_if_impl---------------------------// + +template<> +struct seek_if_impl { + template + static std::streampos + seek( T& t, stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) + { return iostreams::seek(t, off, way, which); } +}; + +template<> +struct seek_if_impl { + template + static std::streampos + seek(T&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode) + { throw cant_seek(); } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CHECKED_OPERATIONS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/close.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/close.hpp new file mode 100644 index 0000000000..b17d751116 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/close.hpp @@ -0,0 +1,260 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_CLOSE_HPP_INCLUDED +#define BOOST_IOSTREAMS_CLOSE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include +#include +#include // BOOST_IOS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +template +void close(T& t); + +template +void close(T& t, BOOST_IOS::openmode which); + +template +void close(T& t, Sink& snk, BOOST_IOS::openmode which); + +namespace detail { + +template +void close_all(T& t) +{ + try { + boost::iostreams::close(t, BOOST_IOS::in); + } catch (...) { + try { + boost::iostreams::close(t, BOOST_IOS::out); + } catch (...) { } + throw; + } + boost::iostreams::close(t, BOOST_IOS::out); +} + +template +void close_all(T& t, Sink& snk) +{ + try { + boost::iostreams::close(t, snk, BOOST_IOS::in); + } catch (...) { + try { + boost::iostreams::close(t, snk, BOOST_IOS::out); + } catch (...) { } + throw; + } + boost::iostreams::close(t, snk, BOOST_IOS::out); +} + +} // End namespaces detail. + +} } // End namespaces iostreams, boost. + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-----------------------------------// +# include +#else // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //--------------------------// + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct close_impl; + +} // End namespace detail. + +template +void close(T& t) { detail::close_all(t); } + +template +void close(T& t, BOOST_IOS::openmode which) +{ +#ifdef BOOST_IOSTREAMS_STRICT + assert(which == BOOST_IOS::in || which == BOOST_IOS::out); +#else + if (which == (BOOST_IOS::in | BOOST_IOS::out)) { + detail::close_all(t); + return; + } +#endif + detail::close_impl::close(detail::unwrap(t), which); +} + +template +void close(T& t, Sink& snk, BOOST_IOS::openmode which) +{ +#ifdef BOOST_IOSTREAMS_STRICT + assert(which == BOOST_IOS::in || which == BOOST_IOS::out); +#else + if (which == (BOOST_IOS::in | BOOST_IOS::out)) { + detail::close_all(t, snk); + return; + } +#endif + detail::close_impl::close(detail::unwrap(t), snk, which); +} + +namespace detail { + +//------------------Definition of close_impl----------------------------------// + +struct close_boost_stream { }; +struct close_filtering_stream { }; + +template +struct close_tag { + typedef typename category_of::type category; + typedef typename detail::unwrapped_type::type unwrapped; + typedef typename + iostreams::select< + mpl::not_< is_convertible >, + any_tag, + mpl::or_< + is_boost_stream, + is_boost_stream_buffer + >, + close_boost_stream, + mpl::or_< + is_filtering_stream, + is_filtering_streambuf + >, + close_filtering_stream, + mpl::or_< + is_convertible, + is_convertible + >, + two_sequence, + else_, + closable_tag + >::type type; +}; + +template +struct close_impl + : mpl::if_< + is_custom, + operations, + close_impl::type> + >::type + { }; + +template<> +struct close_impl { + template + static void close(T& t, BOOST_IOS::openmode which) + { + if (which == BOOST_IOS::out) + iostreams::flush(t); + } + + template + static void close(T& t, Sink& snk, BOOST_IOS::openmode which) + { + if (which == BOOST_IOS::out) { + non_blocking_adapter nb(snk); + iostreams::flush(t, nb); + } + } +}; + +template<> +struct close_impl { + template + static void close(T& t) + { + t.close(); + } + template + static void close(T& t, BOOST_IOS::openmode which) + { + if (which == BOOST_IOS::out) + t.close(); + } +}; + +template<> +struct close_impl { + template + static void close(T& t, BOOST_IOS::openmode which) + { + typedef typename category_of::type category; + const bool in = is_convertible::value && + !is_convertible::value; + if (in == (which == BOOST_IOS::in) && t.is_complete()) + t.pop(); + } +}; + +#include // Borland. +template<> +struct close_impl { + template + static void close(T& t, BOOST_IOS::openmode which) + { + typedef typename category_of::type category; + const bool in = is_convertible::value && + !is_convertible::value; + if (in == (which == BOOST_IOS::in)) + t.close(); + } + template + static void close(T& t, Sink& snk, BOOST_IOS::openmode which) + { + typedef typename category_of::type category; + const bool in = is_convertible::value && + !is_convertible::value; + if (in == (which == BOOST_IOS::in)) { + non_blocking_adapter nb(snk); + t.close(nb); + } + } +}; + +template<> +struct close_impl { + template + static void close(T& t, BOOST_IOS::openmode which) { t.close(which); } + template + static void close(T& t, Sink& snk, BOOST_IOS::openmode which) + { + non_blocking_adapter nb(snk); + t.close(nb, which); + } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-------------------------// + +#include + +#endif // #ifndef BOOST_IOSTREAMS_CLOSE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/code_converter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/code_converter.hpp new file mode 100644 index 0000000000..f9f6c2af67 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/code_converter.hpp @@ -0,0 +1,422 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains machinery for performing code conversion. + +#ifndef BOOST_IOSTREAMS_CODE_CONVERTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_CODE_CONVERTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#if defined(BOOST_IOSTREAMS_NO_WIDE_STREAMS) || \ + defined(BOOST_IOSTREAMS_NO_LOCALE) \ + /**/ +# error code conversion not supported on this platform +#endif + +#include // max. +#include // memcpy. +#include +#include // DEDUCED_TYPENAME, +#include +#include // default_filter_buffer_size. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // failure, openmode, int types. +#include +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include // Borland 5.x + +namespace boost { namespace iostreams { + +struct code_conversion_error : BOOST_IOSTREAMS_FAILURE { + code_conversion_error() + : BOOST_IOSTREAMS_FAILURE("code conversion error") + { } +}; + +namespace detail { + +//--------------Definition of strncpy_if_same---------------------------------// + +// Helper template for strncpy_if_same, below. +template +struct strncpy_if_same_impl; + +template<> +struct strncpy_if_same_impl { + template + static Ch* copy(Ch* tgt, const Ch* src, std::streamsize n) + { return BOOST_IOSTREAMS_CHAR_TRAITS(Ch)::copy(tgt, src, n); } +}; + +template<> +struct strncpy_if_same_impl { + template + static Tgt* copy(Tgt* tgt, const Src*, std::streamsize) { return tgt; } +}; + +template +Tgt* strncpy_if_same(Tgt* tgt, const Src* src, std::streamsize n) +{ + typedef strncpy_if_same_impl::value> impl; + return impl::copy(tgt, src, n); +} + +//--------------Definition of conversion_buffer-------------------------------// + +// Buffer and conversion state for reading. +template +class conversion_buffer + : public buffer< + BOOST_DEDUCED_TYPENAME detail::codecvt_extern::type, + Alloc + > +{ +public: + typedef typename Codecvt::state_type state_type; + conversion_buffer() + : buffer< + BOOST_DEDUCED_TYPENAME detail::codecvt_extern::type, + Alloc + >(0) + { + reset(); + } + state_type& state() { return state_; } + void reset() + { + if (this->size()) + this->set(0, 0); + state_ = state_type(); + } +private: + state_type state_; +}; + +//--------------Definition of converter_impl----------------------------------// + +// Contains member data, open/is_open/close and buffer management functions. +template +struct code_converter_impl { + typedef typename codecvt_extern::type extern_type; + typedef typename category_of::type device_category; + typedef is_convertible can_read; + typedef is_convertible can_write; + typedef is_convertible is_bidir; + typedef typename + iostreams::select< // Disambiguation for Tru64. + is_bidir, bidirectional, + can_read, input, + can_write, output + >::type mode; + typedef typename + mpl::if_< + is_direct, + direct_adapter, + Device + >::type policy_type; + typedef optional< concept_adapter > storage_type; + typedef is_convertible is_double; + typedef conversion_buffer buffer_type; + + code_converter_impl() : cvt_(), flags_(0) { } + + ~code_converter_impl() + { + try { + if (flags_ & f_open) close(); + } catch (...) { /* */ } + } + + void open(const Device& dev, int buffer_size) + { + if (flags_ & f_open) + throw BOOST_IOSTREAMS_FAILURE("already open"); + if (buffer_size == -1) + buffer_size = default_filter_buffer_size; + int max_length = cvt_.get().max_length(); + buffer_size = (std::max)(buffer_size, 2 * max_length); + if (can_read::value) { + buf_.first().resize(buffer_size); + buf_.first().set(0, 0); + } + if (can_write::value && !is_double::value) { + buf_.second().resize(buffer_size); + buf_.second().set(0, 0); + } + dev_.reset(concept_adapter(dev)); + flags_ = f_open; + } + + void close() + { + detail::execute_all( + detail::call_member_close(*this, BOOST_IOS::in), + detail::call_member_close(*this, BOOST_IOS::out) + ); + } + + void close(BOOST_IOS::openmode which) + { + if (which == BOOST_IOS::in && (flags_ & f_input_closed) == 0) { + flags_ |= f_input_closed; + iostreams::close(dev(), BOOST_IOS::in); + } + if (which == BOOST_IOS::out && (flags_ & f_output_closed) == 0) { + flags_ |= f_output_closed; + detail::execute_all( + detail::flush_buffer(buf_.second(), dev(), can_write::value), + detail::call_close(dev(), BOOST_IOS::out), + detail::call_reset(dev_), + detail::call_reset(buf_.first()), + detail::call_reset(buf_.second()) + ); + } + } + + bool is_open() const { return (flags_ & f_open) != 0;} + + policy_type& dev() { return **dev_; } + + enum flag_type { + f_open = 1, + f_input_closed = f_open << 1, + f_output_closed = f_input_closed << 1 + }; + + codecvt_holder cvt_; + storage_type dev_; + double_object< + buffer_type, + is_double + > buf_; + int flags_; +}; + +} // End namespace detail. + +//--------------Definition of converter---------------------------------------// + +#define BOOST_IOSTREAMS_CONVERTER_PARAMS() , int buffer_size = -1 +#define BOOST_IOSTREAMS_CONVERTER_ARGS() , buffer_size + +template +struct code_converter_base { + typedef detail::code_converter_impl< + Device, Codecvt, Alloc + > impl_type; + code_converter_base() : pimpl_(new impl_type) { } + shared_ptr pimpl_; +}; + +template< typename Device, + typename Codecvt = detail::default_codecvt, + typename Alloc = std::allocator > +class code_converter + : protected code_converter_base +{ +private: + typedef detail::code_converter_impl< + Device, Codecvt, Alloc + > impl_type; + typedef typename impl_type::policy_type policy_type; + typedef typename impl_type::buffer_type buffer_type; + typedef typename detail::codecvt_holder::codecvt_type codecvt_type; + typedef typename detail::codecvt_intern::type intern_type; + typedef typename detail::codecvt_extern::type extern_type; + typedef typename detail::codecvt_state::type state_type; +public: + typedef intern_type char_type; + struct category + : impl_type::mode, device_tag, closable_tag, localizable_tag + { }; + BOOST_STATIC_ASSERT(( + is_same< + extern_type, + BOOST_DEDUCED_TYPENAME char_type_of::type + >::value + )); +public: + code_converter() { } +#if BOOST_WORKAROUND(__GNUC__, < 3) + code_converter(code_converter& rhs) + : code_converter_base(rhs) + { } + code_converter(const code_converter& rhs) + : code_converter_base(rhs) + { } +#endif + BOOST_IOSTREAMS_FORWARD( code_converter, open_impl, Device, + BOOST_IOSTREAMS_CONVERTER_PARAMS, + BOOST_IOSTREAMS_CONVERTER_ARGS ) + + // fstream-like interface. + + bool is_open() const { return this->pimpl_->is_open(); } + void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) + { impl().close(which); } + + // Device interface. + + std::streamsize read(char_type*, std::streamsize); + std::streamsize write(const char_type*, std::streamsize); + void imbue(const std::locale& loc) { impl().cvt_.imbue(loc); } + + // Direct device access. + + Device& operator*() { return detail::unwrap_direct(dev()); } + Device* operator->() { return &detail::unwrap_direct(dev()); } +private: + template // Used for forwarding. + void open_impl(const T& t BOOST_IOSTREAMS_CONVERTER_PARAMS()) + { + impl().open(t BOOST_IOSTREAMS_CONVERTER_ARGS()); + } + + const codecvt_type& cvt() { return impl().cvt_.get(); } + policy_type& dev() { return impl().dev(); } + buffer_type& in() { return impl().buf_.first(); } + buffer_type& out() { return impl().buf_.second(); } + impl_type& impl() { return *this->pimpl_; } +}; + +//--------------Implementation of converter-----------------------------------// + +// Implementation note: if end of stream contains a partial character, +// it is ignored. +template +std::streamsize code_converter::read + (char_type* s, std::streamsize n) +{ + const extern_type* next; // Next external char. + intern_type* nint; // Next internal char. + std::streamsize total = 0; // Characters read. + int status = iostreams::char_traits::good(); + bool partial = false; + buffer_type& buf = in(); + + do { + + // Fill buffer. + if (buf.ptr() == buf.eptr() || partial) { + status = buf.fill(dev()); + if (buf.ptr() == buf.eptr()) + break; + partial = false; + } + + // Convert. + std::codecvt_base::result result = + cvt().in( buf.state(), + buf.ptr(), buf.eptr(), next, + s + total, s + n, nint ); + buf.ptr() += next - buf.ptr(); + total = static_cast(nint - s); + + switch (result) { + case std::codecvt_base::partial: + partial = true; + break; + case std::codecvt_base::ok: + break; + case std::codecvt_base::noconv: + { + std::streamsize amt = + std::min(next - buf.ptr(), n - total); + detail::strncpy_if_same(s + total, buf.ptr(), amt); + total += amt; + } + break; + case std::codecvt_base::error: + default: + buf.state() = state_type(); + throw code_conversion_error(); + } + + } while (total < n && status != EOF && status != WOULD_BLOCK); + + return total == 0 && status == EOF ? -1 : total; +} + +template +std::streamsize code_converter::write + (const char_type* s, std::streamsize n) +{ + buffer_type& buf = out(); + extern_type* next; // Next external char. + const intern_type* nint; // Next internal char. + std::streamsize total = 0; // Characters written. + bool partial = false; + + while (total < n) { + + // Empty buffer. + if (buf.eptr() == buf.end() || partial) { + if (!buf.flush(dev())) + break; + partial = false; + } + + // Convert. + std::codecvt_base::result result = + cvt().out( buf.state(), + s + total, s + n, nint, + buf.eptr(), buf.end(), next ); + int progress = (int) (next - buf.eptr()); + buf.eptr() += progress; + + switch (result) { + case std::codecvt_base::partial: + partial = true; // Fall through. + case std::codecvt_base::ok: + total = static_cast(nint - s); + break; + case std::codecvt_base::noconv: + { + std::streamsize amt = + std::min( nint - total - s, + buf.end() - buf.eptr() ); + detail::strncpy_if_same(buf.eptr(), s + total, amt); + total += amt; + } + break; + case std::codecvt_base::error: + default: + buf.state() = state_type(); + throw code_conversion_error(); + } + } + return total; +} + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#include // Borland 5.x + +#endif // #ifndef BOOST_IOSTREAMS_CODE_CONVERTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/combine.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/combine.hpp new file mode 100644 index 0000000000..fc7f7c7957 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/combine.hpp @@ -0,0 +1,249 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// To do: add support for random-access. + +#ifndef BOOST_IOSTREAMS_COMBINE_HPP_INCLUDED +#define BOOST_IOSTREAMS_COMBINE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // NO_STD_LOCALE, DEDUCED_TYPENAME. +#ifndef BOOST_NO_STD_LOCALE +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +namespace detail { + +// +// Template name: combined_device. +// Description: Model of Device defined in terms of a Source/Sink pair. +// Template paramters: +// Source - A model of Source, with the same char_type and traits_type +// as Sink. +// Sink - A model of Sink, with the same char_type and traits_type +// as Source. +// +template +class combined_device { +public: + typedef typename char_type_of::type char_type; + struct category + : bidirectional, + device_tag, + closable_tag, + localizable_tag + { }; + combined_device(const Source& src, const Sink& snk); + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + void close(BOOST_IOS::openmode); + #ifndef BOOST_NO_STD_LOCALE + void imbue(const std::locale& loc); + #endif +private: + typedef typename char_type_of::type sink_char_type; + BOOST_STATIC_ASSERT((is_same::value)); + Source src_; + Sink sink_; +}; + +// +// Template name: combined_filter. +// Description: Model of Device defined in terms of a Source/Sink pair. +// Template paramters: +// InputFilter - A model of InputFilter, with the same char_type as +// OutputFilter. +// OutputFilter - A model of OutputFilter, with the same char_type as +// InputFilter. +// +template +class combined_filter { +private: + typedef typename category_of::type in_category; + typedef typename category_of::type out_category; +public: + typedef typename char_type_of::type char_type; + struct category + : multichar_bidirectional_filter_tag, + closable_tag, + localizable_tag + { }; + combined_filter(const InputFilter& in, const OutputFilter& out); + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { return boost::iostreams::read(in_, src, s, n); } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { return boost::iostreams::write(out_, snk, s, n); } + + template + void close(Sink& snk, BOOST_IOS::openmode which) + { + if (which == BOOST_IOS::in) { + if (is_convertible::value) { + iostreams::close(in_, snk, BOOST_IOS::in); + } else { + detail::close_all(in_, snk); + } + } + if (which == BOOST_IOS::out) { + if (is_convertible::value) { + iostreams::close(out_, snk, BOOST_IOS::out); + } else { + detail::close_all(out_, snk); + } + } + } + #ifndef BOOST_NO_STD_LOCALE + void imbue(const std::locale& loc); + #endif +private: + typedef typename char_type_of::type output_char_type; + BOOST_STATIC_ASSERT((is_same::value)); + InputFilter in_; + OutputFilter out_; +}; + +template +struct combination_traits + : mpl::if_< + is_device, + combined_device< + typename wrapped_type::type, + typename wrapped_type::type + >, + combined_filter< + typename wrapped_type::type, + typename wrapped_type::type + > + > + { }; + +} // End namespace detail. + +template +struct combination : detail::combination_traits::type { + typedef typename detail::combination_traits::type base_type; + typedef typename detail::wrapped_type::type in_type; + typedef typename detail::wrapped_type::type out_type; + combination(const in_type& in, const out_type& out) + : base_type(in, out) { } +}; + +namespace detail { + +// Workaround for VC6 ETI bug. +template +struct combine_traits { + typedef combination< + BOOST_DEDUCED_TYPENAME detail::unwrapped_type::type, + BOOST_DEDUCED_TYPENAME detail::unwrapped_type::type + > type; +}; + +} // End namespace detail. + +// +// Template name: combine. +// Description: Takes a Source/Sink pair or InputFilter/OutputFilter pair and +// returns a Reource or Filter which performs input using the first member +// of the pair and output using the second member of the pair. +// Template paramters: +// In - A model of Source or InputFilter, with the same char_type as Out. +// Out - A model of Sink or OutputFilter, with the same char_type as In. +// +template +typename detail::combine_traits::type +combine(const In& in, const Out& out) +{ + typedef typename detail::combine_traits::type return_type; + return return_type(in, out); +} + +//----------------------------------------------------------------------------// + +namespace detail { + +//--------------Implementation of combined_device-----------------------------// + +template +inline combined_device::combined_device + (const Source& src, const Sink& snk) + : src_(src), sink_(snk) { } + +template +inline std::streamsize +combined_device::read(char_type* s, std::streamsize n) +{ return iostreams::read(src_, s, n); } + +template +inline std::streamsize +combined_device::write(const char_type* s, std::streamsize n) +{ return iostreams::write(sink_, s, n); } + +template +inline void +combined_device::close(BOOST_IOS::openmode which) +{ + if (which == BOOST_IOS::in) + detail::close_all(src_); + if (which == BOOST_IOS::out) + detail::close_all(sink_); +} + +#ifndef BOOST_NO_STD_LOCALE + template + void combined_device::imbue(const std::locale& loc) + { + iostreams::imbue(src_, loc); + iostreams::imbue(sink_, loc); + } +#endif + +//--------------Implementation of filter_pair---------------------------------// + +template +inline combined_filter::combined_filter + (const InputFilter& in, const OutputFilter& out) : in_(in), out_(out) + { } + +#ifndef BOOST_NO_STD_LOCALE + template + void combined_filter::imbue + (const std::locale& loc) + { + iostreams::imbue(in_, loc); + iostreams::imbue(out_, loc); + } +#endif + + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_COMBINE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/compose.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/compose.hpp new file mode 100644 index 0000000000..167a047275 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/compose.hpp @@ -0,0 +1,490 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Note: bidirectional streams are not supported. + +#ifndef BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED +#define BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // min. +#include // pair. +#include // DEDUCED_TYPENAME. +#include +#include +#include +#include +#include +#include +#include +#include // mode_of, is_direct. +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +namespace detail { + +template< typename First, + typename Second, + typename FirstMode = + BOOST_DEDUCED_TYPENAME mode_of::type, + typename SecondMode = + BOOST_DEDUCED_TYPENAME mode_of::type > +struct composite_mode + : select< + is_convertible, FirstMode, + is_convertible, SecondMode, + is_convertible, input, + else_, output + > + { }; + +// +// Template name: composite_device. +// Description: Provides a Device view of a Filter, Device pair. +// Template paramters: +// Filter - A model of Filter. +// Device - An indirect model of Device. +// +template< typename Filter, + typename Device, + typename Mode = + BOOST_DEDUCED_TYPENAME composite_mode::type > +class composite_device { +private: + typedef typename detail::param_type::type param_type; + typedef typename mode_of::type filter_mode; + typedef typename mode_of::type device_mode; + typedef typename + iostreams::select< // Disambiguation for Tru64. + is_direct, direct_adapter, + is_std_io, Device&, + else_, Device + >::type value_type; +public: + typedef typename char_type_of::type char_type; + struct category + : Mode, + device_tag, + closable_tag, + flushable_tag, + localizable_tag, + optimally_buffered_tag + { }; + composite_device(const Filter& flt, param_type dev); + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); + + void close(); + void close(BOOST_IOS::openmode which); + bool flush(); + std::streamsize optimal_buffer_size() const; + + template // Avoid dependency on + void imbue(const Locale& loc) + { + iostreams::imbue(filter_, loc); + iostreams::imbue(device_, loc); + } + + Filter& first() { return filter_; } + Device& second() { return device_; } +private: + Filter filter_; + value_type device_; +}; + +// +// Template name: composite_device. +// Description: Provides a Device view of a Filter, Device pair. +// Template paramters: +// Filter - A model of Filter. +// Device - An indirect model of Device. +// +template< typename Filter1, + typename Filter2, + typename Mode = + BOOST_DEDUCED_TYPENAME composite_mode::type > +class composite_filter { +private: + typedef reference_wrapper filter_ref; + typedef typename mode_of::type first_mode; + typedef typename mode_of::type second_mode; + + // A dual-use filter cannot be composed with a read-write filter + BOOST_STATIC_ASSERT( + !(is_convertible::value) || + !(is_convertible::value) || + !(is_convertible::value) || + (is_convertible::value) + ); + BOOST_STATIC_ASSERT( + !(is_convertible::value) || + !(is_convertible::value) || + !(is_convertible::value) || + (is_convertible::value) + ); +public: + typedef typename char_type_of::type char_type; + struct category + : Mode, + filter_tag, + multichar_tag, + closable_tag, + flushable_tag, + localizable_tag, + optimally_buffered_tag + { }; + composite_filter(const Filter1& filter1, const Filter2& filter2) + : filter1_(filter1), filter2_(filter2) + { } + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + composite_device cmp(boost::ref(filter2_), src); + return iostreams::read(filter1_, cmp, s, n); + } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { + composite_device cmp(boost::ref(filter2_), snk); + return iostreams::write(filter1_, cmp, s, n); + } + + template + std::streampos seek( Device& dev, stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ) + { + composite_device cmp(boost::ref(filter2_), dev); + return iostreams::seek(filter1_, cmp, off, way, which); + } + + template + void close(Device& dev) + { + BOOST_STATIC_ASSERT((!is_convertible::value)); + BOOST_STATIC_ASSERT((!is_convertible::value)); + + // Create a new device by composing the second filter2_ with dev. + composite_device cmp(boost::ref(filter2_), dev); + + // Close input sequences in reverse order and output sequences in + // forward order + if (!is_convertible::value) { + detail::execute_all( + detail::call_close(filter2_, dev, BOOST_IOS::in), + detail::call_close(filter1_, cmp, BOOST_IOS::in), + detail::call_close(filter1_, cmp, BOOST_IOS::out), + detail::call_close(filter2_, dev, BOOST_IOS::out) + ); + } else if (is_convertible::value) { + detail::execute_all( + detail::call_close(filter2_, dev, BOOST_IOS::in), + detail::call_close(filter1_, cmp, BOOST_IOS::in) + ); + } else { + detail::execute_all( + detail::call_close(filter1_, cmp, BOOST_IOS::out), + detail::call_close(filter2_, dev, BOOST_IOS::out) + ); + } + } + + template + void close(Device& dev, BOOST_IOS::openmode which) + { + BOOST_STATIC_ASSERT( + (is_convertible::value) || + (is_convertible::value) + ); + + // Create a new device by composing the second filter2_ with dev. + composite_device cmp(boost::ref(filter2_), dev); + + // Close input sequences in reverse order + if ( which == BOOST_IOS::in && + ( !is_convertible::value || + is_convertible::value ) ) + { + detail::execute_all( + detail::call_close(filter2_, dev, BOOST_IOS::in), + detail::call_close(filter1_, cmp, BOOST_IOS::in) + ); + } + + // Close output sequences in forward order + if ( which == BOOST_IOS::out && + ( !is_convertible::value || + is_convertible::value ) ) + { + detail::execute_all( + detail::call_close(filter1_, cmp, BOOST_IOS::out), + detail::call_close(filter2_, dev, BOOST_IOS::out) + ); + } + } + + template + bool flush(Device& dev) + { + composite_device cmp(filter2_, dev); + return iostreams::flush(filter1_, cmp); + } + + std::streamsize optimal_buffer_size() const + { + std::streamsize first = iostreams::optimal_buffer_size(filter1_); + std::streamsize second = iostreams::optimal_buffer_size(filter2_); + return first < second ? second : first; + } + + template // Avoid dependency on + void imbue(const Locale& loc) + { // To do: consider using RAII. + iostreams::imbue(filter1_, loc); + iostreams::imbue(filter2_, loc); + } + + Filter1& first() { return filter1_; } + Filter2& second() { return filter2_; } +private: + Filter1 filter1_; + Filter2 filter2_; +}; + +template +struct composite_traits + : mpl::if_< + is_device, + composite_device, + composite_filter + > + { }; + +} // End namespace detail. + +template +struct composite : detail::composite_traits::type { + typedef typename detail::param_type::type param_type; + typedef typename detail::composite_traits::type base; + composite(const Filter& flt, param_type dev) + : base(flt, dev) + { } +}; + +//--------------Implementation of compose-------------------------------------// + +// Note: The following workarounds are patterned after resolve.hpp. It has not +// yet been confirmed that they are necessary. + +#ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //-------------------------// +# ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------------------// + +template +composite +compose( const Filter& filter, const FilterOrDevice& fod + BOOST_IOSTREAMS_DISABLE_IF_STREAM(FilterOrDevice) ) +{ return composite(filter, fod); } + +template +composite< Filter, std::basic_streambuf > +compose(const Filter& filter, std::basic_streambuf& sb) +{ return composite< Filter, std::basic_streambuf >(filter, sb); } + +template +composite< Filter, std::basic_istream > +compose(const Filter& filter, std::basic_istream& is) +{ return composite< Filter, std::basic_istream >(filter, is); } + +template +composite< Filter, std::basic_ostream > +compose(const Filter& filter, std::basic_ostream& os) +{ return composite< Filter, std::basic_ostream >(filter, os); } + +template +composite< Filter, std::basic_iostream > +compose(const Filter& filter, std::basic_iostream& io) +{ return composite< Filter, std::basic_iostream >(filter, io); } + +# else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //---------------------// + +template +composite +compose( const Filter& filter, const FilterOrDevice& fod + BOOST_IOSTREAMS_DISABLE_IF_STREAM(FilterOrDevice) ) +{ return composite(filter, fod); } + +template +composite +compose(const Filter& filter, std::streambuf& sb) +{ return composite(filter, sb); } + +template +composite +compose(const Filter& filter, std::istream& is) +{ return composite(filter, is); } + +template +composite +compose(const Filter& filter, std::ostream& os) +{ return composite(filter, os); } + +template +composite +compose(const Filter& filter, std::iostream& io) +{ return composite(filter, io); } + +# endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------// +#else // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //----------------// + +template +composite +compose(const Filter& flt, const Stream& strm, mpl::true_) +{ // Bad overload resolution. + return composite(flt, const_cast(strm)); +} + +template +composite +compose(const Filter& flt, const FilterOrDevice& fod, mpl::false_) +{ return composite(flt, fod); } + +template +composite +compose( const Filter& flt, const FilterOrDevice& fod + BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) ) +{ return compose(flt, fod, is_std_io()); } + +# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ + !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ + !defined(__GNUC__) // ---------------------------------------------------// + +template +composite +compose (const Filter& filter, FilterOrDevice& fod) +{ return composite(filter, fod); } + +# endif // Borland 5.x, VC6-7.0 or GCC 2.9x //--------------------------------// +#endif // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //---------------// + +//----------------------------------------------------------------------------// + +namespace detail { + +//--------------Implementation of composite_device---------------------------// + +template +composite_device::composite_device + (const Filter& flt, param_type dev) + : filter_(flt), device_(dev) + { } + +template +inline std::streamsize composite_device::read + (char_type* s, std::streamsize n) +{ return iostreams::read(filter_, device_, s, n); } + +template +inline std::streamsize composite_device::write + (const char_type* s, std::streamsize n) +{ return iostreams::write(filter_, device_, s, n); } + +template +std::streampos composite_device::seek + (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) +{ return iostreams::seek(filter_, device_, off, way, which); } + +template +void composite_device::close() +{ + BOOST_STATIC_ASSERT((!is_convertible::value)); + BOOST_STATIC_ASSERT( + !(is_convertible::value) || + !(is_convertible::value) || + !(is_convertible::value) + ); + + // Close input sequences in reverse order and output sequences + // in forward order + if (!is_convertible::value) { + detail::execute_all( + detail::call_close(device_, BOOST_IOS::in), + detail::call_close(filter_, device_, BOOST_IOS::in), + detail::call_close(filter_, device_, BOOST_IOS::out), + detail::call_close(device_, BOOST_IOS::out) + ); + } else if (is_convertible::value) { + detail::execute_all( + detail::call_close(device_, BOOST_IOS::in), + detail::call_close(filter_, device_, BOOST_IOS::in) + ); + } else { + detail::execute_all( + detail::call_close(filter_, device_, BOOST_IOS::out), + detail::call_close(device_, BOOST_IOS::out) + ); + } +} + +template +void composite_device::close(BOOST_IOS::openmode which) +{ + BOOST_STATIC_ASSERT((is_convertible::value)); + BOOST_STATIC_ASSERT(!(is_convertible::value)); + + // Close input sequences in reverse order + if (which == BOOST_IOS::in) { + detail::execute_all( + detail::call_close(device_, BOOST_IOS::in), + detail::call_close(filter_, device_, BOOST_IOS::in) + ); + } + + // Close output sequences in forward order + if (which == BOOST_IOS::out) { + detail::execute_all( + detail::call_close(filter_, device_, BOOST_IOS::out), + detail::call_close(device_, BOOST_IOS::out) + ); + } +} + +template +bool composite_device::flush() +{ + bool r1 = iostreams::flush(filter_, device_); + bool r2 = iostreams::flush(device_); + return r1 && r2; +} + +template +std::streamsize +composite_device::optimal_buffer_size() const +{ return iostreams::optimal_buffer_size(device_); } + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_COMPOSE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/concepts.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/concepts.hpp new file mode 100644 index 0000000000..1ea104e1c6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/concepts.hpp @@ -0,0 +1,129 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED +#define BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC +#include +#include +#include +#include // openmode. +#include +#include +#include + +namespace boost { namespace iostreams { + +//--------------Definitions of helper templates for device concepts-----------// + +template +struct device { + typedef Ch char_type; + struct category + : Mode, + device_tag, + closable_tag, + localizable_tag + { }; + + void close() + { + using namespace detail; + BOOST_STATIC_ASSERT((!is_convertible::value)); + } + + void close(BOOST_IOS::openmode) + { + using namespace detail; + BOOST_STATIC_ASSERT((is_convertible::value)); + } + + template + void imbue(const Locale&) { } +}; + +template +struct wdevice : device { }; + +typedef device source; +typedef wdevice wsource; +typedef device sink; +typedef wdevice wsink; + +//--------------Definitions of helper templates for simple filter concepts----// + +template +struct filter { + typedef Ch char_type; + struct category + : Mode, + filter_tag, + closable_tag, + localizable_tag + { }; + + template + void close(Device&) + { + using namespace detail; + BOOST_STATIC_ASSERT((!is_convertible::value)); + BOOST_STATIC_ASSERT((!is_convertible::value)); + } + + template + void close(Device&, BOOST_IOS::openmode) + { + using namespace detail; + BOOST_STATIC_ASSERT( + (is_convertible::value) || + (is_convertible::value) + ); + } + + template + void imbue(const Locale&) { } +}; + +template +struct wfilter : filter { }; + +typedef filter input_filter; +typedef wfilter input_wfilter; +typedef filter output_filter; +typedef wfilter output_wfilter; +typedef filter seekable_filter; +typedef wfilter seekable_wfilter; +typedef filter dual_use_filter; +typedef wfilter dual_use_wfilter; + +//------Definitions of helper templates for multi-character filter cncepts----// + +template +struct multichar_filter : filter { + struct category : filter::category, multichar_tag { }; +}; + +template +struct multichar_wfilter : multichar_filter { }; + +typedef multichar_filter multichar_input_filter; +typedef multichar_wfilter multichar_input_wfilter; +typedef multichar_filter multichar_output_filter; +typedef multichar_wfilter multichar_output_wfilter; +typedef multichar_filter multichar_dual_use_filter; +typedef multichar_wfilter multichar_dual_use_wfilter; + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/constants.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/constants.hpp new file mode 100644 index 0000000000..85eb7e7cc8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/constants.hpp @@ -0,0 +1,42 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains constants used by library. + +#ifndef BOOST_IOSTREAMS_CONSTANTS_HPP_INCLUDED +#define BOOST_IOSTREAMS_CONSTANTS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#ifndef BOOST_IOSTREAMS_DEFAULT_DEVICE_BUFFER_SIZE +# define BOOST_IOSTREAMS_DEFAULT_DEVICE_BUFFER_SIZE 4096 +#endif + +#ifndef BOOST_IOSTREAMS_DEFAULT_FILTER_BUFFER_SIZE +# define BOOST_IOSTREAMS_DEFAULT_FILTER_BUFFER_SIZE 128 +#endif + +#ifndef BOOST_IOSTREAMS_DEFAULT_PBACK_BUFFER_SIZE +# define BOOST_IOSTREAMS_DEFAULT_PBACK_BUFFER_SIZE 4 +#endif + +#include // streamsize. + +namespace boost { namespace iostreams { + +const std::streamsize default_device_buffer_size = + BOOST_IOSTREAMS_DEFAULT_DEVICE_BUFFER_SIZE; +const std::streamsize default_filter_buffer_size = + BOOST_IOSTREAMS_DEFAULT_FILTER_BUFFER_SIZE; +const std::streamsize default_pback_buffer_size = + BOOST_IOSTREAMS_DEFAULT_PBACK_BUFFER_SIZE; + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_CONSTANTS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/copy.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/copy.hpp new file mode 100644 index 0000000000..b9f748a461 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/copy.hpp @@ -0,0 +1,252 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains: The function template copy, which reads data from a Source +// and writes it to a Sink until the end of the sequence is reached, returning +// the number of characters transfered. + +// The implementation is complicated by the need to handle smart adapters +// and direct devices. + +#ifndef BOOST_IOSTREAMS_COPY_HPP_INCLUDED +#define BOOST_IOSTREAMS_COPY_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // Make sure ptrdiff_t is in std. +#include // copy, min. +#include // ptrdiff_t. +#include // pair. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // failure, streamsize. +#include +#include +#include // read, write, close. +#include +#include +#include + +namespace boost { namespace iostreams { + +namespace detail { + + // The following four overloads of copy_impl() optimize + // copying in the case that one or both of the two devices + // models Direct (see + // http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.1.4) + +// Copy from a direct source to a direct sink +template +std::streamsize copy_impl( Source& src, Sink& snk, + std::streamsize /* buffer_size */, + mpl::true_, mpl::true_ ) +{ + using namespace std; + typedef typename char_type_of::type char_type; + typedef std::pair pair_type; + pair_type p1 = iostreams::input_sequence(src); + pair_type p2 = iostreams::output_sequence(snk); + std::streamsize total = + static_cast( + (std::min)(p1.second - p1.first, p2.second - p2.first) + ); + std::copy(p1.first, p1.first + total, p2.first); + return total; +} + +// Copy from a direct source to an indirect sink +template +std::streamsize copy_impl( Source& src, Sink& snk, + std::streamsize /* buffer_size */, + mpl::true_, mpl::false_ ) +{ + using namespace std; + typedef typename char_type_of::type char_type; + typedef std::pair pair_type; + pair_type p = iostreams::input_sequence(src); + std::streamsize size, total; + for ( total = 0, size = static_cast(p.second - p.first); + total < size; ) + { + std::streamsize amt = + iostreams::write(snk, p.first + total, size - total); + total += amt; + } + return total; +} + +// Copy from an indirect source to a direct sink +template +std::streamsize copy_impl( Source& src, Sink& snk, + std::streamsize buffer_size, + mpl::false_, mpl::true_ ) +{ + typedef typename char_type_of::type char_type; + typedef std::pair pair_type; + detail::basic_buffer buf(buffer_size); + pair_type p = snk.output_sequence(); + std::streamsize total = 0; + std::ptrdiff_t capacity = p.second - p.first; + while (true) { + std::streamsize amt = + iostreams::read( + src, + buf.data(), + buffer_size < capacity - total ? + buffer_size : + static_cast(capacity - total) + ); + if (amt == -1) + break; + std::copy(buf.data(), buf.data() + amt, p.first + total); + total += amt; + } + return total; +} + +// Copy from an indirect source to an indirect sink +template +std::streamsize copy_impl( Source& src, Sink& snk, + std::streamsize buffer_size, + mpl::false_, mpl::false_ ) +{ + typedef typename char_type_of::type char_type; + detail::basic_buffer buf(buffer_size); + non_blocking_adapter nb(snk); + std::streamsize total = 0; + bool done = false; + while (!done) { + std::streamsize amt; + done = (amt = iostreams::read(src, buf.data(), buffer_size)) == -1; + if (amt != -1) { + iostreams::write(nb, buf.data(), amt); + total += amt; + } + } + return total; +} + + // The following function object is used with + // boost::iostreams::detail::execute() in the primary + // overload of copy_impl(), below + +// Function object that delegates to one of the above four +// overloads of compl_impl() +template +class copy_operation { +public: + typedef std::streamsize result_type; + copy_operation(Source& src, Sink& snk, std::streamsize buffer_size) + : src_(src), snk_(snk), buffer_size_(buffer_size) + { } + std::streamsize operator()() + { + return copy_impl( src_, snk_, buffer_size_, + is_direct(), is_direct() ); + } +private: + copy_operation& operator=(const copy_operation&); + Source& src_; + Sink& snk_; + std::streamsize buffer_size_; +}; + +// Primary overload of copy_impl. Delegates to one of the above four +// overloads of compl_impl(), depending on which of the two given +// devices, if any, models Direct (see +// http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.1.4) +template +std::streamsize copy_impl(Source src, Sink snk, std::streamsize buffer_size) +{ + using namespace std; + typedef typename char_type_of::type src_char; + typedef typename char_type_of::type snk_char; + BOOST_STATIC_ASSERT((is_same::value)); + return detail::execute_all( + copy_operation(src, snk, buffer_size), + detail::call_close_all(src), + detail::call_close_all(snk) + ); +} + +} // End namespace detail. + +//------------------Definition of copy----------------------------------------// + +// Overload of copy() for the case where neither the source nor the sink is +// a standard stream or stream buffer +template +std::streamsize +copy( const Source& src, const Sink& snk, + std::streamsize buffer_size = default_device_buffer_size + BOOST_IOSTREAMS_DISABLE_IF_STREAM(Source) + BOOST_IOSTREAMS_DISABLE_IF_STREAM(Sink) ) +{ + typedef typename char_type_of::type char_type; + return detail::copy_impl( detail::resolve(src), + detail::resolve(snk), + buffer_size ); +} + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + +// Overload of copy() for the case where the source, but not the sink, is +// a standard stream or stream buffer +template +std::streamsize +copy( Source& src, const Sink& snk, + std::streamsize buffer_size = default_device_buffer_size + BOOST_IOSTREAMS_ENABLE_IF_STREAM(Source) + BOOST_IOSTREAMS_DISABLE_IF_STREAM(Sink) ) +{ + typedef typename char_type_of::type char_type; + return detail::copy_impl( detail::wrap(src), + detail::resolve(snk), + buffer_size ); +} + +// Overload of copy() for the case where the sink, but not the source, is +// a standard stream or stream buffer +template +std::streamsize +copy( const Source& src, Sink& snk, + std::streamsize buffer_size = default_device_buffer_size + BOOST_IOSTREAMS_DISABLE_IF_STREAM(Source) + BOOST_IOSTREAMS_ENABLE_IF_STREAM(Sink) ) +{ + typedef typename char_type_of::type char_type; + return detail::copy_impl( detail::resolve(src), + detail::wrap(snk), buffer_size ); +} + +// Overload of copy() for the case where neither the source nor the sink is +// a standard stream or stream buffer +template +std::streamsize +copy( Source& src, Sink& snk, + std::streamsize buffer_size = default_device_buffer_size + BOOST_IOSTREAMS_ENABLE_IF_STREAM(Source) + BOOST_IOSTREAMS_ENABLE_IF_STREAM(Sink) ) +{ + return detail::copy_impl(detail::wrap(src), detail::wrap(snk), buffer_size); +} + +#endif // #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //-----------------------// + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_COPY_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/absolute_path.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/absolute_path.hpp new file mode 100644 index 0000000000..090958a95e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/absolute_path.hpp @@ -0,0 +1,46 @@ +/* + * 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/iostreams for documentation. + + * File: boost/iostreams/detail/execute.hpp + * Date: Thu Dec 06 13:21:54 MST 2007 + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * Defines the function boost::iostreams::detail::absolute_path, used for + * debug output for mapped files. + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED + +#include +#include +#ifdef BOOST_IOSTREAMS_WINDOWS +# include +#endif +#include + +namespace boost { namespace iostreams { namespace detail { + +// Resolves the given path relative to the current working directory +inline std::string absolute_path(const std::string& path) +{ +#ifdef BOOST_IOSTREAMS_WINDOWS + return path.size() && (path[0] == '/' || path[0] == '\\') || + path.size() > 1 && std::isalpha(path[0]) && path[1] == ':' ? + path : + current_directory() + '\\' + path; +#else // #ifdef BOOST_IOSTREAMS_WINDOWS + return path.size() && (path[0] == '/') ? + path : + current_directory() + '/' + path; +#endif // #ifdef BOOST_IOSTREAMS_WINDOWS +} + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_ABSOLUTE_PATH_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/access_control.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/access_control.hpp new file mode 100644 index 0000000000..2dce6ca8c2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/access_control.hpp @@ -0,0 +1,87 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains the definition of the class template access_control, which +// allows the type of inheritance from a provided base class to be specified +// using a template parameter. + + +#ifndef BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED +#define BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include + +namespace boost { namespace iostreams { + +struct protected_ { }; // Represents protected inheritance. +struct public_ { }; // Represents public inheritance. + + +namespace detail { + + // Implements protected inheritance. + template + struct prot_ : protected U + { + prot_() { } + template prot_(V v) : U(v) { } + }; + + // Implements public inheritance. + template struct pub_ : public U { + pub_() { } + template pub_(V v) : U(v) { } + }; + +// +// Used to deduce the base type for the template access_control. +// +template +struct access_control_base { + typedef int bad_access_specifier; + typedef typename + iostreams::select< // Disambiguation for Tru64 + ::boost::is_same< + Access, protected_ + >, prot_, + ::boost::is_same< + Access, public_ + >, pub_, + else_, bad_access_specifier + >::type type; +}; + +} // End namespace detail. + +// +// Template name: access_control. +// Description: Allows the type of inheritance from a provided base class +// to be specified using an int template parameter. +// Template parameters: +// Base - The class from which to inherit (indirectly.) +// Access - The type of access desired. Must be one of the +// values access_base::prot or access_base::pub. +// +template< typename T, typename Access, + typename Base = // VC6 workaraound (Compiler Error C2516) + typename detail::access_control_base::type > +struct access_control : public Base { + access_control() { } + template explicit access_control(U u) : Base(u) { } +}; + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/concept_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/concept_adapter.hpp new file mode 100644 index 0000000000..c2cd2af448 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/concept_adapter.hpp @@ -0,0 +1,278 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONCEPT_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONCEPT_ADAPTER_HPP_INCLUDED + +#include // SFINAE. +#include +#include +#include +#include +#include +#include +#include +#include // pubsync. +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { namespace detail { + +template struct device_wrapper_impl; +template struct flt_wrapper_impl; + +template +class concept_adapter { +private: + typedef typename detail::value_type::type value_type; + typedef typename dispatch::type input_tag; + typedef typename dispatch::type output_tag; + typedef typename + mpl::if_< + is_device, + device_wrapper_impl, + flt_wrapper_impl + >::type input_impl; + typedef typename + mpl::if_< + is_device, + device_wrapper_impl, + flt_wrapper_impl + >::type output_impl; + typedef typename + mpl::if_< + is_device, + device_wrapper_impl, + flt_wrapper_impl + >::type any_impl; +public: + typedef typename char_type_of::type char_type; + typedef typename category_of::type category; + + explicit concept_adapter(const reference_wrapper& ref) : t_(ref.get()) + { BOOST_STATIC_ASSERT(is_std_io::value); } + explicit concept_adapter(const T& t) : t_(t) + { BOOST_STATIC_ASSERT(!is_std_io::value); } + + T& operator*() { return t_; } + T* operator->() { return &t_; } + + std::streamsize read(char_type* s, std::streamsize n) + { return this->read(s, n, (basic_null_source*) 0); } + + template + std::streamsize read(char_type* s, std::streamsize n, Source* src) + { return input_impl::read(t_, src, s, n); } + + std::streamsize write(const char_type* s, std::streamsize n) + { return this->write(s, n, (basic_null_sink*) 0); } + + template + std::streamsize write(const char_type* s, std::streamsize n, Sink* snk) + { return output_impl::write(t_, snk, s, n); } + + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) + { + return this->seek( off, way, which, + (basic_null_device*) 0); + } + + template + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which, Device* dev ) + { return any_impl::seek(t_, dev, off, way, which); } + + void close(BOOST_IOS::openmode which) + { this->close(which, (basic_null_device*) 0); } + + template + void close(BOOST_IOS::openmode which, Device* dev) + { any_impl::close(t_, dev, which); } + + bool flush( BOOST_IOSTREAMS_BASIC_STREAMBUF(char_type, + BOOST_IOSTREAMS_CHAR_TRAITS(char_type))* sb ) + { + bool result = any_impl::flush(t_, sb); + if (sb && sb->BOOST_IOSTREAMS_PUBSYNC() == -1) + result = false; + return result; + } + + template // Avoid dependency on + void imbue(const Locale& loc) { iostreams::imbue(t_, loc); } + + std::streamsize optimal_buffer_size() const + { return iostreams::optimal_buffer_size(t_); } +public: + concept_adapter& operator=(const concept_adapter&); + value_type t_; +}; + +//------------------Specializations of device_wrapper_impl--------------------// + +template<> +struct device_wrapper_impl { + template + static std::streampos + seek( Device& dev, Dummy*, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) + { + typedef typename category_of::type category; + return seek(dev, off, way, which, category()); + } + + template + static std::streampos + seek( Device&, stream_offset, BOOST_IOS::seekdir, + BOOST_IOS::openmode, any_tag ) + { + throw cant_seek(); + } + + template + static std::streampos + seek( Device& dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which, + random_access ) + { + return iostreams::seek(dev, off, way, which); + } + + template + static void close(Device& dev, Dummy*, BOOST_IOS::openmode which) + { iostreams::close(dev, which); } + + template + static bool flush(Device& dev, Dummy*) + { return iostreams::flush(dev); } +}; + + +template<> +struct device_wrapper_impl : device_wrapper_impl { + template + static std::streamsize + read( Device& dev, Dummy*, typename char_type_of::type* s, + std::streamsize n ) + { return iostreams::read(dev, s, n); } + + template + static std::streamsize + write( Device&, Dummy*, const typename char_type_of::type*, + std::streamsize ) + { throw cant_write(); } +}; + +template<> +struct device_wrapper_impl { + template + static std::streamsize + read(Device&, Dummy*, typename char_type_of::type*, std::streamsize) + { throw cant_read(); } + + template + static std::streamsize + write( Device& dev, Dummy*, const typename char_type_of::type* s, + std::streamsize n ) + { return iostreams::write(dev, s, n); } +}; + +//------------------Specializations of flt_wrapper_impl--------------------// + +template<> +struct flt_wrapper_impl { + template + static std::streampos + seek( Filter& f, Device* dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) + { + typedef typename category_of::type category; + return seek(f, dev, off, way, which, category()); + } + + template + static std::streampos + seek( Filter&, Device*, stream_offset, + BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag ) + { throw cant_seek(); } + + template + static std::streampos + seek( Filter& f, Device* dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which, + random_access tag ) + { + typedef typename category_of::type category; + return seek(f, dev, off, way, which, tag, category()); + } + + template + static std::streampos + seek( Filter& f, Device* dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode, + random_access, any_tag ) + { return f.seek(*dev, off, way); } + + template + static std::streampos + seek( Filter& f, Device* dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which, + random_access, two_sequence ) + { return f.seek(*dev, off, way, which); } + + template + static void close(Filter& f, Device* dev, BOOST_IOS::openmode which) + { iostreams::close(f, *dev, which); } + + template + static bool flush(Filter& f, Device* dev) + { return iostreams::flush(f, *dev); } +}; + +template<> +struct flt_wrapper_impl { + template + static std::streamsize + read( Filter& f, Source* src, typename char_type_of::type* s, + std::streamsize n ) + { return iostreams::read(f, *src, s, n); } + + template + static std::streamsize + write( Filter&, Sink*, const typename char_type_of::type*, + std::streamsize ) + { throw cant_write(); } +}; + +template<> +struct flt_wrapper_impl { + template + static std::streamsize + read(Filter&, Source*, typename char_type_of::type*,std::streamsize) + { throw cant_read(); } + + template + static std::streamsize + write( Filter& f, Sink* snk, const typename char_type_of::type* s, + std::streamsize n ) + { return iostreams::write(f, *snk, s, n); } +}; + +//----------------------------------------------------------------------------// + +} } } // End namespaces detail, iostreams, boost. + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONCEPT_ADAPTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/device_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/device_adapter.hpp new file mode 100644 index 0000000000..9dd723a0fd --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/device_adapter.hpp @@ -0,0 +1,67 @@ +/* + * Defines the class template boost::iostreams::detail::device_adapter, + * a convenience base class for device adapters. + * + * File: boost/iostreams/detail/adapter/filter_adapter.hpp + * Date: Mon Nov 26 14:35:48 MST 2007 + * + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * Distributed under the Boost Software License, Version 1.0.(See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) + * + * See http://www.boost.org/libs/iostreams for documentation. + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +class device_adapter { +private: + typedef typename detail::value_type::type value_type; + typedef typename detail::param_type::type param_type; +public: + explicit device_adapter(param_type t) : t_(t) { } + T& component() { return t_; } + + void close() + { + detail::close_all(t_); + } + + void close(BOOST_IOS::openmode which) + { + iostreams::close(t_, which); + } + + bool flush() + { + return iostreams::flush(t_); + } + + template // Avoid dependency on + void imbue(const Locale& loc) { iostreams::imbue(t_, loc); } + + std::streamsize optimal_buffer_size() const + { return iostreams::optimal_buffer_size(t_); } +public: + value_type t_; +}; + +//----------------------------------------------------------------------------// + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DEVICE_ADAPTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/direct_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/direct_adapter.hpp new file mode 100644 index 0000000000..c70bacc1f8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/direct_adapter.hpp @@ -0,0 +1,280 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_DIRECT_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_DIRECT_ADAPTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // SFINAE, MSVC, put ptrdiff_t in std. +#include // copy, min. +#include // ptrdiff_t. +#include +#include +#include // forwarding. +#include // locale. +#include +#include +#include // openmode, seekdir, int types. +#include // mode_of, is_direct. +#include +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include // VC7.1 + +namespace boost { namespace iostreams { namespace detail { + +//------------------Definition of direct_adapter_base-------------------------// + +// Put all initialization in base class to faciliate forwarding. +template +class direct_adapter_base { +public: + typedef typename char_type_of::type char_type; + typedef typename mode_of::type mode_type; + struct category + : mode_type, + device_tag, + closable_tag + #ifndef BOOST_IOSTREAMS_NO_LOCALE + , localizable_tag + #endif + { }; +protected: + explicit direct_adapter_base(const Direct& d); + typedef is_convertible is_double; + struct pointers { + char_type *beg, *ptr, *end; + }; + void init_input(mpl::true_); + void init_input(mpl::false_) { } + void init_output(mpl::true_); + void init_output(mpl::false_) { } + double_object ptrs_; + Direct d_; +}; + +template +class direct_adapter : private direct_adapter_base { +private: + typedef direct_adapter_base base_type; + typedef typename base_type::pointers pointers; + typedef typename base_type::is_double is_double; + using base_type::ptrs_; + using base_type::d_; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + + // Constructors + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) + direct_adapter(const Direct& d) : base_type(d) { } + direct_adapter(const direct_adapter& d) : base_type(d) { } +# define BOOST_PP_LOCAL_LIMITS (1, BOOST_IOSTREAMS_MAX_FORWARDING_ARITY) +#else + template + struct is_direct + : mpl::or_< + is_same >, + is_same + > + { }; + template + direct_adapter(const U& u) + : base_type(forward(u, is_direct())) + { } +# define BOOST_PP_LOCAL_LIMITS (2, BOOST_IOSTREAMS_MAX_FORWARDING_ARITY) +#endif + +#define BOOST_PP_LOCAL_MACRO(n) \ + template \ + direct_adapter(BOOST_PP_ENUM_BINARY_PARAMS(n, const P, &p)) \ + : base_type(Direct(BOOST_PP_ENUM_PARAMS(n, p))) \ + { } \ + /**/ +#include BOOST_PP_LOCAL_ITERATE() +#undef BOOST_PP_LOCAL_MACRO + + // Device interface. + + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek( stream_offset, BOOST_IOS::seekdir, + BOOST_IOS::openmode = BOOST_IOS::in | BOOST_IOS::out ); + void close(); + void close(BOOST_IOS::openmode which); +#ifndef BOOST_IOSTREAMS_NO_LOCALE + void imbue(const std::locale&); +#endif + + // Direct device access. + + Direct& operator*() { return d_; } + Direct* operator->() { return &d_; } +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) +private: + template + static Direct forward(const U& u, mpl::true_) { return u; } + template + static Direct forward(const U& u, mpl::false_) { return Direct(u); } +#endif +}; + +//--------------Definition of wrap_direct and unwrap_direct-------------------// + +template +struct wrap_direct_traits + : mpl::if_< + is_direct, + direct_adapter, + Device + > + { }; + +template +typename wrap_direct_traits::type +inline wrap_direct(Device dev) +{ + typedef typename wrap_direct_traits::type type; + return type(dev); +} + +template +inline Device& unwrap_direct(Device& d) { return d; } + +template +inline Device& unwrap_direct(direct_adapter& d) { return *d; } + +//--------------Implementation of direct_adapter_base-------------------------// + +template +direct_adapter_base::direct_adapter_base(const Direct& d) : d_(d) +{ + init_input(is_convertible()); + init_output(is_convertible()); +} + +template +void direct_adapter_base::init_input(mpl::true_) +{ + std::pair seq = iostreams::input_sequence(d_); + ptrs_.first().beg = seq.first; + ptrs_.first().ptr = seq.first; + ptrs_.first().end = seq.second; +} + +template +void direct_adapter_base::init_output(mpl::true_) +{ + std::pair seq = iostreams::output_sequence(d_); + ptrs_.second().beg = seq.first; + ptrs_.second().ptr = seq.first; + ptrs_.second().end = seq.second; +} + +//--------------Implementation of direct_adapter------------------------------// + +template +inline std::streamsize direct_adapter::read + (char_type* s, std::streamsize n) +{ + using namespace std; + pointers& get = ptrs_.first(); + std::streamsize avail = + static_cast(get.end - get.ptr); + std::streamsize result = (std::min)(n, avail); + std::copy(get.ptr, get.ptr + result, s); + get.ptr += result; + return result != 0 ? result : -1; +} + +template +inline std::streamsize direct_adapter::write + (const char_type* s, std::streamsize n) +{ + using namespace std; + pointers& put = ptrs_.second(); + if (n > static_cast(put.end - put.ptr)) + throw write_area_exhausted(); + std::copy(s, s + n, put.ptr); + put.ptr += n; + return n; +} + +template +inline std::streampos direct_adapter::seek + ( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) +{ + using namespace std; + pointers& get = ptrs_.first(); + pointers& put = ptrs_.second(); + if (way == BOOST_IOS::cur && get.ptr != put.ptr) + throw bad_seek(); + ptrdiff_t next = 0; + if ((which & BOOST_IOS::in) || !is_double::value) { + if (way == BOOST_IOS::beg) + next = off; + else if (way == BOOST_IOS::cur) + next = get.ptr - get.beg + off; + else + next = get.end - get.beg + off; + if (next >= 0 && next <= get.end - get.beg) + get.ptr = get.beg + next; + else + throw bad_seek(); + } + if ((which & BOOST_IOS::out) && is_double::value) { + if (way == BOOST_IOS::beg) + next = off; + else if (way == BOOST_IOS::cur) + next = put.ptr - put.beg + off; + else + next = put.end - put.beg + off; + if (next >= 0 && next <= put.end - put.beg) + put.ptr = put.beg + next; + else + throw bad_seek(); + } + return offset_to_position(next); +} + +template +void direct_adapter::close() +{ + BOOST_STATIC_ASSERT((!is_convertible::value)); + detail::close_all(d_); +} + +template +void direct_adapter::close(BOOST_IOS::openmode which) +{ + BOOST_STATIC_ASSERT((is_convertible::value)); + boost::iostreams::close(d_, which); +} + +#ifndef BOOST_IOSTREAMS_NO_LOCALE + template + void direct_adapter::imbue(const std::locale& loc) + { boost::iostreams::imbue(d_, loc); } +#endif + +} } } // End namespaces detail, iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DIRECT_ADAPTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/filter_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/filter_adapter.hpp new file mode 100644 index 0000000000..a2ab49250b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/filter_adapter.hpp @@ -0,0 +1,69 @@ +/* + * Defines the class template boost::iostreams::detail::filter_adapter, + * a convenience base class for filter adapters. + * + * File: boost/iostreams/detail/adapter/filter_adapter.hpp + * Date: Mon Nov 26 14:35:48 MST 2007 + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * Distributed under the Boost Software License, Version 1.0.(See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) + * + * See http://www.boost.org/libs/iostreams for documentation. + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +class filter_adapter { +private: + typedef typename detail::value_type::type value_type; + typedef typename detail::param_type::type param_type; +public: + explicit filter_adapter(param_type t) : t_(t) { } + T& component() { return t_; } + + template + void close(Device& dev) + { + detail::close_all(t_, dev); + } + + template + void close(Device& dev, BOOST_IOS::openmode which) + { + iostreams::close(t_, dev, which); + } + + template + void flush(Device& dev) + { + return iostreams::flush(t_, dev); + } + + template // Avoid dependency on + void imbue(const Locale& loc) { iostreams::imbue(t_, loc); } + + std::streamsize optimal_buffer_size() const + { return iostreams::optimal_buffer_size(t_); } +public: + value_type t_; +}; + +//----------------------------------------------------------------------------// + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_FILTER_ADAPTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/mode_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/mode_adapter.hpp new file mode 100644 index 0000000000..e75aa9fdad --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/mode_adapter.hpp @@ -0,0 +1,123 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_MODE_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_MODE_ADAPTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// Contains the definition of the class template mode_adapter, which allows +// a filter or device to function as if it has a different i/o mode than that +// deduced by the metafunction mode_of. + +#include // BOOST_MSVC. +#include +#include +#include // openmode, seekdir, int types. +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +class mode_adapter { +private: + struct empty_base { }; +public: + typedef typename wrapped_type::type policy_type; + typedef typename char_type_of::type char_type; + struct category + : Mode, + device_tag, + mpl::if_, filter_tag, device_tag>, + mpl::if_, multichar_tag, empty_base>, + #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + closable_tag, // VC6 can't see member close()! + #endif + localizable_tag + { }; + explicit mode_adapter(const policy_type& t) : t_(t) { } + + // Device member functions. + + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + void close(); + void close(BOOST_IOS::openmode which); +#endif + + // Filter member functions. + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { return iostreams::read(t_, src, s, n); } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { return iostreams::write(t_, snk, s, n); } + + template + std::streampos seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) + { return iostreams::seek(t_, dev, off, way); } + + template + std::streampos seek( Device& dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) + { return iostreams::seek(t_, dev, off, way, which); } + + template + void close(Device& dev) + { detail::close_all(t_, dev); } + + template + void close(Device& dev, BOOST_IOS::openmode which) + { iostreams::close(t_, dev, which); } + + template + void imbue(const Locale& loc) + { iostreams::imbue(t_, loc); } +private: + policy_type t_; +}; + +//------------------Implementation of mode_adapter----------------------------// + +template +std::streamsize mode_adapter::read + (char_type* s, std::streamsize n) +{ return boost::iostreams::read(t_, s, n); } + +template +std::streamsize mode_adapter::write + (const char_type* s, std::streamsize n) +{ return boost::iostreams::write(t_, s, n); } + +template +std::streampos mode_adapter::seek + (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) +{ return boost::iostreams::seek(t_, off, way, which); } + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template + void mode_adapter::close() + { detail::close_all(t_); } + + template + void mode_adapter::close(BOOST_IOS::openmode which) + { iostreams::close(t_, which); } +#endif + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_MODE_ADAPTER_HPP_INCLUDED //-----// diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/non_blocking_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/non_blocking_adapter.hpp new file mode 100644 index 0000000000..1457032c71 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/non_blocking_adapter.hpp @@ -0,0 +1,59 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_NON_BLOCKING_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_NON_BLOCKING_ADAPTER_HPP_INCLUDED + +#include // streamsize, seekdir, openmode. +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +template +class non_blocking_adapter { +public: + typedef typename char_type_of::type char_type; + struct category + : mode_of::type, device_tag + { }; + explicit non_blocking_adapter(Device& dev) : device_(dev) { } + std::streamsize read(char_type* s, std::streamsize n) + { + std::streamsize result = 0; + while (result < n) { + std::streamsize amt = iostreams::read(device_, s, n); + if (amt == -1) + break; + result += amt; + } + return result != 0 ? result : -1; + } + std::streamsize write(const char_type* s, std::streamsize n) + { + std::streamsize result = 0; + while (result < n) { + std::streamsize amt = + iostreams::write(device_, s + result, n - result); + result += amt; + } + return result; + } + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ) + { return iostreams::seek(device_, off, way, which); } +public: + non_blocking_adapter& operator=(const non_blocking_adapter&); + Device& device_; +}; + +} } // End namespace iostreams. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_NON_BLOCKING_ADAPTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/output_iterator_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/output_iterator_adapter.hpp new file mode 100644 index 0000000000..2944f25d75 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/output_iterator_adapter.hpp @@ -0,0 +1,41 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_OUTPUT_ITERATOR_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_OUTPUT_ITERATOR_ADAPTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // copy. +#include // streamsize. +#include // tags. +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +class output_iterator_adapter { +public: + BOOST_STATIC_ASSERT((is_convertible::value)); + typedef Ch char_type; + typedef sink_tag category; + explicit output_iterator_adapter(OutIt out) : out_(out) { } + std::streamsize write(const char_type* s, std::streamsize n) + { + std::copy(s, s + n, out_); + return n; + } +private: + OutIt out_; +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_OUTPUT_ITERATOR_ADAPTER_HPP_INCLUDED //-----// diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/range_adapter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/range_adapter.hpp new file mode 100644 index 0000000000..f11958db9a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/adapter/range_adapter.hpp @@ -0,0 +1,183 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_RANGE_ADAPTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_RANGE_ADAPTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // min. +#include +#include // ptrdiff_t. +#include // streamsize, streamoff. +#include // boost::iterator_traits. +#include +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { namespace detail { + +// Used for simulated tag dispatch. +template struct range_adapter_impl; + +// +// Template name: range_adapter +// Description: Device based on an instance of boost::iterator_range. +// Template paramters: +// Mode - A mode tag. +// Range - An instance of iterator_range. +// +template +class range_adapter { +private: + typedef typename Range::iterator iterator; + typedef boost::detail::iterator_traits iter_traits; + typedef typename iter_traits::iterator_category iter_cat; +public: + typedef typename Range::value_type char_type; + struct category : Mode, device_tag { }; + typedef typename + mpl::if_< + is_convertible< + iter_cat, + std::random_access_iterator_tag + >, + std::random_access_iterator_tag, + std::forward_iterator_tag + >::type tag; + typedef range_adapter_impl impl; + + explicit range_adapter(const Range& rng); + range_adapter(iterator first, iterator last); + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); +private: + iterator first_, cur_, last_; +}; + +//------------------Implementation of range_adapter---------------------------// + +template +range_adapter::range_adapter(const Range& rng) + : first_(rng.begin()), cur_(rng.begin()), last_(rng.end()) { } + +template +range_adapter::range_adapter(iterator first, iterator last) + : first_(first), cur_(first), last_(last) { } + +template +inline std::streamsize range_adapter::read + (char_type* s, std::streamsize n) +{ return impl::read(cur_, last_, s, n); } + +template +inline std::streamsize range_adapter::write + (const char_type* s, std::streamsize n) +{ return impl::write(cur_, last_, s, n); } + + +template +std::streampos range_adapter::seek + (stream_offset off, BOOST_IOS::seekdir way) +{ + impl::seek(first_, cur_, last_, off, way); + return offset_to_position(cur_ - first_); +} + +//------------------Implementation of range_adapter_impl----------------------// + +template<> +struct range_adapter_impl { + template + static std::streamsize read + (Iter& cur, Iter& last, Ch* s,std::streamsize n) + { + std::streamsize rem = n; // No. of chars remaining. + while (cur != last && rem-- > 0) *s++ = *cur++; + return n - rem != 0 ? n - rem : -1; + } + + template + static std::streamsize write + (Iter& cur, Iter& last, const Ch* s, std::streamsize n) + { + while (cur != last && n-- > 0) *cur++ = *s++; + if (cur == last && n > 0) + throw write_area_exhausted(); + return n; + } +}; + +template<> +struct range_adapter_impl { + template + static std::streamsize read + (Iter& cur, Iter& last, Ch* s,std::streamsize n) + { + std::streamsize result = + (std::min)(static_cast(last - cur), n); + if (result) + std::copy(cur, cur + result, s); + cur += result; + return result != 0 ? result : -1; + } + + template + static std::streamsize write + (Iter& cur, Iter& last, const Ch* s, std::streamsize n) + { + std::streamsize count = + (std::min)(static_cast(last - cur), n); + std::copy(s, s + count, cur); + cur += count; + if (count < n) + throw write_area_exhausted(); + return n; + } + + template + static void seek + ( Iter& first, Iter& cur, Iter& last, stream_offset off, + BOOST_IOS::seekdir way ) + { + using namespace std; + switch (way) { + case BOOST_IOS::beg: + if (off > last - first || off < 0) throw bad_seek(); + cur = first + off; + break; + case BOOST_IOS::cur: + { + std::ptrdiff_t newoff = cur - first + off; + if (newoff > last - first || newoff < 0) throw bad_seek(); + cur += off; + break; + } + case BOOST_IOS::end: + if (last - first + off < 0 || off > 0) throw bad_seek(); + cur = last + off; + break; + default: + assert(0); + } + } +}; + +} } } // End namespaces detail, iostreams, boost. + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_RANGE_ADAPTER_HPP_INCLUDED //---------------// diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/add_facet.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/add_facet.hpp new file mode 100644 index 0000000000..65a8951444 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/add_facet.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Borrowed from + +#ifndef BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_DINKUMWARE_STDLIB. +#include + +//------------------Definition of add_facet-----------------------------------// + +// Does STLport uses old Dinkumware locale? +#if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && \ + defined(_STLP_NO_OWN_IOSTREAMS) \ + /**/ +# if (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) +# define BOOST_IOSTREMS_STLPORT_WITH_OLD_DINKUMWARE +# endif +#endif + +namespace boost { namespace iostreams { namespace detail { + +template +inline std::locale add_facet(const std::locale &l, Facet * f) +{ + return + #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) || \ + defined(BOOST_IOSTREMS_STLPORT_WITH_OLD_DINKUMWARE) \ + /**/ + std::locale(std::_Addfac(l, f)); + #else + // standard compatible + std::locale(l, f); + #endif +} + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_ADD_FACET_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/bool_trait_def.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/bool_trait_def.hpp new file mode 100644 index 0000000000..c3fb9d587b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/bool_trait_def.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_BOOL_TRAIT_DEF_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_BOOL_TRAIT_DEF_HPP_INCLUDED + +#include // BOOST_STATIC_CONSTANT. +#include +#include +#include +#include +#include +#include + +// +// Macro name: BOOST_IOSTREAMS_BOOL_TRAIT_DEF +// Description: Used to generate the traits classes is_istream, is_ostream, +// etc. +// +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +# define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) +#else +# define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) BOOST_PP_CAT(trait, _impl_):: +#endif +#define BOOST_IOSTREAMS_BOOL_TRAIT_DEF(trait, type, arity) \ + namespace BOOST_PP_CAT(trait, _impl_) { \ + BOOST_IOSTREAMS_TEMPLATE_PARAMS(arity, T) \ + type_traits::yes_type helper \ + (const volatile type BOOST_IOSTREAMS_TEMPLATE_ARGS(arity, T)*); \ + type_traits::no_type helper(...); \ + template \ + struct impl { \ + BOOST_STATIC_CONSTANT(bool, value = \ + (sizeof(BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) \ + helper(static_cast(0))) == \ + sizeof(type_traits::yes_type))); \ + }; \ + } \ + template \ + struct trait \ + : mpl::bool_::value> \ + { BOOST_MPL_AUX_LAMBDA_SUPPORT(1, trait, (T)) }; \ + /**/ + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_BOOL_TRAIT_DEF_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/forward.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/forward.hpp new file mode 100644 index 0000000000..4444916c3a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/forward.hpp @@ -0,0 +1,31 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED + +#include // BOOST_STATIC_CONSANT. +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +struct forward_impl { + BOOST_STATIC_CONSTANT(bool, value = + ( !is_same< U, Device >::value && + !is_same< U, reference_wrapper >::value )); +}; + +template +struct forward + : mpl::bool_::value> + { }; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/stream.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/stream.hpp new file mode 100644 index 0000000000..5fb5ff997c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/stream.hpp @@ -0,0 +1,185 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED + +#include + +namespace boost { namespace iostreams { + +template< typename Device, + typename Tr = + BOOST_IOSTREAMS_CHAR_TRAITS( + BOOST_DEDUCED_TYPENAME char_type_of::type + ), + typename Alloc = + std::allocator< + BOOST_DEDUCED_TYPENAME char_type_of::type + > > +struct stream : detail::stream_base { +public: + typedef typename char_type_of::type char_type; + struct category + : mode_of::type, + closable_tag, + detail::stream_traits::stream_tag + { }; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) +private: + typedef typename + detail::stream_traits< + Device, Tr + >::stream_type stream_type; + typedef Device policy_type; +public: + stream() { } + template + stream(const U0& u0) + { + open_impl(detail::forward(), u0); + } + template + stream(const U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + stream(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + stream(U0& u0) + { + open_impl(detail::forward(), u0); + } + template + stream(U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + stream(U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open(const U0& u0) + { + open_impl(detail::forward(), u0); + } + template + void open(const U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + void open(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open(U0& u0) + { + open_impl(detail::forward(), u0); + } + template + void open(U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + void open(U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + bool is_open() const { return this->member.is_open(); } + void close() { this->member.close(); } + bool auto_close() const { return this->member.auto_close(); } + void set_auto_close(bool close) { this->member.set_auto_close(close); } + bool strict_sync() { return this->member.strict_sync(); } + Device& operator*() { return *this->member; } + Device* operator->() { return &*this->member; } +private: + template + void open_impl(mpl::false_, const U0& u0) + { + this->clear(); + this->member.open(u0); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::false_, U0& u0) + { + this->clear(); + this->member.open(detail::wrap(u0)); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open_impl(mpl::true_, const U0& u0) + { + this->clear(); + this->member.open(Device(const_cast(u0))); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::true_, U0& u0) + { + this->clear(); + this->member.open(Device(u0)); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open_impl(mpl::false_, const U0& u0, const U1& u1) + { + this->clear(); + this->member.open(u0, u1); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1) + { + this->clear(); + this->member.open(Device(const_cast(u0), u1)); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::true_, U0& u0, const U1& u1) + { + this->clear(); + this->member.open(Device(u0, u1)); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2) + { + this->clear(); + this->member.open(u0, u1, u2); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2) + { + this->clear(); + this->member.open(Device(const_cast(u0), u1, u2)); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::true_, U0& u0, const U1& u1, const U2& u2) + { + this->clear(); + this->member.open(Device(u0, u1, u2)); + } +#endif +}; + +} } // End namespaces iostreams, boost. + +#endif BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/stream_buffer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/stream_buffer.hpp new file mode 100644 index 0000000000..a2c9c77873 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/broken_overload_resolution/stream_buffer.hpp @@ -0,0 +1,189 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED + +#include + +namespace boost { namespace iostreams { + +template< typename T, + typename Tr = + BOOST_IOSTREAMS_CHAR_TRAITS( + BOOST_DEDUCED_TYPENAME char_type_of::type + ), + typename Alloc = + std::allocator< + BOOST_DEDUCED_TYPENAME char_type_of::type + >, + typename Mode = BOOST_DEDUCED_TYPENAME mode_of::type > +class stream_buffer + : public detail::stream_buffer_traits::type +{ +private: + BOOST_STATIC_ASSERT(( + is_convertible< + BOOST_DEDUCED_TYPENAME iostreams::category_of::type, Mode + >::value + )); + typedef typename + detail::stream_buffer_traits< + T, Tr, Alloc, Mode + >::type base_type; + typedef T policy_type; +public: + typedef typename char_type_of::type char_type; + struct category + : Mode, + closable_tag, + streambuf_tag + { }; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) + stream_buffer() { } + ~stream_buffer() + { + try { + if (this->is_open() && this->auto_close()) + this->close(); + } catch (...) { } + } + template + stream_buffer(const U0& u0) + { + open_impl(detail::forward(), u0); + } + template + stream_buffer(const U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + stream_buffer(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + stream_buffer(U0& u0) + { + open_impl(detail::forward(), u0); + } + template + stream_buffer(U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + stream_buffer(U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open(const U0& u0) + { + open_impl(detail::forward(), u0); + } + template + void open(const U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + void open(const U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open(U0& u0) + { + open_impl(detail::forward(), u0); + } + template + void open(U0& u0, const U1& u1) + { + open_impl(detail::forward(), u0, u1); + } + template + void open(U0& u0, const U1& u1, const U2& u2) + { + open_impl(detail::forward(), u0, u1, u2); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + T& operator*() { return *this->component(); } + T* operator->() { return this->component(); } +private: + template + void open_impl(mpl::false_, const U0& u0) + { + base_type::open(const_cast(u0), -1, -1); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::false_, U0& u0) + { + base_type::open(detail::wrap(u0), -1, -1); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open_impl(mpl::true_, const U0& u0) + { + base_type::open(T(const_cast(u0)), -1, -1); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::true_, U0& u0) + { + base_type::open(T(u0), -1, -1); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open_impl(mpl::false_, const U0& u0, const U1& u1) + { + base_type::open(u0, u1, -1); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1) + { + base_type::open(T(const_cast(u0), u1), -1, -1); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::true_, U0& u0, const U1& u1) + { + base_type::open(T(u0, u1), -1, -1); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + template + void open_impl(mpl::false_, const U0& u0, const U1& u1, const U2& u2) + { + base_type::open(u0, u1, u2); + } + template + void open_impl(mpl::true_, const U0& u0, const U1& u1, const U2& u2) + { + base_type::open(T(const_cast(u0), u1, u2), -1, -1); + } +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + template + void open_impl(mpl::true_, U0& u0, const U1& u1, const U2& u2) + { + base_type::open(T(u0, u1, u2), -1, -1); + } +#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------// + void check_open() + { + if (this->is_open()) + throw BOOST_IOSTREAMS_FAILURE("already open"); + } +}; + +} } // End namespaces iostreams, boost. + +#endif // BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/buffer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/buffer.hpp new file mode 100644 index 0000000000..5ba9041b85 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/buffer.hpp @@ -0,0 +1,200 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_BUFFERS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_BUFFERS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // swap. +#include // allocator. +#include // member templates. +#include +#include // streamsize. +#include +#include // int_type_of. +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +//----------------Buffers-----------------------------------------------------// + +// +// Template name: buffer +// Description: Character buffer. +// Template paramters: +// Ch - The character type. +// Alloc - The Allocator type. +// +template< typename Ch, + typename Alloc = std::allocator > +class basic_buffer { +private: +#ifndef BOOST_NO_STD_ALLOCATOR + typedef typename Alloc::template rebind::other allocator_type; +#else + typedef std::allocator allocator_type; +#endif +public: + basic_buffer(); + basic_buffer(int buffer_size); + ~basic_buffer(); + void resize(int buffer_size); + Ch* begin() const { return buf_; } + Ch* end() const { return buf_ + size_; } + Ch* data() const { return buf_; } + std::streamsize size() const { return size_; } + void swap(basic_buffer& rhs); +private: + // Disallow copying and assignment. + basic_buffer(const basic_buffer&); + basic_buffer& operator=(const basic_buffer&); + Ch* buf_; + std::streamsize size_; +}; + +template +void swap(basic_buffer& lhs, basic_buffer& rhs) +{ lhs.swap(rhs); } + +// +// Template name: buffer +// Description: Character buffer with two pointers accessible via ptr() and +// eptr(). +// Template paramters: +// Ch - A character type. +// +template< typename Ch, + typename Alloc = std::allocator > +class buffer : public basic_buffer { +private: + typedef basic_buffer base; +public: + typedef iostreams::char_traits traits_type; + using base::resize; + using base::data; + using base::size; + typedef Ch* const const_pointer; + buffer(int buffer_size); + Ch* & ptr() { return ptr_; } + const_pointer& ptr() const { return ptr_; } + Ch* & eptr() { return eptr_; } + const_pointer& eptr() const { return eptr_; } + void set(std::streamsize ptr, std::streamsize end); + void swap(buffer& rhs); + + // Returns an int_type as a status code. + template + typename int_type_of::type fill(Source& src) + { + using namespace std; + std::streamsize keep; + if ((keep = static_cast(eptr_ - ptr_)) > 0) + traits_type::move(this->data(), ptr_, keep); + set(0, keep); + std::streamsize result = + iostreams::read(src, this->data() + keep, this->size() - keep); + if (result != -1) + this->set(0, keep + result); + //return result == this->size() - keep ? + // traits_type::good() : + // keep == -1 ? + // traits_type::eof() : + // traits_type::would_block(); + return result == -1 ? + traits_type::eof() : + result == 0 ? + traits_type::would_block() : + traits_type::good(); + + } + + // Returns true if one or more characters were written. + template + bool flush(Sink& dest) + { + using namespace std; + std::streamsize amt = static_cast(eptr_ - ptr_); + std::streamsize result = iostreams::write_if(dest, ptr_, amt); + if (result < amt) { + traits_type::move( this->data(), + ptr_ + result, + amt - result ); + } + this->set(0, amt - result); + return result != 0; + } +private: + Ch *ptr_, *eptr_; +}; + +template +void swap(buffer& lhs, buffer& rhs) +{ lhs.swap(rhs); } + +//--------------Implementation of basic_buffer--------------------------------// + +template +basic_buffer::basic_buffer() : buf_(0), size_(0) { } + +template +basic_buffer::basic_buffer(int buffer_size) + : buf_(static_cast(allocator_type().allocate(buffer_size, 0))), + size_(buffer_size) // Cast for SunPro 5.3. + { } + +template +inline basic_buffer::~basic_buffer() +{ if (buf_) allocator_type().deallocate(buf_, size_); } + +template +inline void basic_buffer::resize(int buffer_size) +{ + if (size_ != buffer_size) { + basic_buffer temp(buffer_size); + std::swap(size_, temp.size_); + std::swap(buf_, temp.buf_); + } +} + +template +void basic_buffer::swap(basic_buffer& rhs) +{ + std::swap(buf_, rhs.buf_); + std::swap(size_, rhs.size_); +} + +//--------------Implementation of buffer--------------------------------------// + +template +buffer::buffer(int buffer_size) + : basic_buffer(buffer_size) { } + +template +inline void buffer::set(std::streamsize ptr, std::streamsize end) +{ + ptr_ = data() + ptr; + eptr_ = data() + end; +} + +template +inline void buffer::swap(buffer& rhs) +{ + base::swap(rhs); + std::swap(ptr_, rhs.ptr_); + std::swap(eptr_, rhs.eptr_); +} + +//----------------------------------------------------------------------------// + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_BUFFERS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/call_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/call_traits.hpp new file mode 100644 index 0000000000..6b04c7a656 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/call_traits.hpp @@ -0,0 +1,32 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_VALUE_TYPE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_VALUE_TYPE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +struct param_type { + typedef typename mpl::if_, T&, const T&>::type type; +}; + +template +struct value_type { + typedef typename mpl::if_, T&, T>::type type; +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_VALUE_TYPE_HPP_INCLUDED //-----------// diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/char_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/char_traits.hpp new file mode 100644 index 0000000000..2ee2fd0d4f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/char_traits.hpp @@ -0,0 +1,63 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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.) + +// Provides std::char_traits for libraries without templated streams. Should not +// be confused with , which defines the +// template boost::iostreams::char_traits. + +// See http://www.boost.org/libs/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_CHAR_TRAITS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CHAR_TRAITS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#ifdef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# include // Make sure size_t is in std. +# include +# include +# include +#endif + +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------------------// +# define BOOST_IOSTREAMS_CHAR_TRAITS(ch) std::char_traits< ch > +#else +# define BOOST_IOSTREAMS_CHAR_TRAITS(ch) boost::iostreams::detail::char_traits + +namespace boost { namespace iostreams { namespace detail { + +struct char_traits { + typedef char char_type; + typedef int int_type; + typedef std::streampos pos_type; + typedef std::streamoff off_type; + + // Note: this may not be not conforming, since it treats chars as unsigned, + // but is only used to test for equality. + static int compare(const char* lhs, const char* rhs, std::size_t n) + { return std::strncmp(lhs, rhs, n); } + static char* copy(char *dest, const char *src, std::size_t n) + { return static_cast(std::memcpy(dest, src, n)); } + static char* move(char *dest, const char *src, std::size_t n) + { return static_cast(std::memmove(dest, src, n)); } + static const char* find(const char* s, std::size_t n, const char& c) + { return (const char*) (const void*) std::memchr(s, c, n); } + static char to_char_type(const int& c) { return c; } + static int to_int_type(const char& c) { return c; } + static bool eq_int_type(const int& lhs, const int& rhs) + { return lhs == rhs; } + static int eof() { return EOF; } + static int not_eof(const int& c) { return c != EOF ? c : '\n'; } +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifdef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-----------------------// + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CHAR_TRAITS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/codecvt_helper.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/codecvt_helper.hpp new file mode 100644 index 0000000000..afd03779f1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/codecvt_helper.hpp @@ -0,0 +1,238 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains the definition of the template codecvt_helper, useful for +// defining specializations of std::codecvt where state_type != mbstate_t. +// Compensates for the fact that some standard library implementations +// do not derive the primiary codecvt template from locale::facet or +// provide the correct member types and functions. + +// Usage: +// +// // In global namespace: +// BOOST_IOSTREAMS_CODECVT_SPEC(mystate) +// +// // In user namespace: +// template +// struct mycodecvt : codecvt_helper { ... }; +// +// // Or: +// struct mycodecvt : codecvt_helper { ... }; +// +// Etc. + +#ifndef BOOST_IOSTREAMS_DETAIL_CODECVT_HELPER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CODECVT_HELPER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // Put size_t in std, BOOST_MSVC, Dinkum. +#include +#include // min. +#include // size_t. +#include // locale, codecvt_base, codecvt. +#include + +//------------------Definition of traits--------------------------------------// + +namespace boost { namespace iostreams { namespace detail { + +#if !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) //-----------------------// + +template +struct codecvt_intern { typedef typename T::intern_type type; }; + +template +struct codecvt_extern { typedef typename T::extern_type type; }; + +#else // #if !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) //--------------// + +template +struct codecvt_intern { typedef typename T::from_type type; }; + +template +struct codecvt_extern { typedef typename T::to_type type; }; + +#endif // #if !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) //-------------// + +template +struct codecvt_state { typedef typename T::state_type type; }; + +} } } // End namespaces detail, iostreams, boost. + +//------------------Definition of codecvt_impl--------------------------------// + +#if defined(BOOST_IOSTREAMS_NO_PRIMARY_CODECVT_DEFINITION) || \ + defined(BOOST_IOSTREAMS_EMPTY_PRIMARY_CODECVT_DEFINITION) || \ + defined(BOOST_IOSTREAMS_NO_LOCALE) \ + /**/ + +namespace boost { namespace iostreams { namespace detail { + +template +struct codecvt_impl : std::locale::facet, std::codecvt_base { +public: + typedef Intern intern_type; + typedef Extern extern_type; + typedef State state_type; + + codecvt_impl(std::size_t refs = 0) : std::locale::facet(refs) { } + + std::codecvt_base::result + in( State& state, const Extern* first1, const Extern* last1, + const Extern*& next1, Intern* first2, Intern* last2, + Intern*& next2 ) const + { + return do_in(state, first1, last1, next1, first2, last2, next2); + } + + std::codecvt_base::result + out( State& state, const Intern* first1, const Intern* last1, + const Intern*& next1, Extern* first2, Extern* last2, + Extern*& next2 ) const + { + return do_out(state, first1, last1, next1, first2, last2, next2); + } + + std::codecvt_base::result + unshift(State& state, Extern* first2, Extern* last2, Extern*& next2) const + { + return do_unshift(state, first2, last2, next2); + } + + bool always_noconv() const throw() { return do_always_noconv(); } + + int max_length() const throw() { return do_max_length(); } + + int encoding() const throw() { return do_encoding(); } + + int length( BOOST_IOSTREAMS_CODECVT_CV_QUALIFIER State& state, + const Extern* first1, const Extern* last1, + std::size_t len2 ) const throw() + { + return do_length(state, first1, last1, len2); + } +protected: + std::codecvt_base::result + virtual do_in( State&, const Extern*, const Extern*, const Extern*&, + Intern*, Intern*, Intern*& ) const + { + return std::codecvt_base::noconv; + } + + std::codecvt_base::result + virtual do_out( State&, const Intern*, const Intern*, const Intern*&, + Extern*, Extern*, Extern*& ) const + { + return std::codecvt_base::noconv; + } + + std::codecvt_base::result + virtual do_unshift( State& state, Extern* first2, Extern* last2, + Extern*& next2 ) const + { + return std::codecvt_base::ok; + } + + virtual bool do_always_noconv() const throw() { return true; } + + virtual int do_max_length() const throw() { return 1; } + + virtual int do_encoding() const throw() { return 1; } + + virtual int do_length( BOOST_IOSTREAMS_CODECVT_CV_QUALIFIER State& state, + const Extern* first1, const Extern* last1, + std::size_t len2 ) const throw() + { + return (std::min)(static_cast(last1 - first1), len2); + } +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // no primary codecvt definition, empty definition. + +//------------------Definition of BOOST_IOSTREAMS_CODECVT_SPEC----------------// + +#if defined(BOOST_IOSTREAMS_NO_PRIMARY_CODECVT_DEFINITION) || \ + defined(BOOST_IOSTREAMS_EMPTY_PRIMARY_CODECVT_DEFINITION) \ + /**/ +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# define BOOST_IOSTREAMS_CODECVT_SPEC(state) \ + namespace std { \ + template \ + class codecvt \ + : public ::boost::iostreams::detail::codecvt_impl< \ + Intern, Extern, state \ + > \ + { \ + public: \ + codecvt(std::size_t refs = 0) \ + : ::boost::iostreams::detail::codecvt_impl< \ + Intern, Extern, state \ + >(refs) \ + { } \ + static std::locale::id id; \ + }; \ + template \ + std::locale::id codecvt::id; \ + } \ + /**/ +# else +# define BOOST_IOSTREAMS_CODECVT_SPEC(state) \ + namespace std { \ + template<> \ + class codecvt \ + : public ::boost::iostreams::detail::codecvt_impl< \ + wchar_t, char, state \ + > \ + { \ + public: \ + codecvt(std::size_t refs = 0) \ + : ::boost::iostreams::detail::codecvt_impl< \ + wchar_t, char, state \ + >(refs) \ + { } \ + static std::locale::id id; \ + }; \ + template<> \ + std::locale::id codecvt::id; \ + } \ + /**/ +# endif +#else +# define BOOST_IOSTREAMS_CODECVT_SPEC(state) +#endif // no primary codecvt definition, or empty definition. + +namespace boost { namespace iostreams { namespace detail { + +//------------------Definition of codecvt_helper------------------------------// + +template +struct codecvt_helper : std::codecvt { + typedef Intern intern_type; + typedef Extern extern_type; + typedef State state_type; + codecvt_helper(std::size_t refs = 0) + #if !defined(BOOST_IOSTREAMS_NO_CODECVT_CTOR_FROM_SIZE_T) + : std::codecvt(refs) + #else + : std::codecvt() + #endif + { } +#ifdef BOOST_IOSTREAMS_NO_CODECVT_MAX_LENGTH + int max_length() const throw() { return do_max_length(); } +protected: + virtual int do_max_length() const throw() { return 1; } +#endif +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CODECVT_HELPER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/codecvt_holder.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/codecvt_holder.hpp new file mode 100644 index 0000000000..6d6e1cf179 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/codecvt_holder.hpp @@ -0,0 +1,63 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains machinery for performing code conversion. + +#ifndef BOOST_IOSTREAMS_DETAIL_CODECVT_HOLDER_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CODECVT_HOLDER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // mbstate_t. +#include // codecvt, locale. +#include // HAS_MACRO_USE_FACET. +#include + +namespace boost { namespace iostreams { namespace detail { + +struct default_codecvt { + typedef wchar_t intern_type, from_type; + typedef char extern_type, to_type; + typedef std::mbstate_t state_type; +}; + +template +struct codecvt_holder { + typedef Codecvt codecvt_type; + const codecvt_type& get() const { return codecvt_; } + void imbue(const std::locale&) { } + Codecvt codecvt_; +}; + +template<> +struct codecvt_holder { + typedef std::codecvt codecvt_type; + codecvt_holder() { reset_codecvt(); } + const codecvt_type& get() const { return *codecvt_; } + void imbue(const std::locale& loc) + { + loc_ = loc; + reset_codecvt(); + } + void reset_codecvt() + { + using namespace std; + #ifndef BOOST_HAS_MACRO_USE_FACET + codecvt_ = & use_facet< codecvt_type >(loc_); + #else + codecvt_ = & _USE(loc_, codecvt_type); + #endif + } + std::locale loc_; // Prevent codecvt_ from being freed. + const codecvt_type* codecvt_; +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CODECVT_HOLDER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/auto_link.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/auto_link.hpp new file mode 100644 index 0000000000..55f954b64f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/auto_link.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Adapted from and from +// http://www.boost.org/more/separate_compilation.html, by John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_AUTO_LINK_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_AUTO_LINK_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(BOOST_EXTERNAL_LIB_NAME) +# if defined(BOOST_MSVC) \ + || defined(__BORLANDC__) \ + || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \ + || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) \ + /**/ +# pragma comment(lib, BOOST_EXTERNAL_LIB_NAME) +# endif +# undef BOOST_EXTERNAL_LIB_NAME +#endif + +//------------------Enable automatic library variant selection----------------// + +#if !defined(BOOST_IOSTREAMS_SOURCE) && \ + !defined(BOOST_ALL_NO_LIB) && \ + !defined(BOOST_IOSTREAMS_NO_LIB) \ + /**/ + +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it. +# define BOOST_LIB_NAME boost_iostreams + +// If we're importing code from a dll, then tell auto_link.hpp about it. +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_IOSTREAMS_DYN_LINK) +# define BOOST_DYN_LINK +# endif + +// And include the header that does the work. +# include +#endif // auto-linking disabled + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_AUTO_LINK_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/bzip2.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/bzip2.hpp new file mode 100644 index 0000000000..d716fd169c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/bzip2.hpp @@ -0,0 +1,48 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Adapted from and from +// http://www.boost.org/more/separate_compilation.html, by John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_BZIP2_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_BZIP2_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(BOOST_BZIP2_BINARY) +# if defined(BOOST_MSVC) || \ + defined(__BORLANDC__) || \ + (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) || \ + (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) \ + /**/ + +// Specify the name of the .lib file. +# pragma comment(lib, BOOST_STRINGIZE(BOOST_BZIP2_BINARY)) +# endif +#else +# if !defined(BOOST_IOSTREAMS_SOURCE) && \ + !defined(BOOST_ALL_NO_LIB) && \ + !defined(BOOST_IOSTREAMS_NO_LIB) \ + /**/ + +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it. +# define BOOST_LIB_NAME boost_bzip2 + +// If we're importing code from a dll, then tell auto_link.hpp about it. +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_IOSTREAMS_DYN_LINK) +# define BOOST_DYN_LINK +# endif + +// And include the header that does the work. +# include +# endif +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_BZIP2_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/codecvt.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/codecvt.hpp new file mode 100644 index 0000000000..7c6cb1f385 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/codecvt.hpp @@ -0,0 +1,80 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_CODECVT_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_CODECVT_HPP_INCLUDED + +#include +#include +#include +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +//------------------Support for codecvt with user-defined state types---------// + +#if defined(__MSL_CPP__) || defined(__LIBCOMO__) || \ + BOOST_WORKAROUND(_STLPORT_VERSION, <= 0x450) \ + /**/ +# define BOOST_IOSTREAMS_NO_PRIMARY_CODECVT_DEFINITION +#endif + +#if defined(__GLIBCPP__) || defined(__GLIBCXX__) || \ + BOOST_WORKAROUND(_STLPORT_VERSION, > 0x450) \ + /**/ +# define BOOST_IOSTREAMS_EMPTY_PRIMARY_CODECVT_DEFINITION +#endif + +//------------------Check for codecvt ctor taking a reference count-----------// + +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) || \ + BOOST_WORKAROUND(_STLPORT_VERSION, < 0x461) \ + /**/ +# define BOOST_IOSTREAMS_NO_CODECVT_CTOR_FROM_SIZE_T +#endif + +//------------------Normalize codecvt::length---------------------------------// + +#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) && \ + (!defined(BOOST_RWSTD_VER) || BOOST_RWSTD_VER < 0x04010300) && \ + (!defined(__MACH__) || !defined(__INTEL_COMPILER)) + /**/ +# define BOOST_IOSTREAMS_CODECVT_CV_QUALIFIER const +#else +# define BOOST_IOSTREAMS_CODECVT_CV_QUALIFIER +#endif + +//------------------Check for codecvt::max_length-----------------------------// + +#if BOOST_WORKAROUND(_STLPORT_VERSION, < 0x461) +# define BOOST_IOSTREAMS_NO_CODECVT_MAX_LENGTH +#endif + +//------------------Put mbstate_t and codecvt in std--------------------------// + +#ifndef BOOST_IOSTREAMS_NO_LOCALE +# include +#endif + +// From Robert Ramey's version of utf8_codecvt_facet. +namespace std { + +#if defined(__LIBCOMO__) + using ::mbstate_t; +#elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__) + using ::mbstate_t; +#elif defined(__SGI_STL_PORT) +#elif defined(BOOST_NO_STDC_NAMESPACE) + using ::codecvt; + using ::mbstate_t; +#endif + +} // End namespace std. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_CODECVT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/disable_warnings.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/disable_warnings.hpp new file mode 100644 index 0000000000..0109d97452 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/disable_warnings.hpp @@ -0,0 +1,27 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#include // BOOST_MSVC. +#include // BOOST_WORKAROUND. + +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4127) // Conditional expression is constant. +# pragma warning(disable:4130) // Logical operation on address of string constant. +# pragma warning(disable:4224) // Parameter previously defined as type. +# pragma warning(disable:4244) // Conversion: possible loss of data. +# pragma warning(disable:4512) // Assignment operator could not be generated. +# pragma warning(disable:4706) // Assignment within conditional expression. +#else +# if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# pragma warn -8008 // Condition always true/false. +# pragma warn -8066 // Unreachable code. +# pragma warn -8071 // Conversion may lose significant digits. +# pragma warn -8072 // Suspicious pointer arithmetic. +# pragma warn -8080 // identifier declared but never used. +# endif +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/dyn_link.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/dyn_link.hpp new file mode 100644 index 0000000000..518e0b03ce --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/dyn_link.hpp @@ -0,0 +1,37 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Adapted from http://www.boost.org/more/separate_compilation.html, by +// John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_DYN_LINK_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_DYN_LINK_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include + +//------------------Enable dynamic linking on windows-------------------------// + +#ifdef BOOST_HAS_DECLSPEC +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_IOSTREAMS_DYN_LINK) +# ifdef BOOST_IOSTREAMS_SOURCE +# define BOOST_IOSTREAMS_DECL __declspec(dllexport) +# else +# define BOOST_IOSTREAMS_DECL __declspec(dllimport) +# endif +# endif +#endif + +#ifndef BOOST_IOSTREAMS_DECL +# define BOOST_IOSTREAMS_DECL +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_DYN_LINK_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/enable_warnings.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/enable_warnings.hpp new file mode 100644 index 0000000000..5712f36442 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/enable_warnings.hpp @@ -0,0 +1,18 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#else +# if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# pragma warn .8008 // Condition always true/false. +# pragma warn .8066 // Unreachable code. +# pragma warn .8071 // Conversion may lose significant digits. +# pragma warn .8072 // Suspicious pointer arithmetic. +# pragma warn .8080 // identifier declared but never used. +# endif +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/fpos.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/fpos.hpp new file mode 100644 index 0000000000..811a8d66f6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/fpos.hpp @@ -0,0 +1,31 @@ +/* + * 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/iostreams for documentation. + + * File: boost/iostreams/detail/execute.hpp + * Date: Thu Dec 06 13:21:54 MST 2007 + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * Defines the preprocessor symbol BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS for + * platforms that use the implementation of std::fpos from the Dinkumware + * Standard Library. + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_FPOS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_FPOS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +# if (defined(_YVALS) || defined(_CPPLIB_VER)) && !defined(__SGI_STL_PORT) && \ + !defined(_STLPORT_VERSION) && !defined(__QNX__) + /**/ +# define BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS +# endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_FPOS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/gcc.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/gcc.hpp new file mode 100644 index 0000000000..e8512098ce --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/gcc.hpp @@ -0,0 +1,24 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Adapted from and from +// http://www.boost.org/more/separate_compilation.html, by John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_GCC_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_GCC_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_INTEL. + +#if defined(__GNUC__) && !defined(BOOST_INTEL) +# define BOOST_IOSTREAMS_GCC (__GNUC__ * 100 + __GNUC_MINOR__) +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_GCC_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/limits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/limits.hpp new file mode 100644 index 0000000000..155d6b0a69 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/limits.hpp @@ -0,0 +1,19 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_LIMITS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_LIMITS_HPP_INCLUDED + +#ifndef BOOST_IOSTREAMS_MAX_FORWARDING_ARITY +# define BOOST_IOSTREAMS_MAX_FORWARDING_ARITY 3 +#endif + +#ifndef BOOST_IOSTREAMS_MAX_EXECUTE_ARITY +# define BOOST_IOSTREAMS_MAX_EXECUTE_ARITY 5 +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_LIMITS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/overload_resolution.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/overload_resolution.hpp new file mode 100644 index 0000000000..bbdd442788 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/overload_resolution.hpp @@ -0,0 +1,32 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Adapted from and from +// http://www.boost.org/more/separate_compilation.html, by John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC. +#include +#include + +#if !defined(BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION) +# if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) || \ + BOOST_WORKAROUND(__BORLANDC__, < 0x600) || \ + BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || \ + BOOST_WORKAROUND(BOOST_IOSTREAMS_GCC, <= 295) \ + /**/ +# define BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION +# endif +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_BROKEN_OVERLOAD_RESOLUTION_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/rtl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/rtl.hpp new file mode 100644 index 0000000000..abe3438bbf --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/rtl.hpp @@ -0,0 +1,68 @@ +/* + * 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/iostreams for documentation. + * + * Defines preprocessor symbols expanding to the names of functions in the + * C runtime library used to access file descriptors and to the type used + * to store file offsets for seeking. + * + * File: boost/iostreams/detail/config/rtl.hpp + * Date: Wed Dec 26 11:58:11 MST 2007 + * + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED + +#include +#include + +// Handle open, close, read, and write +#ifdef __BORLANDC__ +# define BOOST_IOSTREAMS_RTL(x) BOOST_JOIN(_rtl_, x) +#elif defined BOOST_IOSTREAMS_WINDOWS +# define BOOST_IOSTREAMS_RTL(x) BOOST_JOIN(_, x) +#else +# define BOOST_IOSTREAMS_RTL(x) ::x // Distinguish from member function named x +#endif +#define BOOST_IOSTREAMS_FD_OPEN BOOST_IOSTREAMS_RTL(open) +#define BOOST_IOSTREAMS_FD_CLOSE BOOST_IOSTREAMS_RTL(close) +#define BOOST_IOSTREAMS_FD_READ BOOST_IOSTREAMS_RTL(read) +#define BOOST_IOSTREAMS_FD_WRITE BOOST_IOSTREAMS_RTL(write) + +// Handle lseek, off_t, ftruncate, and stat +#ifdef BOOST_IOSTREAMS_WINDOWS +# if defined(BOOST_MSVC) || defined(__MSVCRT__) // MSVC, MinGW +# define BOOST_IOSTREAMS_FD_SEEK _lseeki64 +# define BOOST_IOSTREAMS_FD_OFFSET __int64 +# else // Borland, Metrowerks, ... +# define BOOST_IOSTREAMS_FD_SEEK lseek +# define BOOST_IOSTREAMS_FD_OFFSET long +# endif +#else // Non-windows +# if defined(_LARGEFILE64_SOURCE) && \ + (!defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64) || \ + defined(_AIX) && !defined(_LARGE_FILES) || \ + defined(BOOST_IOSTREAMS_HAS_LARGE_FILE_EXTENSIONS) + /**/ + + /* Systems with transitional extensions for large file support */ + +# define BOOST_IOSTREAMS_FD_SEEK lseek64 +# define BOOST_IOSTREAMS_FD_TRUNCATE ftruncate64 +# define BOOST_IOSTREAMS_FD_STAT stat64 +# define BOOST_IOSTREAMS_FD_OFFSET off64_t +# else +# define BOOST_IOSTREAMS_FD_SEEK lseek +# define BOOST_IOSTREAMS_FD_TRUNCATE ftruncate +# define BOOST_IOSTREAMS_FD_STAT stat +# define BOOST_IOSTREAMS_FD_OFFSET off_t +# endif +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_RTL_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/wide_streams.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/wide_streams.hpp new file mode 100644 index 0000000000..425875e1f8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/wide_streams.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Adapted from http://www.boost.org/more/separate_compilation.html, by +// John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_WIDE_STREAMS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_WIDE_STREAMS_HPP_INCLUDED + +#include +#include +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +//------------------Templated stream support----------------------------------// + +// From boost/dynamic_bitset.hpp; thanks to Matthias Troyer for cray patch. +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# if defined(__STL_CONFIG_H) && \ + !defined (__STL_USE_NEW_IOSTREAMS) && !defined(__crayx1) \ + /**/ +# define BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# endif +#endif // #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES + +//------------------Wide stream support---------------------------------------// + +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS +# if defined(BOOST_IOSTREAMS_NO_STREAM_TEMPLATES) || \ + defined (BOOST_NO_STD_WSTREAMBUF) && \ + ( !defined(__MSL_CPP__) || defined(_MSL_NO_WCHART_CPP_SUPPORT) ) \ + /**/ +# define BOOST_IOSTREAMS_NO_WIDE_STREAMS +# endif +#endif // #ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS + +//------------------Locale support--------------------------------------------// + +#ifndef BOOST_IOSTREAMS_NO_LOCALE +# if defined(BOOST_NO_STD_LOCALE) || \ + defined(__CYGWIN__) && \ + ( !defined(__MSL_CPP__) || defined(_MSL_NO_WCHART_CPP_SUPPORT) ) \ + /**/ +# define BOOST_IOSTREAMS_NO_LOCALE +# endif +#endif // #ifndef BOOST_IOSTREAMS_NO_LOCALE + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_WIDE_STREAMS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/windows_posix.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/windows_posix.hpp new file mode 100644 index 0000000000..4e73c50d0d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/windows_posix.hpp @@ -0,0 +1,25 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2004-2007 Jonathan Turkanis +// (C) Copyright 2002, 2003 Beman Dawes Boost.Filesystem +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_WINDOWS_POSIX_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_WINDOWS_POSIX_HPP_INCLUDED + +//------------------From boost/libs/filesystem/src/path_posix_windows.cpp-----// + +// BOOST_IOSTREAMS_POSIX or BOOST_IOSTREAMS_WINDOWS specify which API to use. +#if !defined( BOOST_IOSTREAMS_WINDOWS ) && !defined( BOOST_IOSTREAMS_POSIX ) +# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && \ + !defined(__CYGWIN__) \ + /**/ +# define BOOST_IOSTREAMS_WINDOWS +# else +# define BOOST_IOSTREAMS_POSIX +# endif +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_WINDOWS_POSIX_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/zlib.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/zlib.hpp new file mode 100644 index 0000000000..9283e4caa9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/config/zlib.hpp @@ -0,0 +1,50 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Adapted from and from +// http://www.boost.org/more/separate_compilation.html, by John Maddock. + +#ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_ZLIB_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CONFIG_ZLIB_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_STRINGIZE. + +#if defined(BOOST_ZLIB_BINARY) +# if defined(BOOST_MSVC) || \ + defined(__BORLANDC__) || \ + (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) || \ + (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) \ + /**/ + +// Specify the name of the .lib file. +# pragma comment(lib, BOOST_STRINGIZE(BOOST_ZLIB_BINARY)) +# endif +#else +# if !defined(BOOST_IOSTREAMS_SOURCE) && \ + !defined(BOOST_ALL_NO_LIB) && \ + !defined(BOOST_IOSTREAMS_NO_LIB) \ + /**/ + +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it. +# define BOOST_LIB_NAME boost_zlib + +// If we're importing code from a dll, then tell auto_link.hpp about it. +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_IOSTREAMS_DYN_LINK) +# define BOOST_DYN_LINK +# endif + +// And include the header that does the work. +# include +# endif +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_ZLIB_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/counted_array.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/counted_array.hpp new file mode 100644 index 0000000000..d37193e7ab --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/counted_array.hpp @@ -0,0 +1,64 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_COUNTED_ARRAY_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_COUNTED_ARRAY_HPP_INCLUDED + +#include // min. +#include +#include +#include // streamsize. + +namespace boost { namespace iostreams { namespace detail { + +template +class counted_array_source { +public: + typedef Ch char_type; + typedef source_tag category; + counted_array_source(const Ch* buf, std::streamsize size) + : buf_(buf), ptr_(0), end_(size) + { } + std::streamsize read(Ch* s, std::streamsize n) + { + std::streamsize result = (std::min)(n, end_ - ptr_); + BOOST_IOSTREAMS_CHAR_TRAITS(char_type)::copy + (s, buf_ + ptr_, result); + ptr_ += result; + return result; + } + std::streamsize count() const { return ptr_; } +private: + const Ch* buf_; + std::streamsize ptr_, end_; +}; + +template +struct counted_array_sink { +public: + typedef Ch char_type; + typedef sink_tag category; + counted_array_sink(Ch* buf, std::streamsize size) + : buf_(buf), ptr_(0), end_(size) + { } + std::streamsize write(const Ch* s, std::streamsize n) + { + std::streamsize result = (std::min)(n, end_ - ptr_); + BOOST_IOSTREAMS_CHAR_TRAITS(char_type)::copy + (buf_ + ptr_, s, result); + ptr_ += result; + return result; + } + std::streamsize count() const { return ptr_; } +private: + Ch* buf_; + std::streamsize ptr_, end_; +}; + +} } } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_COUNTED_ARRAY_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/current_directory.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/current_directory.hpp new file mode 100644 index 0000000000..f9fb690cc6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/current_directory.hpp @@ -0,0 +1,60 @@ +/* + * 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/iostreams for documentation. + + * File: boost/iostreams/detail/execute.hpp + * Date: Thu Dec 06 13:21:54 MST 2007 + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * Defines the function boost::iostreams::detail::current_directory, used by + * boost::iostreams::detail::absolute_path. + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_CURRENT_DIRECTORY_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CURRENT_DIRECTORY_HPP_INCLUDED + +#include // make sure size_t is in std. +#include // size_t +#include +#include +#include +#include +#ifdef BOOST_IOSTREAMS_WINDOWS +# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +# include +#else +# include // sysconf. +#endif + +namespace boost { namespace iostreams { namespace detail { + +// Returns the current working directory +inline std::string current_directory() +{ +#ifdef BOOST_IOSTREAMS_WINDOWS + DWORD length; + basic_buffer buf(MAX_PATH); + while (true) { + length = ::GetCurrentDirectoryA(buf.size(), buf.data()); + if (!length) + throw_system_failure("failed determining current directory"); + if (length < static_cast(buf.size())) + break; + buf.resize(buf.size() * 2); + } + return std::string(buf.data(), length); +#else // #ifdef BOOST_IOSTREAMS_WINDOWS + basic_buffer buf(pathconf(".", _PC_PATH_MAX)); + if (!getcwd(buf.data(), static_cast(buf.size()))) + throw_system_failure("failed determining current directory"); + return std::string(buf.data()); +#endif // #ifdef BOOST_IOSTREAMS_WINDOWS +} + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CURRENT_DIRECTORY_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/default_arg.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/default_arg.hpp new file mode 100644 index 0000000000..9364ca27fa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/default_arg.hpp @@ -0,0 +1,25 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_DEFAULT_ARG_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_DEFAULT_ARG_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +# include +# define BOOST_IOSTREAMS_DEFAULT_ARG(arg) mpl::identity< arg >::type +#else +# define BOOST_IOSTREAMS_DEFAULT_ARG(arg) arg +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DEFAULT_ARG_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/dispatch.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/dispatch.hpp new file mode 100644 index 0000000000..b482e04319 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/dispatch.hpp @@ -0,0 +1,41 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_DISPATCH_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_DISPATCH_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_DEDUCED_TYPENAME. +#include +#include // category_of. +#include +#include + +namespace boost { namespace iostreams {namespace detail { + +template< typename T, typename Tag1, typename Tag2, + typename Tag3 = mpl::void_, typename Tag4 = mpl::void_, + typename Tag5 = mpl::void_, typename Tag6 = mpl::void_, + typename Category = + BOOST_DEDUCED_TYPENAME category_of::type > +struct dispatch + : iostreams::select< // Disambiguation for Tru64. + is_convertible, Tag1, + is_convertible, Tag2, + is_convertible, Tag3, + is_convertible, Tag4, + is_convertible, Tag5, + is_convertible, Tag6 + > + { }; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DISPATCH_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/double_object.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/double_object.hpp new file mode 100644 index 0000000000..69f6587753 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/double_object.hpp @@ -0,0 +1,114 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2004-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains the definition of the class template +// boost::iostreams::detail::double_object, which is similar to compressed pair +// except that both members of the pair have the same type, and +// compression occurs only if requested using a boolean template +// parameter. + +#ifndef BOOST_IOSTREAMS_DETAIL_DOUBLE_OBJECT_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_DOUBLE_OBJECT_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // swap. +#include +#include +#if BOOST_WORKAROUND(__MWERKS__, > 0x3003) +# include +#else +# include +#endif + +namespace boost { namespace iostreams { namespace detail { + +template +class single_object_holder { +public: +#if BOOST_WORKAROUND(__MWERKS__, > 0x3003) + typedef Metrowerks::call_traits traits_type; +#else + typedef boost::call_traits traits_type; +#endif + typedef typename traits_type::param_type param_type; + typedef typename traits_type::reference reference; + typedef typename traits_type::const_reference const_reference; + single_object_holder() { } + single_object_holder(param_type t) : first_(t) { } + reference first() { return first_; } + const_reference first() const { return first_; } + reference second() { return first_; } + const_reference second() const { return first_; } + void swap(single_object_holder& o) + { std::swap(first_, o.first_); } +private: + T first_; +}; + +template +struct double_object_holder { +public: +#if BOOST_WORKAROUND(__MWERKS__, > 0x3003) + typedef Metrowerks::call_traits traits_type; +#else + typedef boost::call_traits traits_type; +#endif + typedef typename traits_type::param_type param_type; + typedef typename traits_type::reference reference; + typedef typename traits_type::const_reference const_reference; + double_object_holder() { } + double_object_holder(param_type t1, param_type t2) + : first_(t1), second_(t2) { } + reference first() { return first_; } + const_reference first() const { return first_; } + reference second() { return second_; } + const_reference second() const { return second_; } + void swap(double_object_holder& d) + { + std::swap(first_, d.first_); + std::swap(second_, d.second_); + } +private: + T first_, second_; +}; + +template +class double_object + : public mpl::if_< + IsDouble, + double_object_holder, + single_object_holder + >::type +{ +private: + typedef typename + mpl::if_< + IsDouble, + double_object_holder, + single_object_holder + >::type base_type; +public: +#if BOOST_WORKAROUND(__MWERKS__, > 0x3003) + typedef Metrowerks::call_traits traits_type; +#else + typedef boost::call_traits traits_type; +#endif + typedef typename traits_type::param_type param_type; + typedef typename traits_type::reference reference; + typedef typename traits_type::const_reference const_reference; + double_object() : base_type() {} + double_object(param_type t1, param_type t2) + : base_type(t1, t2) { } + bool is_double() const { return IsDouble::value; } +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DOUBLE_OBJECT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/enable_if_stream.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/enable_if_stream.hpp new file mode 100644 index 0000000000..2cdd7068cb --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/enable_if_stream.hpp @@ -0,0 +1,32 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_ENABLE_IF_STREAM_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_ENABLE_IF_STREAM_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_NO_SFINAE. +#include +#include // is_std_io. + +#if !defined(BOOST_NO_SFINAE) && \ + !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) +# define BOOST_IOSTREAMS_ENABLE_IF_STREAM(T) \ + , typename boost::enable_if< boost::iostreams::is_std_io >::type* = 0 \ + /**/ +# define BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) \ + , typename boost::disable_if< boost::iostreams::is_std_io >::type* = 0 \ + /**/ +#else +# define BOOST_IOSTREAMS_ENABLE_IF_STREAM(T) +# define BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_ENABLE_IF_STREAM_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/error.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/error.hpp new file mode 100644 index 0000000000..57999d4ef5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/error.hpp @@ -0,0 +1,45 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_ERROR_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_ERROR_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // failure. + +namespace boost { namespace iostreams { namespace detail { + +inline BOOST_IOSTREAMS_FAILURE cant_read() +{ return BOOST_IOSTREAMS_FAILURE("no read access"); } + +inline BOOST_IOSTREAMS_FAILURE cant_write() +{ return BOOST_IOSTREAMS_FAILURE("no write access"); } + +inline BOOST_IOSTREAMS_FAILURE cant_seek() +{ return BOOST_IOSTREAMS_FAILURE("no random access"); } + +inline BOOST_IOSTREAMS_FAILURE bad_read() +{ return BOOST_IOSTREAMS_FAILURE("bad read"); } + +inline BOOST_IOSTREAMS_FAILURE bad_putback() +{ return BOOST_IOSTREAMS_FAILURE("putback buffer full"); } + +inline BOOST_IOSTREAMS_FAILURE bad_write() +{ return BOOST_IOSTREAMS_FAILURE("bad write"); } + +inline BOOST_IOSTREAMS_FAILURE write_area_exhausted() +{ return BOOST_IOSTREAMS_FAILURE("write area exhausted"); } + +inline BOOST_IOSTREAMS_FAILURE bad_seek() +{ return BOOST_IOSTREAMS_FAILURE("bad seek"); } + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_ERROR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/execute.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/execute.hpp new file mode 100644 index 0000000000..14d1a48f80 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/execute.hpp @@ -0,0 +1,135 @@ +/* + * 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/iostreams for documentation. + + * File: boost/iostreams/detail/execute.hpp + * Date: Thu Dec 06 13:21:54 MST 2007 + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + + * Defines the overloaded function template + * boost::iostreams::detail::execute_all() and the function template + * boost::iostreams::detail::execute_foreach(). + * + * execute_all() invokes a primary operation and performs a sequence of cleanup + * operations, returning the result of the primary operation if no exceptions + * are thrown. If one of the operations throws an exception, performs the + * remaining operations and rethrows the initial exception. + * + * execute_foreach() is a variant of std::foreach which invokes a function + * object for each item in a sequence, catching all execptions and rethrowing + * the first caught exception after the function object has been invoked on each + * item. + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_EXECUTE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_EXECUTE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include // MAX_EXECUTE_ARITY +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +// Helper for class template execute_traits. +template +struct execute_traits_impl { + typedef Result result_type; + template + static Result execute(Op op) { return op(); } +}; + +// Specialization for void return. For simplicity, execute() returns int +// for operations returning void. This could be avoided with additional work. +template<> +struct execute_traits_impl { + typedef int result_type; + template + static int execute(Op op) { op(); return 0; } +}; + +// Deduces the result type of Op and allows uniform treatment of operations +// returning void and non-void. +template< typename Op, + typename Result = // VC6.5 workaround. + #if !defined(BOOST_NO_RESULT_OF) && \ + !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + typename boost::result_of::type + #else + BOOST_DEDUCED_TYPENAME Op::result_type + #endif + > +struct execute_traits + : execute_traits_impl + { }; + +// Implementation with no cleanup operations. +template +typename execute_traits::result_type +execute_all(Op op) +{ + return execute_traits::execute(op); +} + +// Implementation with one or more cleanup operations +#define BOOST_PP_LOCAL_MACRO(n) \ + template \ + typename execute_traits::result_type \ + execute_all(Op op, BOOST_PP_ENUM_BINARY_PARAMS(n, C, c)) \ + { \ + typename execute_traits::result_type r; \ + try { \ + r = boost::iostreams::detail::execute_all( \ + op BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(n), c) \ + ); \ + } catch (...) { \ + try { \ + BOOST_PP_CAT(c, BOOST_PP_DEC(n))(); \ + } catch (...) { } \ + throw; \ + } \ + BOOST_PP_CAT(c, BOOST_PP_DEC(n))(); \ + return r; \ + } \ + /**/ + +#define BOOST_PP_LOCAL_LIMITS (1, BOOST_IOSTREAMS_MAX_EXECUTE_ARITY) +#include BOOST_PP_LOCAL_ITERATE() +#undef BOOST_PP_LOCAL_MACRO + +template +Op execute_foreach(InIt first, InIt last, Op op) +{ + if (first == last) + return op; + try { + op(*first); + } catch (...) { + try { + ++first; + boost::iostreams::detail::execute_foreach(first, last, op); + } catch (...) { } + throw; + } + ++first; + return boost::iostreams::detail::execute_foreach(first, last, op); +} + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_EXECUTE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/forward.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/forward.hpp new file mode 100644 index 0000000000..527d4e7a3f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/forward.hpp @@ -0,0 +1,102 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_FORWARD_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_FORWARD_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//------Macros for defining forwarding constructors and open overloads--------// + +// +// Macro: BOOST_IOSTREAMS_DEFINE_FORWARDING_FUNCTIONS(mode, name, helper). +// Description: Defines constructors and overloads of 'open' which construct +// a device using the given argument list and pass it to 'open_impl'. +// Assumes that 'policy_type' is an alias for the device type. +// Not supported on Intel 7.1 and VC6.5. +// +#define BOOST_IOSTREAMS_FORWARD(class, impl, policy, params, args) \ + class(const policy& t params()) \ + { this->impl(::boost::iostreams::detail::wrap(t) args()); } \ + class(policy& t params()) \ + { this->impl(::boost::iostreams::detail::wrap(t) args()); } \ + class(const ::boost::reference_wrapper& ref params()) \ + { this->impl(ref args()); } \ + void open(const policy& t params()) \ + { this->impl(::boost::iostreams::detail::wrap(t) args()); } \ + void open(policy& t params()) \ + { this->impl(::boost::iostreams::detail::wrap(t) args()); } \ + void open(const ::boost::reference_wrapper& ref params()) \ + { this->impl(ref args()); } \ + BOOST_PP_REPEAT_FROM_TO( \ + 1, BOOST_PP_INC(BOOST_IOSTREAMS_MAX_FORWARDING_ARITY), \ + BOOST_IOSTREAMS_FORWARDING_CTOR, (class, impl, policy) \ + ) \ + BOOST_PP_REPEAT_FROM_TO( \ + 1, BOOST_PP_INC(BOOST_IOSTREAMS_MAX_FORWARDING_ARITY), \ + BOOST_IOSTREAMS_FORWARDING_FN, (class, impl, policy) \ + ) \ + /**/ +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) +# define BOOST_IOSTREAMS_FORWARDING_CTOR_I(z, n, tuple) \ + template< typename U100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), typename U) > \ + BOOST_PP_TUPLE_ELEM(3, 0, tuple) \ + ( U100& u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_PP_ENUM_BINARY_PARAMS_Z(z, BOOST_PP_DEC(n), const U, &u)) \ + { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \ + ( BOOST_PP_TUPLE_ELEM(3, 2, tuple) \ + ( u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), u)) ); } \ + /**/ +# define BOOST_IOSTREAMS_FORWARDING_FN_I(z, n, tuple) \ + template< typename U100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), typename U) > \ + void open \ + ( U100& u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_PP_ENUM_BINARY_PARAMS_Z(z, BOOST_PP_DEC(n), const U, &u)) \ + { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \ + ( u100 BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), u) ); } \ + /**/ +#else +# define BOOST_IOSTREAMS_FORWARDING_CTOR_I(z, n, tuple) +# define BOOST_IOSTREAMS_FORWARDING_FN_I(z, n, tuple) +#endif +#define BOOST_IOSTREAMS_FORWARDING_CTOR(z, n, tuple) \ + template \ + BOOST_PP_TUPLE_ELEM(3, 0, tuple) \ + (BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, const U, &u)) \ + { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \ + ( BOOST_PP_TUPLE_ELEM(3, 2, tuple) \ + (BOOST_PP_ENUM_PARAMS_Z(z, n, u)) ); } \ + BOOST_IOSTREAMS_FORWARDING_CTOR_I(z, n, tuple) \ + /**/ +#define BOOST_IOSTREAMS_FORWARDING_FN(z, n, tuple) \ + template \ + void open(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, const U, &u)) \ + { this->BOOST_PP_TUPLE_ELEM(3, 1, tuple) \ + ( BOOST_PP_TUPLE_ELEM(3, 2, tuple) \ + (BOOST_PP_ENUM_PARAMS_Z(z, n, u)) ); } \ + BOOST_IOSTREAMS_FORWARDING_FN_I(z, n, tuple) \ + /**/ + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_FORWARD_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/fstream.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/fstream.hpp new file mode 100644 index 0000000000..b8070a7291 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/fstream.hpp @@ -0,0 +1,33 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_FSTREAM_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_FSTREAM_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# include +#else +# include +#endif + +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# define BOOST_IOSTREAMS_BASIC_IFSTREAM(Ch, Tr) std::basic_ifstream +# define BOOST_IOSTREAMS_BASIC_OFSTREAM(Ch, Tr) std::basic_ofstream +# define BOOST_IOSTREAMS_BASIC_FSTREAM(Ch, Tr) std::basic_fstream +# define BOOST_IOSTREAMS_BASIC_FILEBUF(Ch) std::basic_filebuf +#else +# define BOOST_IOSTREAMS_BASIC_IFSTREAM(Ch, Tr) std::ifstream +# define BOOST_IOSTREAMS_BASIC_OFSTREAM(Ch, Tr) std::ofstream +# define BOOST_IOSTREAMS_BASIC_FILEBUF(Ch) std::filebuf +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_FSTREAM_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/functional.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/functional.hpp new file mode 100644 index 0000000000..a7b9b6bbb1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/functional.hpp @@ -0,0 +1,189 @@ +/* + * 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/iostreams for documentation. + + * File: boost/iostreams/detail/functional.hpp + * Date: Sun Dec 09 05:38:03 MST 2007 + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + + * Defines several function objects and object generators for use with + * execute_all() + */ + +#ifndef BOOST_IOSTREAMS_DETAIL_FUNCTIONAL_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_FUNCTIONAL_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // BOOST_IOS + +namespace boost { namespace iostreams { namespace detail { + + // Function objects and object generators for invoking + // boost::iostreams::close + +template +class device_close_operation { +public: + typedef void result_type; + device_close_operation(T& t, BOOST_IOS::openmode which) + : t_(t), which_(which) + { } + void operator()() const { boost::iostreams::close(t_, which_); } +private: + device_close_operation& operator=(const device_close_operation&); + T& t_; + BOOST_IOS::openmode which_; +}; + +template +class filter_close_operation { +public: + typedef void result_type; + filter_close_operation(T& t, Sink& snk, BOOST_IOS::openmode which) + : t_(t), snk_(snk), which_(which) + { } + void operator()() const { boost::iostreams::close(t_, snk_, which_); } +private: + filter_close_operation& operator=(const filter_close_operation&); + T& t_; + Sink& snk_; + BOOST_IOS::openmode which_; +}; + +template +device_close_operation +call_close(T& t, BOOST_IOS::openmode which) +{ return device_close_operation(t, which); } + +template +filter_close_operation +call_close(T& t, Sink& snk, BOOST_IOS::openmode which) +{ return filter_close_operation(t, snk, which); } + + // Function objects and object generators for invoking + // boost::iostreams::detail::close_all + +template +class device_close_all_operation { +public: + typedef void result_type; + device_close_all_operation(T& t) : t_(t) { } + void operator()() const { detail::close_all(t_); } +private: + device_close_all_operation& operator=(const device_close_all_operation&); + T& t_; +}; + +template +class filter_close_all_operation { +public: + typedef void result_type; + filter_close_all_operation(T& t, Sink& snk) : t_(t), snk_(snk) { } + void operator()() const { detail::close_all(t_, snk_); } +private: + filter_close_all_operation& operator=(const filter_close_all_operation&); + T& t_; + Sink& snk_; +}; + +template +device_close_all_operation call_close_all(T& t) +{ return device_close_all_operation(t); } + +template +filter_close_all_operation +call_close_all(T& t, Sink& snk) +{ return filter_close_all_operation(t, snk); } + + // Function object and object generator for invoking a + // member function void close(std::ios_base::openmode) + +template +class member_close_operation { +public: + typedef void result_type; + member_close_operation(T& t, BOOST_IOS::openmode which) + : t_(t), which_(which) + { } + void operator()() const { t_.close(which_); } +private: + member_close_operation& operator=(const member_close_operation&); + T& t_; + BOOST_IOS::openmode which_; +}; + +template +member_close_operation call_member_close(T& t, BOOST_IOS::openmode which) +{ return member_close_operation(t, which); } + + // Function object and object generator for invoking a + // member function void reset() + +template +class reset_operation { +public: + reset_operation(T& t) : t_(t) { } + void operator()() const { t_.reset(); } +private: + reset_operation& operator=(const reset_operation&); + T& t_; +}; + +template +reset_operation call_reset(T& t) { return reset_operation(t); } + + // Function object and object generator for clearing a flag + +template +class clear_flags_operation { +public: + typedef void result_type; + clear_flags_operation(T& t) : t_(t) { } + void operator()() const { t_ = 0; } +private: + clear_flags_operation& operator=(const clear_flags_operation&); + T& t_; +}; + +template +clear_flags_operation clear_flags(T& t) +{ return clear_flags_operation(t); } + + // Function object and generator for flushing a buffer + +// Function object for use with execute_all() +template +class flush_buffer_operation { +public: + typedef void result_type; + flush_buffer_operation(Buffer& buf, Device& dev, bool flush) + : buf_(buf), dev_(dev), flush_(flush) + { } + void operator()() const + { + if (flush_) + buf_.flush(dev_); + } +private: + flush_buffer_operation& operator=(const flush_buffer_operation&); + Buffer& buf_; + Device& dev_; + bool flush_; +}; + +template +flush_buffer_operation +flush_buffer(Buffer& buf, Device& dev, bool flush) +{ return flush_buffer_operation(buf, dev, flush); } + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_FUNCTIONAL_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/ios.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/ios.hpp new file mode 100644 index 0000000000..4d34f8fdb0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/ios.hpp @@ -0,0 +1,66 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_IOS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_IOS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC. +#include +#include +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# if !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) +# include +# else +# include +# include +# endif +#else +# include +# include +#endif + +namespace boost { namespace iostreams { namespace detail { + +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------------------// +# define BOOST_IOSTREAMS_BASIC_IOS(ch, tr) std::basic_ios< ch, tr > +# if !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) && \ + !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ + !BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ + /**/ + +#define BOOST_IOS std::ios +#define BOOST_IOSTREAMS_FAILURE std::ios::failure + +# else + +#define BOOST_IOS std::ios_base +#define BOOST_IOSTREAMS_FAILURE std::ios_base::failure + +# endif +#else // #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-----------------------// + +#define BOOST_IOS std::ios +#define BOOST_IOSTREAMS_BASIC_IOS(ch, tr) std::ios +#define BOOST_IOSTREAMS_FAILURE boost::iostreams::detail::failure + +class failure : std::exception { +public: + explicit failure(const std::string& what_arg) : what_(what_arg) { } + const char* what() const { return what_.c_str(); } +private: + std::string what_; +}; + +#endif // #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //----------------------// + +} } } // End namespace failure, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_IOS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/iostream.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/iostream.hpp new file mode 100644 index 0000000000..45692b35a0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/iostream.hpp @@ -0,0 +1,34 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_IOSTREAM_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_IOSTREAM_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# include +# include +#else +# include +#endif + +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# define BOOST_IOSTREAMS_BASIC_ISTREAM(ch, tr) std::basic_istream< ch, tr > +# define BOOST_IOSTREAMS_BASIC_OSTREAM(ch, tr) std::basic_ostream< ch, tr > +# define BOOST_IOSTREAMS_BASIC_IOSTREAM(ch, tr) std::basic_iostream< ch, tr > +#else +# define BOOST_IOSTREAMS_BASIC_STREAMBUF(ch, tr) std::streambuf +# define BOOST_IOSTREAMS_BASIC_ISTREAM(ch, tr) std::istream +# define BOOST_IOSTREAMS_BASIC_OSTREAM(ch, tr) std::ostream +# define BOOST_IOSTREAMS_BASIC_IOSTREAM(ch, tr) std::iostream +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_IOSTREAM_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/is_dereferenceable.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/is_dereferenceable.hpp new file mode 100644 index 0000000000..62cf429f5d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/is_dereferenceable.hpp @@ -0,0 +1,85 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// (C) Copyright David Abrahams 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_IS_DEREFERENCEABLE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_IS_DEREFERENCEABLE_HPP_INCLUDED + +# include +# include +# include +# include +# include +# include + +namespace boost { namespace iostreams { namespace detail { + +// is_dereferenceable metafunction +// +// Requires: Given x of type T&, if the expression *x is well-formed +// it must have complete type; otherwise, it must neither be ambiguous +// nor violate access. + +// This namespace ensures that ADL doesn't mess things up. +namespace is_dereferenceable_ +{ + // a type returned from operator* when no increment is found in the + // type's own namespace + struct tag {}; + + // any soaks up implicit conversions and makes the following + // operator* less-preferred than any other such operator that + // might be found via ADL. + struct any { template any(T const&); }; + + // This is a last-resort operator* for when none other is found + tag operator*(any const&); + +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ + || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# define BOOST_comma(a,b) (a) +# else + // In case an operator++ is found that returns void, we'll use ++x,0 + tag operator,(tag,int); +# define BOOST_comma(a,b) (a,b) +# endif + + // two check overloads help us identify which operator++ was picked + char (& check(tag) )[2]; + + template + char check(T const&); + + template + struct impl + { + static typename boost::remove_cv::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_dereferenceable_::check(BOOST_comma(*x,0))) == 1 + ); + }; +} + +# undef BOOST_comma + +template +struct is_dereferenceable + BOOST_TT_AUX_BOOL_C_BASE(is_dereferenceable_::impl::value) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(is_dereferenceable_::impl::value) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_dereferenceable,(T)) +}; + +} } + +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::iostreams::detail::is_dereferenceable) + +} // End namespaces detail, iostreams, boost. + +#endif // BOOST_IOSTREAMS_DETAIL_IS_DEREFERENCEABLE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/is_iterator_range.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/is_iterator_range.hpp new file mode 100644 index 0000000000..b2c3e94584 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/is_iterator_range.hpp @@ -0,0 +1,42 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_IS_ITERATOR_RANGE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_IS_ITERATOR_RANGE_HPP_INCLUDED + +#include + +namespace boost { + +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------// + +// We avoid dependence on Boost.Range by using a forward declaration. +template +class iterator_range; + +namespace iostreams { + +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_iterator_range, boost::iterator_range, 1) + +} // End namespace iostreams. + +# else // # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //-----------------------// + +namespace iostreams { + + template + struct is_iterator_range { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + +} // End namespace iostreams. + +# endif // # if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) //----------------------// + +} // End namespace boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_IS_ITERATOR_RANGE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/newline.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/newline.hpp new file mode 100644 index 0000000000..41b5b5268d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/newline.hpp @@ -0,0 +1,32 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_NEWLINE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_NEWLINE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +namespace boost { namespace iostreams { namespace detail { + +template +struct newline; + +template<> +struct newline { + BOOST_STATIC_CONSTANT(char, value = '\n'); +}; + +template<> +struct newline { + BOOST_STATIC_CONSTANT(wchar_t, value = L'\n'); +}; + +} } } // End namespaces detaill, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_NEWLINE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/optional.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/optional.hpp new file mode 100644 index 0000000000..ee9ac3f3ea --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/optional.hpp @@ -0,0 +1,114 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Recent changes to Boost.Optional involving assigment broke Boost.Iostreams, +// in a way which could be remedied only by relying on the deprecated reset +// functions; with VC6, even reset didn't work. Until this problem is +// understood, Iostreams will use a private version of optional with a smart +// pointer interface. + +#ifndef BOOST_IOSTREAMS_DETAIL_OPTIONAL_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_OPTIONAL_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +// Taken from . +template +class aligned_storage +{ + // Borland ICEs if unnamed unions are used for this! + union dummy_u + { + char data[ sizeof(T) ]; + BOOST_DEDUCED_TYPENAME type_with_alignment< + ::boost::alignment_of::value >::type aligner_; + } dummy_ ; + + public: + + void const* address() const { return &dummy_.data[0]; } + void * address() { return &dummy_.data[0]; } +}; + +template +class optional { +public: + typedef T element_type; + optional() : initialized_(false) { } + optional(const T& t) : initialized_(false) { reset(t); } + ~optional() { reset(); } + T& operator*() + { + assert(initialized_); + return *static_cast(address()); + } + const T& operator*() const + { + assert(initialized_); + return *static_cast(address()); + } + T* operator->() + { + assert(initialized_); + return static_cast(address()); + } + const T* operator->() const + { + assert(initialized_); + return static_cast(address()); + } + T* get() + { + assert(initialized_); + return static_cast(address()); + } + const T* get() const + { + assert(initialized_); + return static_cast(address()); + } + void reset() + { + if (initialized_) { + #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || \ + BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ + /**/ + T* t = static_cast(address()); + t->~T(); + #else + static_cast(address())->T::~T(); + #endif + initialized_ = false; + } + } + void reset(const T& t) + { + reset(); + new (address()) T(t); + initialized_ = true; + } +private: + optional(const optional&); + optional& operator=(const optional&); + void* address() { return &storage_; } + const void* address() const { return &storage_; } + aligned_storage storage_; + bool initialized_; +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_OPTIONAL_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/param_type.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/param_type.hpp new file mode 100644 index 0000000000..c10f1d8bb2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/param_type.hpp @@ -0,0 +1,27 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_PARAM_TYPE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_PARAM_TYPE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +struct param_type { + typedef typename mpl::if_, T&, const T&>::type type; +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_PARAM_TYPE_HPP_INCLUDED //-----------// diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/push.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/push.hpp new file mode 100644 index 0000000000..c1e7d9aa5e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/push.hpp @@ -0,0 +1,154 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_PUSH_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_PUSH_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Macro: BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name, mode, ch, helper). +// Description: Defines overloads with name 'name' which forward to a function +// 'helper' which takes a filter or devide by const reference. +// +#define BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name, mode, ch, helper) \ + BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, 0, ?) \ + /**/ + +// +// Macro: BOOST_IOSTREAMS_DEFINE_PUSH(name, mode, ch, helper). +// Description: Defines constructors which forward to a function +// 'helper' which takes a filter or device by const reference. +// +#define BOOST_IOSTREAMS_DEFINE_PUSH(name, mode, ch, helper) \ + BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, 1, void) \ + /**/ + +//--------------------Definition of BOOST_IOSTREAMS_DEFINE_PUSH_IMPL----------// + +#define BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, arg, helper, has_return) \ + this->helper( ::boost::iostreams::detail::resolve(arg) \ + BOOST_IOSTREAMS_PUSH_ARGS() ); \ + /**/ + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ + !BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + /**/ +# ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# define BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, has_return, result) \ + template \ + BOOST_PP_IIF(has_return, result, explicit) \ + name(::std::basic_streambuf& sb BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, sb, helper, has_return); } \ + template \ + BOOST_PP_IIF(has_return, result, explicit) \ + name(::std::basic_istream& is BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_STATIC_ASSERT((!is_convertible::value)); \ + BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, is, helper, has_return); } \ + template \ + BOOST_PP_IIF(has_return, result, explicit) \ + name(::std::basic_ostream& os BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_STATIC_ASSERT((!is_convertible::value)); \ + BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, os, helper, has_return); } \ + template \ + BOOST_PP_IIF(has_return, result, explicit) \ + name(::std::basic_iostream& io BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, io, helper, has_return); } \ + template \ + BOOST_PP_IIF(has_return, result, explicit) \ + name(const iterator_range& rng BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_PP_EXPR_IF(has_return, return) \ + this->helper( ::boost::iostreams::detail::range_adapter< \ + mode, iterator_range \ + >(rng) \ + BOOST_IOSTREAMS_PUSH_ARGS() ); } \ + template \ + BOOST_PP_IIF(has_return, result, explicit) \ + name(const ::boost::iostreams::pipeline& p) \ + { p.push(*this); } \ + template \ + BOOST_PP_IIF(has_return, result, explicit) \ + name(const T& t BOOST_IOSTREAMS_PUSH_PARAMS() BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)) \ + { this->helper( ::boost::iostreams::detail::resolve(t) \ + BOOST_IOSTREAMS_PUSH_ARGS() ); } \ + /**/ +# else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# define BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, has_return, result) \ + BOOST_PP_IF(has_return, result, explicit) \ + name(::std::streambuf& sb BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, sb, helper, has_return); } \ + BOOST_PP_IF(has_return, result, explicit) \ + name(::std::istream& is BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_STATIC_ASSERT((!is_convertible::value)); \ + BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, is, helper, has_return); } \ + BOOST_PP_IF(has_return, result, explicit) \ + name(::std::ostream& os BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_STATIC_ASSERT((!is_convertible::value)); \ + BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, os, helper, has_return); } \ + BOOST_PP_IF(has_return, result, explicit) \ + name(::std::iostream& io BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_IOSTREAMS_ADAPT_STREAM(mode, ch, io, helper, has_return); } \ + template \ + BOOST_PP_IF(has_return, result, explicit) \ + name(const iterator_range& rng BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { BOOST_PP_EXPR_IF(has_return, return) \ + this->helper( ::boost::iostreams::detail::range_adapter< \ + mode, iterator_range \ + >(rng) \ + BOOST_IOSTREAMS_PUSH_ARGS() ); } \ + template \ + BOOST_PP_IF(has_return, result, explicit) \ + name(const ::boost::iostreams::pipeline& p) \ + { p.push(*this); } \ + template \ + BOOST_PP_EXPR_IF(has_return, result) \ + name(const T& t BOOST_IOSTREAMS_PUSH_PARAMS() BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)) \ + { this->helper( ::boost::iostreams::detail::resolve(t) \ + BOOST_IOSTREAMS_PUSH_ARGS() ); } \ + /**/ +# endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +#else // #if VC6, VC7.0, Borland 5.x +# define BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, has_return, result) \ + template \ + void BOOST_PP_CAT(name, _msvc_impl) \ + ( ::boost::mpl::true_, const T& t BOOST_IOSTREAMS_PUSH_PARAMS() ) \ + { t.push(*this); } \ + template \ + void BOOST_PP_CAT(name, _msvc_impl) \ + ( ::boost::mpl::false_, const T& t BOOST_IOSTREAMS_PUSH_PARAMS() ) \ + { this->helper( ::boost::iostreams::detail::resolve(t) \ + BOOST_IOSTREAMS_PUSH_ARGS() ); } \ + template \ + BOOST_PP_IF(has_return, result, explicit) \ + name(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { \ + this->BOOST_PP_CAT(name, _msvc_impl) \ + ( ::boost::iostreams::detail::is_pipeline(), \ + t BOOST_IOSTREAMS_PUSH_ARGS() ); \ + } \ + /**/ +#endif // #if VC6, VC7.0, Borland 5.x + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_PUSH_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/push_params.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/push_params.hpp new file mode 100644 index 0000000000..736d5b8360 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/push_params.hpp @@ -0,0 +1,21 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_PUSH_PARAMS_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_PUSH_PARAMS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#define BOOST_IOSTREAMS_PUSH_PARAMS() \ + , int buffer_size = -1 , int pback_size = -1 \ + /**/ + +#define BOOST_IOSTREAMS_PUSH_ARGS() , buffer_size, pback_size + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_PUSH_PARAMS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/resolve.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/resolve.hpp new file mode 100644 index 0000000000..2d540e81ea --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/resolve.hpp @@ -0,0 +1,234 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_RESOLVE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_RESOLVE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // partial spec, put size_t in std. +#include // std::size_t. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // true_. +#include +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# include +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +#include + +// Must come last. +#include // VC7.1 C4224. + +namespace boost { namespace iostreams { namespace detail { + +//------------------Definition of resolve-------------------------------------// + +#ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //-------------------------// + +template +struct resolve_traits { + typedef typename + mpl::if_< + boost::detail::is_incrementable, + output_iterator_adapter, + const T& + >::type type; +}; + +# ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------------------// + +template +typename resolve_traits::type +resolve( const T& t + BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) + + // I suspect that the compilers which require this workaround may + // be correct, but I'm not sure why :( + #if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, BOOST_TESTED_AT(810)) ||\ + BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) || \ + BOOST_WORKAROUND(BOOST_IOSTREAMS_GCC, BOOST_TESTED_AT(400)) \ + /**/ + , typename disable_if< is_iterator_range >::type* = 0 + #endif + ) +{ + typedef typename resolve_traits::type return_type; + return return_type(t); +} + +template +mode_adapter< Mode, std::basic_streambuf > +resolve(std::basic_streambuf& sb) +{ return mode_adapter< Mode, std::basic_streambuf >(wrap(sb)); } + +template +mode_adapter< Mode, std::basic_istream > +resolve(std::basic_istream& is) +{ return mode_adapter< Mode, std::basic_istream >(wrap(is)); } + +template +mode_adapter< Mode, std::basic_ostream > +resolve(std::basic_ostream& os) +{ return mode_adapter< Mode, std::basic_ostream >(wrap(os)); } + +template +mode_adapter< Mode, std::basic_iostream > +resolve(std::basic_iostream& io) +{ return mode_adapter< Mode, std::basic_iostream >(wrap(io)); } + +template +array_adapter resolve(Ch (&array)[N]) +{ return array_adapter(array); } + +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + template + range_adapter< Mode, boost::iterator_range > + resolve(const boost::iterator_range& rng) + { return range_adapter< Mode, boost::iterator_range >(rng); } +# endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + +# else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //---------------------// + +template +typename resolve_traits::type +resolve( const T& t + BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) + #if defined(__GNUC__) + , typename disable_if< is_iterator_range >::type* = 0 + #endif + ) +{ + typedef typename resolve_traits::type return_type; + return return_type(t); +} + +template +mode_adapter +resolve(std::streambuf& sb) +{ return mode_adapter(wrap(sb)); } + +template +mode_adapter +resolve(std::istream& is) +{ return mode_adapter(wrap(is)); } + +template +mode_adapter +resolve(std::ostream& os) +{ return mode_adapter(wrap(os)); } + +template +mode_adapter +resolve(std::iostream& io) +{ return mode_adapter(wrap(io)); } + +template +array_adapter resolve(Ch (&array)[N]) +{ return array_adapter(array); } + +template +range_adapter< Mode, boost::iterator_range > +resolve(const boost::iterator_range& rng) +{ return range_adapter< Mode, boost::iterator_range >(rng); } + +# endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------// +#else // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //----------------// + +template +struct resolve_traits { + // Note: test for is_iterator_range must come before test for output + // iterator. + typedef typename + iostreams::select< // Disambiguation for Tru64. + is_std_io, + mode_adapter, + is_iterator_range, + range_adapter, + is_dereferenceable, + output_iterator_adapter, + is_array, + array_adapter, + else_, + #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) + const T& + #else + T + #endif + >::type type; +}; + +template +typename resolve_traits::type +resolve(const T& t, mpl::true_) +{ // Bad overload resolution. + typedef typename resolve_traits::type return_type; + return return_type(wrap(const_cast(t))); +} + +template +typename resolve_traits::type +resolve(const T& t, mpl::false_) +{ + typedef typename resolve_traits::type return_type; + return return_type(t); +} + +template +typename resolve_traits::type +resolve(const T& t BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)) +{ return resolve(t, is_std_io()); } + +# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ + !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ + !defined(__GNUC__) // ---------------------------------------------------// + +template +typename resolve_traits::type +resolve(T& t, mpl::true_) +{ + typedef typename resolve_traits::type return_type; + return return_type(wrap(t)); +} + +template +typename resolve_traits::type +resolve(T& t, mpl::false_) +{ + typedef typename resolve_traits::type return_type; + return return_type(t); +} + +template +typename resolve_traits::type +resolve(T& t BOOST_IOSTREAMS_ENABLE_IF_STREAM(T)) +{ return resolve(t, is_std_io()); } + +# endif // Borland 5.x, VC6-7.0 or GCC 2.9x //--------------------------------// +#endif // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //---------------// + +} } } // End namespaces detail, iostreams, boost. + +#include // VC7.1 4224. + +#endif // BOOST_IOSTREAMS_DETAIL_RESOLVE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/restrict_impl.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/restrict_impl.hpp new file mode 100644 index 0000000000..6e4662496c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/restrict_impl.hpp @@ -0,0 +1,474 @@ +/* + * 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/iostreams for documentation. + + * File: boost/iostreams/detail/restrict_impl.hpp + * Date: Sun Jan 06 12:57:30 MST 2008 + * Copyright: 2007-2008 CodeRage, LLC + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * If included with the macro BOOST_IOSTREAMS_RESTRICT undefined, defines the + * class template boost::iostreams::restriction. If included with the macro + * BOOST_IOSTREAMS_RESTRICT defined as an identifier, defines the overloaded + * function template boost::iostreams::BOOST_IOSTREAMS_RESTRICT, and object + * generator for boost::iostreams::restriction. + * + * This design allows and + * to share an implementation. + */ + +#if !defined(BOOST_IOSTREAMS_RESTRICT_IMPL_HPP_INCLUDED) && \ + !defined(BOOST_IOSTREAMS_RESTRICT) +# define BOOST_IOSTREAMS_RESTRICT_IMPL_HPP_INCLUDED + +//------------------Implementation of restriction-----------------------------// + +# include // min. +# include // pair. +# include // intmax_t. +# include // DEDUCED_TYPENAME. +# include +# include +# include +# include +# include +# include +# include +# include // failure. +# include +# include +# include +# include // mode_of, is_direct. +# include +# include +# include + +# include + +namespace boost { namespace iostreams { + +namespace detail { + +// +// Template name: restricted_indirect_device. +// Description: Provides an restricted view of an indirect Device. +// Template paramters: +// Device - An indirect model of Device that models either Source or +// SeekableDevice. +// +template +class restricted_indirect_device : public device_adapter { +private: + typedef typename detail::param_type::type param_type; +public: + typedef typename char_type_of::type char_type; + typedef typename mode_of::type mode; + BOOST_STATIC_ASSERT(!(is_convertible::value)); + struct category + : mode, + device_tag, + closable_tag, + flushable_tag, + localizable_tag, + optimally_buffered_tag + { }; + restricted_indirect_device( param_type dev, stream_offset off, + stream_offset len = -1 ); + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); +private: + stream_offset beg_, pos_, end_; +}; + +// +// Template name: restricted_direct_device. +// Description: Provides an restricted view of a Direct Device. +// Template paramters: +// Device - A model of Direct and Device. +// +template +class restricted_direct_device : public device_adapter { +public: + typedef typename char_type_of::type char_type; + typedef std::pair pair_type; + typedef typename mode_of::type mode; + BOOST_STATIC_ASSERT(!(is_convertible::value)); + struct category + : mode_of::type, + device_tag, + direct_tag, + closable_tag, + localizable_tag + { }; + restricted_direct_device( const Device& dev, stream_offset off, + stream_offset len = -1 ); + pair_type input_sequence(); + pair_type output_sequence(); +private: + pair_type sequence(mpl::true_); + pair_type sequence(mpl::false_); + char_type *beg_, *end_; +}; + +// +// Template name: restricted_filter. +// Description: Provides an restricted view of a Filter. +// Template paramters: +// Filter - An indirect model of Filter. +// +template +class restricted_filter : public filter_adapter { +public: + typedef typename char_type_of::type char_type; + typedef typename mode_of::type mode; + BOOST_STATIC_ASSERT(!(is_convertible::value)); + struct category + : mode, + filter_tag, + multichar_tag, + closable_tag, + localizable_tag, + optimally_buffered_tag + { }; + restricted_filter( const Filter& flt, stream_offset off, + stream_offset len = -1 ); + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + using namespace std; + if (!open_) + open(src, BOOST_IOS::in); + std::streamsize amt = + end_ != -1 ? + (std::min) (n, static_cast(end_ - pos_)) : + n; + std::streamsize result = + iostreams::read(this->component(), src, s, amt); + if (result != -1) + pos_ += result; + return result; + } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { + if (!open_) + open(snk, BOOST_IOS::out); + if (end_ != -1 && pos_ + n >= end_) + bad_write(); + std::streamsize result = + iostreams::write(this->component(), snk, s, n); + pos_ += result; + return result; + } + + template + std::streampos seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) + { + stream_offset next; + if (way == BOOST_IOS::beg) { + next = beg_ + off; + } else if (way == BOOST_IOS::cur) { + next = pos_ + off; + } else if (end_ != -1) { + next = end_ + off; + } else { + // Restriction is half-open; seek relative to the actual end. + pos_ = this->component().seek(dev, off, BOOST_IOS::end); + if (pos_ < beg_) + bad_seek(); + return offset_to_position(pos_ - beg_); + } + if (next < beg_ || end_ != -1 && next >= end_) + bad_seek(); + pos_ = this->component().seek(dev, next, BOOST_IOS::cur); + return offset_to_position(pos_ - beg_); + } + + template + void close(Device& dev) + { + open_ = false; + detail::close_all(this->component(), dev); + } + + template + void close(Device& dev, BOOST_IOS::openmode which) + { + open_ = false; + iostreams::close(this->component(), dev, which); + } +private: + template + void open(Device& dev, BOOST_IOS::openmode which) + { + typedef typename is_convertible::type is_dual_use; + open_ = true; + which = is_dual_use() ? which : (BOOST_IOS::in | BOOST_IOS::out); + iostreams::skip(this->component(), dev, beg_, which); + } + + stream_offset beg_, pos_, end_; + bool open_; +}; + +template +struct restriction_traits + : iostreams::select< // Disambiguation for Tru64. + is_filter, restricted_filter, + is_direct, restricted_direct_device, + else_, restricted_indirect_device + > + { }; + +} // End namespace detail. + +template +struct restriction : public detail::restriction_traits::type { + typedef typename detail::param_type::type param_type; + typedef typename detail::restriction_traits::type base_type; + restriction(param_type t, stream_offset off, stream_offset len = -1) + : base_type(t, off, len) + { } +}; + +namespace detail { + +//--------------Implementation of restricted_indirect_device------------------// + +template +restricted_indirect_device::restricted_indirect_device + (param_type dev, stream_offset off, stream_offset len) + : device_adapter(dev), beg_(off), pos_(off), + end_(len != -1 ? off + len : -1) +{ + if (len < -1 || off < 0) + throw BOOST_IOSTREAMS_FAILURE("bad offset"); + iostreams::skip(this->component(), off); +} + +template +inline std::streamsize restricted_indirect_device::read + (char_type* s, std::streamsize n) +{ + using namespace std; + std::streamsize amt = + end_ != -1 ? + (std::min) (n, static_cast(end_ - pos_)) : + n; + std::streamsize result = iostreams::read(this->component(), s, amt); + if (result != -1) + pos_ += result; + return result; +} + +template +inline std::streamsize restricted_indirect_device::write + (const char_type* s, std::streamsize n) +{ + if (end_ != -1 && pos_ + n >= end_) + bad_write(); + std::streamsize result = iostreams::write(this->component(), s, n); + pos_ += result; + return result; +} + +template +std::streampos restricted_indirect_device::seek + (stream_offset off, BOOST_IOS::seekdir way) +{ + stream_offset next; + if (way == BOOST_IOS::beg) { + next = beg_ + off; + } else if (way == BOOST_IOS::cur) { + next = pos_ + off; + } else if (end_ != -1) { + next = end_ + off; + } else { + // Restriction is half-open; seek relative to the actual end. + pos_ = iostreams::seek(this->component(), off, BOOST_IOS::end); + if (pos_ < beg_) + bad_seek(); + return offset_to_position(pos_ - beg_); + } + if (next < beg_ || end_ != -1 && next >= end_) + bad_seek(); + pos_ = iostreams::seek(this->component(), next - pos_, BOOST_IOS::cur); + return offset_to_position(pos_ - beg_); +} + +//--------------Implementation of restricted_direct_device--------------------// + +template +restricted_direct_device::restricted_direct_device + (const Device& dev, stream_offset off, stream_offset len) + : device_adapter(dev), beg_(0), end_(0) +{ + std::pair seq = + sequence(is_convertible()); + if ( off < 0 || len < -1 || + len != -1 && off + len > seq.second - seq.first ) + { + throw BOOST_IOSTREAMS_FAILURE("bad offset"); + } + beg_ = seq.first + off; + end_ = len != -1 ? + seq.first + off + len : + seq.second; +} + +template +typename restricted_direct_device::pair_type +restricted_direct_device::input_sequence() +{ + BOOST_STATIC_ASSERT((is_convertible::value)); + return std::make_pair(beg_, end_); +} + +template +typename restricted_direct_device::pair_type +restricted_direct_device::output_sequence() +{ + BOOST_STATIC_ASSERT((is_convertible::value)); + return std::make_pair(beg_, end_); +} + +template +typename restricted_direct_device::pair_type +restricted_direct_device::sequence(mpl::true_) +{ return iostreams::input_sequence(this->component()); } + +template +typename restricted_direct_device::pair_type +restricted_direct_device::sequence(mpl::false_) +{ return iostreams::output_sequence(this->component()); } + +//--------------Implementation of restricted_filter---------------------------// + +template +restricted_filter::restricted_filter + (const Filter& flt, stream_offset off, stream_offset len) + : filter_adapter(flt), beg_(off), + pos_(off), end_(len != -1 ? off + len : -1), open_(false) +{ + if (len < -1 || off < 0) + throw BOOST_IOSTREAMS_FAILURE("bad offset"); +} + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#elif defined(BOOST_IOSTREAMS_RESTRICT) + +namespace boost { namespace iostreams { + +//--------------Implementation of restrict/slice------------------------------// + +// Note: The following workarounds are patterned after resolve.hpp. It has not +// yet been confirmed that they are necessary. + +# ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //------------------------// +# ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //------------------------------// + +template +restriction +BOOST_IOSTREAMS_RESTRICT( const T& t, stream_offset off, stream_offset len = -1 + BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) ) +{ return restriction(t, off, len); } + +template +restriction< std::basic_streambuf > +BOOST_IOSTREAMS_RESTRICT( std::basic_streambuf& sb, stream_offset off, + stream_offset len = -1 ) +{ return restriction< std::basic_streambuf >(sb, off, len); } + +template +restriction< std::basic_istream > +BOOST_IOSTREAMS_RESTRICT + (std::basic_istream& is, stream_offset off, stream_offset len = -1) +{ return restriction< std::basic_istream >(is, off, len); } + +template +restriction< std::basic_ostream > +BOOST_IOSTREAMS_RESTRICT + (std::basic_ostream& os, stream_offset off, stream_offset len = -1) +{ return restriction< std::basic_ostream >(os, off, len); } + +template +restriction< std::basic_iostream > +BOOST_IOSTREAMS_RESTRICT + (std::basic_iostream& io, stream_offset off, stream_offset len = -1) +{ return restriction< std::basic_iostream >(io, off, len); } + +# else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------// + +template +restriction +BOOST_IOSTREAMS_RESTRICT( const T& t, stream_offset off, stream_offset len = -1 + BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) ) +{ return restriction(t, off, len); } + +restriction +BOOST_IOSTREAMS_RESTRICT + (std::streambuf& sb, stream_offset off, stream_offset len = -1) +{ return restriction(sb, off, len); } + +restriction +BOOST_IOSTREAMS_RESTRICT + (std::istream& is, stream_offset off, stream_offset len = -1) +{ return restriction(is, off, len); } + +restriction +BOOST_IOSTREAMS_RESTRICT + (std::ostream& os, stream_offset off, stream_offset len = -1) +{ return restriction(os, off, len); } + +restriction +BOOST_IOSTREAMS_RESTRICT + (std::iostream& io, stream_offset off, stream_offset len = -1) +{ return restriction(io, off, len); } + +# endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------// +# else // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //---------------// + +template +restriction +BOOST_IOSTREAMS_RESTRICT + (const T& t, stream_offset off, stream_offset len, mpl::true_) +{ // Bad overload resolution. + return restriction(const_cast(t, off, len)); +} + +template +restriction +BOOST_IOSTREAMS_RESTRICT + (const T& t, stream_offset off, stream_offset len, mpl::false_) +{ return restriction(t, off, len); } + +template +restriction +BOOST_IOSTREAMS_RESTRICT( const T& t, stream_offset off, stream_offset len = -1 + BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) ) +{ return BOOST_IOSTREAMS_RESTRICT(t, off, len, is_std_io()); } + +# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ + !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ + !defined(__GNUC__) // ---------------------------------------------------// + +template +restriction +BOOST_IOSTREAMS_RESTRICT(T& t, stream_offset off, stream_offset len = -1) +{ return restriction(t, off, len); } + +# endif // Borland 5.x, VC6-7.0 or GCC 2.9x //-------------------------------// +# endif // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //--------------// + +} } // End namespaces iostreams, boost. + +#endif // #if !defined(BOOST_IOSTREAMS_RESTRICT_IMPL_HPP_INCLUDED) ... diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/select.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/select.hpp new file mode 100644 index 0000000000..bfe1d09dea --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/select.hpp @@ -0,0 +1,86 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains the metafunction select, which mimics the effect of a chain of +// nested mpl if_'s. +// +// ----------------------------------------------------------------------------- +// +// Usage: +// +// typedef typename select< +// case1, type1, +// case2, type2, +// ... +// true_, typen +// >::type selection; +// +// Here case1, case2, ... are models of MPL::IntegralConstant with value type +// bool, and n <= 12. + +#ifndef BOOST_IOSTREAMS_SELECT_HPP_INCLUDED +#define BOOST_IOSTREAMS_SELECT_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +typedef mpl::true_ else_; + +template< typename Case1 = mpl::true_, + typename Type1 = mpl::void_, + typename Case2 = mpl::true_, + typename Type2 = mpl::void_, + typename Case3 = mpl::true_, + typename Type3 = mpl::void_, + typename Case4 = mpl::true_, + typename Type4 = mpl::void_, + typename Case5 = mpl::true_, + typename Type5 = mpl::void_, + typename Case6 = mpl::true_, + typename Type6 = mpl::void_, + typename Case7 = mpl::true_, + typename Type7 = mpl::void_, + typename Case8 = mpl::true_, + typename Type8 = mpl::void_, + typename Case9 = mpl::true_, + typename Type9 = mpl::void_, + typename Case10 = mpl::true_, + typename Type10 = mpl::void_, + typename Case11 = mpl::true_, + typename Type11 = mpl::void_, + typename Case12 = mpl::true_, + typename Type12 = mpl::void_ > +struct select { + typedef typename + mpl::eval_if< + Case1, mpl::identity, mpl::eval_if< + Case2, mpl::identity, mpl::eval_if< + Case3, mpl::identity, mpl::eval_if< + Case4, mpl::identity, mpl::eval_if< + Case5, mpl::identity, mpl::eval_if< + Case6, mpl::identity, mpl::eval_if< + Case7, mpl::identity, mpl::eval_if< + Case8, mpl::identity, mpl::eval_if< + Case9, mpl::identity, mpl::eval_if< + Case10, mpl::identity, mpl::eval_if< + Case11, mpl::identity, mpl::if_< + Case12, Type12, mpl::void_ > > > > > > > > > > > + >::type type; +}; + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_SELECT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/select_by_size.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/select_by_size.hpp new file mode 100644 index 0000000000..72934e5a92 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/select_by_size.hpp @@ -0,0 +1,160 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2004-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// +// Intended as an alternative to type_traits::yes_type and type_traits::no_type. +// Provides an arbitrary number of types (case_<0>, case_<1>, ...) for +// determining the results of overload resultion using 'sizeof', plus a uniform +// means of using the result. yes_type and no_type are typedefs for case_<1> +// and case_<0>. A single case with negative argument, case_<-1>, is also +// provided, for convenience. +// +// This header may be included any number of times, with +// BOOST_SELECT_BY_SIZE_MAX_CASE defined to be the largest N such that case_ +// is needed for a particular application. It defaults to 20. +// +// This header depends only on Boost.Config and Boost.Preprocessor. Dependence +// on Type Traits or MPL was intentionally avoided, to leave open the +// possibility that select_by_size could be used by these libraries. +// +// Example usage: +// +// #define BOOST_SELECT_BY_SIZE_MAX_CASE 7 // (Needed when default was 2) +// #include +// +// using namespace boost::utility; +// +// case_<0> helper(bool); +// case_<1> helper(int); +// case_<2> helper(unsigned); +// case_<3> helper(long); +// case_<4> helper(unsigned long); +// case_<5> helper(float); +// case_<6> helper(double); +// case_<7> helper(const char*); +// +// struct test { +// static const int value = +// select_by_size< sizeof(helper(9876UL)) >::value; +// BOOST_STATIC_ASSERT(value == 4); +// }; +// +// For compilers with integral constant expression problems, e.g. Borland 5.x, +// one can also write +// +// struct test { +// BOOST_SELECT_BY_SIZE(int, value, helper(9876UL)); +// }; +// +// to define a static integral constant 'value' equal to +// +// select_by_size< sizeof(helper(9876UL)) >::value. +// + +// Include guards surround all contents of this header except for explicit +// specializations of select_by_size for case_ with N > 2. + +#ifndef BOOST_IOSTREAMS_DETAIL_SELECT_BY_SIZE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_SELECT_BY_SIZE_HPP_INCLUDED + +// The lowest N for which select_by_size< sizeof(case_) > has not been +// specialized. +#define SELECT_BY_SIZE_MAX_SPECIALIZED 20 + +#include // BOOST_STATIC_CONSTANT. +#include +#include + +/* Alternative implementation using max_align. + +#include +#include + +namespace boost { namespace utility { + +template +struct case_ { char c[(N + 1) * alignment_of::value]; }; + +template +struct select_by_size { + BOOST_STATIC_CONSTANT(int, value = + (Size / alignment_of::value - 1)); +}; + +} } // End namespaces utility, boost. + +*/ // End alternate implementation. + +namespace boost { namespace iostreams { namespace detail { + +//--------------Definition of case_-------------------------------------------// + +template struct case_ { char c1; case_ c2; }; +template<> struct case_<-1> { char c; }; +typedef case_ yes_type; +typedef case_ no_type; + +//--------------Declaration of select_by_size---------------------------------// + +template struct select_by_size; + +} } } // End namespaces detail, iostreams, boost. + +//--------------Definition of SELECT_BY_SIZE_SPEC-----------------------------// + +// Sepecializes select_by_size for sizeof(case). The decrement is used +// here because the preprocessor library doesn't handle negative integers. +#define SELECT_BY_SIZE_SPEC(n) \ + namespace boost { namespace iostreams { namespace detail { \ + static const int BOOST_PP_CAT(sizeof_case_, n) = sizeof(case_); \ + template<> \ + struct select_by_size< BOOST_PP_CAT(sizeof_case_, n) > { \ + struct type { BOOST_STATIC_CONSTANT(int, value = n - 1); }; \ + BOOST_STATIC_CONSTANT(int, value = type::value); \ + }; \ + } } } \ + /**/ + +//--------------Default specializations of select_by_size---------------------// + +#define BOOST_PP_LOCAL_MACRO(n) SELECT_BY_SIZE_SPEC(n) +#define BOOST_PP_LOCAL_LIMITS (0, 20) +#include BOOST_PP_LOCAL_ITERATE() +#undef BOOST_PP_LOCAL_MACRO + +//--------------Definition of SELECT_BY_SIZE----------------------------------// + +#define BOOST_SELECT_BY_SIZE(type_, name, expr) \ + BOOST_STATIC_CONSTANT( \ + unsigned, \ + BOOST_PP_CAT(boost_select_by_size_temp_, name) = sizeof(expr) \ + ); \ + BOOST_STATIC_CONSTANT( \ + type_, \ + name = \ + ( ::boost::iostreams::detail::select_by_size< \ + BOOST_PP_CAT(boost_select_by_size_temp_, name) \ + >::value ) \ + ) \ + /**/ + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_SELECT_BY_SIZE_HPP_INCLUDED + +//----------Specializations of SELECT_BY_SIZE (outside main inclued guards)---// + +#if BOOST_SELECT_BY_SIZE_MAX_CASE > SELECT_BY_SIZE_MAX_SPECIALIZED + +#define BOOST_PP_LOCAL_MACRO(n) SELECT_BY_SIZE_SPEC(n) +#define BOOST_PP_LOCAL_LIMITS \ + (SELECT_BY_SIZE_MAX_SPECIALIZED, BOOST_SELECT_BY_SIZE_MAX_CASE) \ + /**/ +#include BOOST_PP_LOCAL_ITERATE() +#undef BOOST_PP_LOCAL_MACRO +#undef SELECT_BY_SIZE_MAX_SPECIALIZED +#define SELECT_BY_SIZE_MAX_SPECIALIZED BOOST_SELECT_BY_SIZE_MAX_CASE + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf.hpp new file mode 100644 index 0000000000..49a48ce38f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf.hpp @@ -0,0 +1,34 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_STREAMBUF_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_STREAMBUF_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# include +#else +# include +#endif + +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES +# define BOOST_IOSTREAMS_BASIC_STREAMBUF(ch, tr) std::basic_streambuf< ch, tr > +# define BOOST_IOSTREAMS_PUBSYNC pubsync +# define BOOST_IOSTREAMS_PUBSEEKOFF pubseekoff +# define BOOST_IOSTREAMS_PUBSEEKPOS pubseekpos +#else +# define BOOST_IOSTREAMS_BASIC_STREAMBUF(ch, tr) std::streambuf +# define BOOST_IOSTREAMS_PUBSYNC sync +# define BOOST_IOSTREAMS_PUBSEEKOFF seekoff +# define BOOST_IOSTREAMS_PUBSEEKPOS seekpos +#endif + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_STREAMBUF_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/chainbuf.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/chainbuf.hpp new file mode 100644 index 0000000000..9481c3a9d8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/chainbuf.hpp @@ -0,0 +1,116 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_CHAINBUF_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_CHAINBUF_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC, template friends. +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +//--------------Definition of chainbuf----------------------------------------// + +// +// Template name: chainbuf. +// Description: Stream buffer which operates by delegating to the first +// linked_streambuf in a chain. +// Template paramters: +// Chain - The chain type. +// +template +class chainbuf + : public BOOST_IOSTREAMS_BASIC_STREAMBUF( + typename Chain::char_type, + typename Chain::traits_type + ), + public access_control, + private noncopyable +{ +private: + typedef access_control, Access> client_type; +public: + typedef typename Chain::char_type char_type; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(typename Chain::traits_type) +protected: + typedef linked_streambuf delegate_type; + chainbuf() { client_type::set_chain(&chain_); } + int_type underflow() + { sentry t(this); return translate(delegate().underflow()); } + int_type pbackfail(int_type c) + { sentry t(this); return translate(delegate().pbackfail(c)); } + std::streamsize xsgetn(char_type* s, std::streamsize n) + { sentry t(this); return delegate().xsgetn(s, n); } + int_type overflow(int_type c) + { sentry t(this); return translate(delegate().overflow(c)); } + std::streamsize xsputn(const char_type* s, std::streamsize n) + { sentry t(this); return delegate().xsputn(s, n); } + int sync() { sentry t(this); return delegate().sync(); } + pos_type seekoff( off_type off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ) + { sentry t(this); return delegate().seekoff(off, way, which); } + pos_type seekpos( pos_type sp, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ) + { sentry t(this); return delegate().seekpos(sp, which); } +protected: + typedef BOOST_IOSTREAMS_BASIC_STREAMBUF( + typename Chain::char_type, + typename Chain::traits_type + ) base_type; +//#if !BOOST_WORKAROUND(__GNUC__, == 2) +// BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base_type) +//#endif +private: + + // Translate from std int_type to chain's int_type. + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) std_traits; + typedef typename Chain::traits_type chain_traits; + static typename chain_traits::int_type + translate(typename std_traits::int_type c) + { return translate_int_type(c); } + + delegate_type& delegate() + { return static_cast(chain_.front()); } + void get_pointers() + { + this->setg(delegate().eback(), delegate().gptr(), delegate().egptr()); + this->setp(delegate().pbase(), delegate().epptr()); + this->pbump((int) (delegate().pptr() - delegate().pbase())); + } + void set_pointers() + { + delegate().setg(this->eback(), this->gptr(), this->egptr()); + delegate().setp(this->pbase(), this->epptr()); + delegate().pbump((int) (this->pptr() - this->pbase())); + } + struct sentry { + sentry(chainbuf* buf) : buf_(buf) + { buf_->set_pointers(); } + ~sentry() { buf_->get_pointers(); } + chainbuf* buf_; + }; + friend struct sentry; + Chain chain_; +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CHAINBUF_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/direct_streambuf.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/direct_streambuf.hpp new file mode 100644 index 0000000000..605989559a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/direct_streambuf.hpp @@ -0,0 +1,306 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_DIRECT_STREAMBUF_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_DIRECT_STREAMBUF_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include // pair. +#include // BOOST_DEDUCED_TYPENAME, +#include // member template friends. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +namespace detail { + +template< typename T, + typename Tr = + BOOST_IOSTREAMS_CHAR_TRAITS( + BOOST_DEDUCED_TYPENAME char_type_of::type + ) > +class direct_streambuf + : public linked_streambuf::type, Tr> +{ +public: + typedef typename char_type_of::type char_type; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) +private: + typedef linked_streambuf base_type; + typedef typename category_of::type category; + typedef BOOST_IOSTREAMS_BASIC_STREAMBUF( + char_type, traits_type + ) streambuf_type; +public: // stream needs access. + void open(const T& t, int buffer_size, int pback_size); + bool is_open() const; + void close(); + bool auto_close() const { return auto_close_; } + void set_auto_close(bool close) { auto_close_ = close; } + bool strict_sync() { return true; } + + // Declared in linked_streambuf. + T* component() { return storage_.get(); } +protected: +#if !BOOST_WORKAROUND(__GNUC__, == 2) + BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base_type) +#endif + direct_streambuf(); + + //--------------Virtual functions-----------------------------------------// + + // Declared in linked_streambuf. + void close_impl(BOOST_IOS::openmode m); + const std::type_info& component_type() const { return typeid(T); } + void* component_impl() { return component(); } +#ifdef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES + public: +#endif + + // Declared in basic_streambuf. + int_type underflow(); + int_type pbackfail(int_type c); + int_type overflow(int_type c); + pos_type seekoff( off_type off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ); + pos_type seekpos(pos_type sp, BOOST_IOS::openmode which); +private: + pos_type seek_impl( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ); + void init_input(any_tag) { } + void init_input(input); + void init_output(any_tag) { } + void init_output(output); + void init_get_area(); + void init_put_area(); + bool one_head() const; + bool two_head() const; + optional storage_; + char_type *ibeg_, *iend_, *obeg_, *oend_; + bool auto_close_; +}; + +//------------------Implementation of direct_streambuf------------------------// + +template +direct_streambuf::direct_streambuf() + : ibeg_(0), iend_(0), obeg_(0), oend_(0), auto_close_(true) +{ this->set_true_eof(true); } + +template +void direct_streambuf::open(const T& t, int, int) +{ + storage_.reset(t); + init_input(category()); + init_output(category()); + setg(0, 0, 0); + setp(0, 0); +} + +template +bool direct_streambuf::is_open() const +{ return ibeg_ != 0 || obeg_ != 0; } + +template +void direct_streambuf::close() +{ + base_type* self = this; + detail::execute_all( detail::call_member_close(*self, BOOST_IOS::in), + detail::call_member_close(*self, BOOST_IOS::out), + detail::call_reset(storage_) ); +} + +template +typename direct_streambuf::int_type +direct_streambuf::underflow() +{ + if (!ibeg_) + throw cant_read(); + if (!gptr()) + init_get_area(); + return gptr() != iend_ ? + traits_type::to_int_type(*gptr()) : + traits_type::eof(); +} + +template +typename direct_streambuf::int_type +direct_streambuf::pbackfail(int_type c) +{ + using namespace std; + if (!ibeg_) + throw cant_read(); + if (gptr() != 0 && gptr() != ibeg_) { + gbump(-1); + if (!traits_type::eq_int_type(c, traits_type::eof())) + *gptr() = traits_type::to_char_type(c); + return traits_type::not_eof(c); + } + throw bad_putback(); +} + +template +typename direct_streambuf::int_type +direct_streambuf::overflow(int_type c) +{ + using namespace std; + if (!obeg_) throw BOOST_IOSTREAMS_FAILURE("no write access"); + if (!pptr()) init_put_area(); + if (!traits_type::eq_int_type(c, traits_type::eof())) { + if (pptr() == oend_) + throw BOOST_IOSTREAMS_FAILURE("write area exhausted"); + *pptr() = traits_type::to_char_type(c); + pbump(1); + return c; + } + return traits_type::not_eof(c); +} + +template +inline typename direct_streambuf::pos_type +direct_streambuf::seekoff + (off_type off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) +{ return seek_impl(off, way, which); } + +template +inline typename direct_streambuf::pos_type +direct_streambuf::seekpos + (pos_type sp, BOOST_IOS::openmode which) +{ + return seek_impl(position_to_offset(sp), BOOST_IOS::beg, which); +} + +template +void direct_streambuf::close_impl(BOOST_IOS::openmode which) +{ + if (which == BOOST_IOS::in && ibeg_ != 0) { + setg(0, 0, 0); + ibeg_ = iend_ = 0; + } + if (which == BOOST_IOS::out && obeg_ != 0) { + sync(); + setp(0, 0); + obeg_ = oend_ = 0; + } + boost::iostreams::close(*storage_, which); +} + +template +typename direct_streambuf::pos_type direct_streambuf::seek_impl + (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) +{ + using namespace std; + BOOST_IOS::openmode both = BOOST_IOS::in | BOOST_IOS::out; + if (two_head() && (which & both) == both) + throw bad_seek(); + stream_offset result = -1; + bool one = one_head(); + if (one && (pptr() != 0 || gptr()== 0)) + init_get_area(); // Switch to input mode, for code reuse. + if (one || (which & BOOST_IOS::in) != 0 && ibeg_ != 0) { + if (!gptr()) setg(ibeg_, ibeg_, iend_); + ptrdiff_t next = 0; + switch (way) { + case BOOST_IOS::beg: next = off; break; + case BOOST_IOS::cur: next = (gptr() - ibeg_) + off; break; + case BOOST_IOS::end: next = (iend_ - ibeg_) + off; break; + default: assert(0); + } + if (next < 0 || next > (iend_ - ibeg_)) + throw bad_seek(); + setg(ibeg_, ibeg_ + next, iend_); + result = next; + } + if (!one && (which & BOOST_IOS::out) != 0 && obeg_ != 0) { + if (!pptr()) setp(obeg_, oend_); + ptrdiff_t next = 0; + switch (way) { + case BOOST_IOS::beg: next = off; break; + case BOOST_IOS::cur: next = (pptr() - obeg_) + off; break; + case BOOST_IOS::end: next = (oend_ - obeg_) + off; break; + default: assert(0); + } + if (next < 0 || next > (oend_ - obeg_)) + throw bad_seek(); + pbump(static_cast(next - (pptr() - obeg_))); + result = next; + } + return offset_to_position(result); +} + +template +void direct_streambuf::init_input(input) +{ + std::pair p = input_sequence(*storage_); + ibeg_ = p.first; + iend_ = p.second; +} + +template +void direct_streambuf::init_output(output) +{ + std::pair p = output_sequence(*storage_); + obeg_ = p.first; + oend_ = p.second; +} + +template +void direct_streambuf::init_get_area() +{ + setg(ibeg_, ibeg_, iend_); + if (one_head() && pptr()) { + gbump(static_cast(pptr() - obeg_)); + setp(0, 0); + } +} + +template +void direct_streambuf::init_put_area() +{ + setp(obeg_, oend_); + if (one_head() && gptr()) { + pbump(static_cast(gptr() - ibeg_)); + setg(0, 0, 0); + } +} + +template +inline bool direct_streambuf::one_head() const +{ return ibeg_ && obeg_ && ibeg_ == obeg_; } + +template +inline bool direct_streambuf::two_head() const +{ return ibeg_ && obeg_ && ibeg_ != obeg_; } + +//----------------------------------------------------------------------------// + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include // MSVC + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_DIRECT_STREAMBUF_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/indirect_streambuf.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/indirect_streambuf.hpp new file mode 100644 index 0000000000..4744b5a364 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/indirect_streambuf.hpp @@ -0,0 +1,430 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// This material is heavily indebted to the discussion and code samples in +// A. Langer and K. Kreft, "Standard C++ IOStreams and Locales", +// Addison-Wesley, 2000, pp. 228-43. + +// User "GMSB" provided an optimization for small seeks. + +#ifndef BOOST_IOSTREAMS_DETAIL_INDIRECT_STREAMBUF_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_INDIRECT_STREAMBUF_HPP_INCLUDED + +#include // min, max. +#include +#include +#include +#include // Member template friends. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC, BCC 5.x + +namespace boost { namespace iostreams { namespace detail { + +// +// Description: The implementation of basic_streambuf used by chains. +// +template +class indirect_streambuf + : public linked_streambuf::type, Tr> +{ +public: + typedef typename char_type_of::type char_type; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) +private: + typedef typename category_of::type category; + typedef concept_adapter wrapper; + typedef detail::basic_buffer buffer_type; + typedef indirect_streambuf my_type; + typedef detail::linked_streambuf base_type; + typedef linked_streambuf streambuf_type; +public: + indirect_streambuf(); + + void open(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()); + bool is_open() const; + void close(); + bool auto_close() const; + void set_auto_close(bool close); + bool strict_sync(); + + // Declared in linked_streambuf. + T* component() { return &*obj(); } +protected: +#if !BOOST_WORKAROUND(__GNUC__, == 2) + BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base_type) +#endif + + //----------virtual functions---------------------------------------------// + +#ifndef BOOST_IOSTREAMS_NO_LOCALE + void imbue(const std::locale& loc); +#endif +#ifdef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES + public: +#endif + int_type underflow(); + int_type pbackfail(int_type c); + int_type overflow(int_type c); + int sync(); + pos_type seekoff( off_type off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ); + pos_type seekpos(pos_type sp, BOOST_IOS::openmode which); + + // Declared in linked_streambuf. + void set_next(streambuf_type* next); + void close_impl(BOOST_IOS::openmode m); + const std::type_info& component_type() const { return typeid(T); } + void* component_impl() { return component(); } +private: + + //----------Accessor functions--------------------------------------------// + + wrapper& obj() { return *storage_; } + streambuf_type* next() const { return next_; } + buffer_type& in() { return buffer_.first(); } + buffer_type& out() { return buffer_.second(); } + bool can_read() const { return is_convertible::value; } + bool can_write() const { return is_convertible::value; } + bool output_buffered() const { return (flags_ & f_output_buffered) != 0; } + bool shared_buffer() const { return is_convertible::value; } + void set_flags(int f) { flags_ = f; } + + //----------State changing functions--------------------------------------// + + virtual void init_get_area(); + virtual void init_put_area(); + + //----------Utility function----------------------------------------------// + + pos_type seek_impl( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ); + void sync_impl(); + + enum flag_type { + f_open = 1, + f_output_buffered = f_open << 1, + f_auto_close = f_output_buffered << 1 + }; + + optional storage_; + streambuf_type* next_; + double_object< + buffer_type, + is_convertible< + Mode, + two_sequence + > + > buffer_; + std::streamsize pback_size_; + int flags_; +}; + +//--------------Implementation of indirect_streambuf--------------------------// + +template +indirect_streambuf::indirect_streambuf() + : next_(0), pback_size_(0), flags_(f_auto_close) { } + +//--------------Implementation of open, is_open and close---------------------// + +template +void indirect_streambuf::open + (const T& t, int buffer_size, int pback_size) +{ + using namespace std; + + // Normalize buffer sizes. + buffer_size = + (buffer_size != -1) ? + buffer_size : + iostreams::optimal_buffer_size(t); + pback_size = + (pback_size != -1) ? + pback_size : + default_pback_buffer_size; + + // Construct input buffer. + if (can_read()) { + pback_size_ = (std::max)(2, pback_size); // STLPort needs 2. + std::streamsize size = + pback_size_ + + ( buffer_size ? buffer_size: 1 ); + in().resize(size); + if (!shared_buffer()) + init_get_area(); + } + + // Construct output buffer. + if (can_write() && !shared_buffer()) { + if (buffer_size != 0) + out().resize(buffer_size); + init_put_area(); + } + + storage_.reset(wrapper(t)); + flags_ |= f_open; + if (can_write() && buffer_size > 1) + flags_ |= f_output_buffered; + this->set_true_eof(false); +} + +template +inline bool indirect_streambuf::is_open() const +{ return (flags_ & f_open) != 0; } + +template +void indirect_streambuf::close() +{ + using namespace std; + base_type* self = this; + detail::execute_all( + detail::call_member_close(*self, BOOST_IOS::in), + detail::call_member_close(*self, BOOST_IOS::out), + detail::call_reset(storage_), + detail::clear_flags(flags_) + ); +} + +template +bool indirect_streambuf::auto_close() const +{ return (flags_ & f_auto_close) != 0; } + +template +void indirect_streambuf::set_auto_close(bool close) +{ flags_ = (flags_ & ~f_auto_close) | (close ? f_auto_close : 0); } + +//--------------Implementation virtual functions------------------------------// + +#ifndef BOOST_IOSTREAMS_NO_LOCALE +template +void indirect_streambuf::imbue(const std::locale& loc) +{ + if (is_open()) { + obj().imbue(loc); + if (next_) + next_->pubimbue(loc); + } +} +#endif + +template +typename indirect_streambuf::int_type +indirect_streambuf::underflow() +{ + using namespace std; + if (!gptr()) init_get_area(); + buffer_type& buf = in(); + if (gptr() < egptr()) return traits_type::to_int_type(*gptr()); + + // Fill putback buffer. + std::streamsize keep = + (std::min)( static_cast(gptr() - eback()), + pback_size_ ); + if (keep) + traits_type::move( buf.data() + (pback_size_ - keep), + gptr() - keep, keep ); + + // Set pointers to reasonable values in case read throws. + setg( buf.data() + pback_size_ - keep, + buf.data() + pback_size_, + buf.data() + pback_size_ ); + + // Read from source. + std::streamsize chars = + obj().read(buf.data() + pback_size_, buf.size() - pback_size_, next_); + if (chars == -1) { + this->set_true_eof(true); + chars = 0; + } + setg(eback(), gptr(), buf.data() + pback_size_ + chars); + return chars != 0 ? + traits_type::to_int_type(*gptr()) : + traits_type::eof(); +} + +template +typename indirect_streambuf::int_type +indirect_streambuf::pbackfail(int_type c) +{ + if (gptr() != eback()) { + gbump(-1); + if (!traits_type::eq_int_type(c, traits_type::eof())) + *gptr() = traits_type::to_char_type(c); + return traits_type::not_eof(c); + } else { + throw bad_putback(); + } +} + +template +typename indirect_streambuf::int_type +indirect_streambuf::overflow(int_type c) +{ + if ( output_buffered() && pptr() == 0 || + shared_buffer() && gptr() != 0 ) + { + init_put_area(); + } + if (!traits_type::eq_int_type(c, traits_type::eof())) { + if (output_buffered()) { + if (pptr() == epptr()) { + sync_impl(); + if (pptr() == epptr()) + return traits_type::eof(); + } + *pptr() = traits_type::to_char_type(c); + pbump(1); + } else { + char_type d = traits_type::to_char_type(c); + if (obj().write(&d, 1, next_) != 1) + return traits_type::eof(); + } + } + return traits_type::not_eof(c); +} + +template +int indirect_streambuf::sync() +{ + try { // sync() is no-throw. + sync_impl(); + obj().flush(next_); + return 0; + } catch (...) { return -1; } +} + +template +bool indirect_streambuf::strict_sync() +{ + try { // sync() is no-throw. + sync_impl(); + return obj().flush(next_); + } catch (...) { return false; } +} + +template +inline typename indirect_streambuf::pos_type +indirect_streambuf::seekoff + (off_type off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) +{ return seek_impl(off, way, which); } + +template +inline typename indirect_streambuf::pos_type +indirect_streambuf::seekpos + (pos_type sp, BOOST_IOS::openmode which) +{ + return seek_impl(position_to_offset(sp), BOOST_IOS::beg, which); +} + +template +typename indirect_streambuf::pos_type +indirect_streambuf::seek_impl + (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) +{ + if ( gptr() != 0 && way == BOOST_IOS::cur && which == BOOST_IOS::in && + eback() - gptr() <= off && off <= egptr() - gptr() ) + { // Small seek optimization + gbump(off); + return obj().seek(0, BOOST_IOS::cur, BOOST_IOS::in, next_) - + static_cast(egptr() - gptr()); + } + if (pptr() != 0) + this->BOOST_IOSTREAMS_PUBSYNC(); // sync() confuses VisualAge 6. + if (way == BOOST_IOS::cur && gptr()) + off -= static_cast(egptr() - gptr()); + setg(0, 0, 0); + setp(0, 0); + return obj().seek(off, way, which, next_); +} + +template +inline void indirect_streambuf::set_next + (streambuf_type* next) +{ next_ = next; } + +template +inline void indirect_streambuf::close_impl + (BOOST_IOS::openmode which) +{ + if (which == BOOST_IOS::in && is_convertible::value) { + setg(0, 0, 0); + } + if (which == BOOST_IOS::out && is_convertible::value) { + sync(); + setp(0, 0); + } + if ( !is_convertible::value || + is_convertible::value == (which == BOOST_IOS::in) ) + { + obj().close(which, next_); + } +} + +//----------State changing functions------------------------------------------// + +template +void indirect_streambuf::sync_impl() +{ + std::streamsize avail, amt; + if ((avail = static_cast(pptr() - pbase())) > 0) { + if ((amt = obj().write(pbase(), avail, next())) == avail) + setp(out().begin(), out().end()); + else { + const char_type* ptr = pptr(); + setp(out().begin() + amt, out().end()); + pbump(ptr - pptr()); + } + } +} + +template +void indirect_streambuf::init_get_area() +{ + if (shared_buffer() && pptr() != 0) { + sync_impl(); + setp(0, 0); + } + setg(in().begin(), in().begin(), in().begin()); +} + +template +void indirect_streambuf::init_put_area() +{ + using namespace std; + if (shared_buffer() && gptr() != 0) + setg(0, 0, 0); + if (output_buffered()) + setp(out().begin(), out().end()); + else + setp(0, 0); +} + +//----------------------------------------------------------------------------// + +} } } // End namespaces detail, iostreams, boost. + +#include // MSVC, BCC 5.x + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_INDIRECT_STREAMBUF_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/linked_streambuf.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/linked_streambuf.hpp new file mode 100644 index 0000000000..10aedb89df --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/streambuf/linked_streambuf.hpp @@ -0,0 +1,114 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_LINKED_STREAMBUF_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_LINKED_STREAMBUF_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // member template friends. +#include +#include // openmode. +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { namespace detail { + +template +class chain_base; + +template class chainbuf; + +#define BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base) \ + using base::eback; using base::gptr; using base::egptr; \ + using base::setg; using base::gbump; using base::pbase; \ + using base::pptr; using base::epptr; using base::setp; \ + using base::pbump; using base::underflow; using base::pbackfail; \ + using base::xsgetn; using base::overflow; using base::xsputn; \ + using base::sync; using base::seekoff; using base::seekpos; \ + /**/ + +template +class linked_streambuf : public BOOST_IOSTREAMS_BASIC_STREAMBUF(Ch, Tr) { +protected: + linked_streambuf() : flags_(0) { } + void set_true_eof(bool eof) + { + flags_ = (flags_ & ~f_true_eof) | (eof ? f_true_eof : 0); + } +public: + + // Should be called only after receiving an ordinary EOF indication, + // to confirm that it represents EOF rather than WOULD_BLOCK. + bool true_eof() const { return (flags_ & f_true_eof) != 0; } +protected: + + //----------grant friendship to chain_base and chainbuf-------------------// + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + template< typename Self, typename ChT, typename TrT, + typename Alloc, typename Mode > + friend class chain_base; + template + friend class chainbuf; + template + friend class member_close_operation; +#else + public: + typedef BOOST_IOSTREAMS_BASIC_STREAMBUF(Ch, Tr) base; + BOOST_IOSTREAMS_USING_PROTECTED_STREAMBUF_MEMBERS(base) +#endif + void close(BOOST_IOS::openmode which) + { + if ( which == BOOST_IOS::in && + (flags_ & f_input_closed) == 0 ) + { + flags_ |= f_input_closed; + close_impl(which); + } + if ( which == BOOST_IOS::out && + (flags_ & f_output_closed) == 0 ) + { + flags_ |= f_output_closed; + close_impl(which); + } + } + void set_needs_close() + { + flags_ &= ~(f_input_closed | f_output_closed); + } + virtual void set_next(linked_streambuf* /* next */) { } + virtual void close_impl(BOOST_IOS::openmode) = 0; + virtual bool auto_close() const = 0; + virtual void set_auto_close(bool) = 0; + virtual bool strict_sync() = 0; + virtual const std::type_info& component_type() const = 0; + virtual void* component_impl() = 0; +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + private: +#else + public: +#endif +private: + enum flag_type { + f_true_eof = 1, + f_input_closed = f_true_eof << 1, + f_output_closed = f_input_closed << 1 + }; + int flags_; +}; + +} } } // End namespaces detail, iostreams, boost. + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_LINKED_STREAMBUF_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/system_failure.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/system_failure.hpp new file mode 100644 index 0000000000..3d12299f76 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/system_failure.hpp @@ -0,0 +1,83 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// (C) Copyright Jonathan Graehl 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/iostreams for documentation. + +// Used by mapped_file.cpp. + +#ifndef BOOST_IOSTREAMS_DETAIL_SYSTEM_FAILURE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_SYSTEM_FAILURE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include // failure. + +#if defined(BOOST_NO_STDC_NAMESPACE) && !defined(__LIBCOMO__) +namespace std { using ::strlen; } +#endif + +#ifdef BOOST_IOSTREAMS_WINDOWS +# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +# include +#else +# include +# include +#endif + +namespace boost { namespace iostreams { namespace detail { + +inline BOOST_IOSTREAMS_FAILURE system_failure(const char* msg) +{ + std::string result; +#ifdef BOOST_IOSTREAMS_WINDOWS + DWORD err; + LPVOID lpMsgBuf; + if ( (err = ::GetLastError()) != NO_ERROR && + ::FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR) &lpMsgBuf, + 0, + NULL ) != 0 ) + { + result.reserve(std::strlen(msg) + 2 + std::strlen((LPSTR)lpMsgBuf)); + result.append(msg); + result.append(": "); + result.append((LPSTR) lpMsgBuf); + ::LocalFree(lpMsgBuf); + } else { + result += msg; + } +#else + const char* system_msg = errno ? strerror(errno) : ""; + result.reserve(std::strlen(msg) + 2 + std::strlen(system_msg)); + result.append(msg); + result.append(": "); + result.append(system_msg); +#endif + return BOOST_IOSTREAMS_FAILURE(result); +} + +inline BOOST_IOSTREAMS_FAILURE system_failure(const std::string& msg) +{ return system_failure(msg.c_str()); } + +inline void throw_system_failure(const char* msg) +{ throw system_failure(msg); } + +inline void throw_system_failure(const std::string& msg) +{ throw system_failure(msg); } + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_SYSTEM_FAILURE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/template_params.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/template_params.hpp new file mode 100644 index 0000000000..b07012fb82 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/template_params.hpp @@ -0,0 +1,26 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_TEMPLATE_PARAMS_HPP_INCLUDED + +#include +#include +#include + +#define BOOST_IOSTREAMS_TEMPLATE_PARAMS(arity, param) \ + BOOST_PP_EXPR_IF(arity, template<) \ + BOOST_PP_ENUM_PARAMS(arity, typename param) \ + BOOST_PP_EXPR_IF(arity, >) \ + /**/ + +#define BOOST_IOSTREAMS_TEMPLATE_ARGS(arity, param) \ + BOOST_PP_EXPR_IF(arity, <) \ + BOOST_PP_ENUM_PARAMS(arity, param) \ + BOOST_PP_EXPR_IF(arity, >) \ + /**/ + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_BUFFERS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/translate_int_type.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/translate_int_type.hpp new file mode 100644 index 0000000000..88b9341f74 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/translate_int_type.hpp @@ -0,0 +1,62 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_TRANSLATE_INT_TYPE_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_TRANSLATE_INT_TYPE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +namespace boost { namespace iostreams { namespace detail { + +template +struct translate_int_type_impl; + +// +// Template name: translate_char. +// Description: Translates a character or an end-of-file indicator from the +// int_type of one character traits type to the int_type of another. +// +template +typename TargetTr::int_type +translate_int_type(typename SourceTr::int_type c) +{ + typedef translate_int_type_impl::value> impl; + return impl::template inner::translate(c); +} + +//----------------------------------------------------------------------------// + +template<> +struct translate_int_type_impl { + template + struct inner { + static typename TargetTr::int_type + translate(typename SourceTr::int_type c) { return c; } + }; +}; + +template<> +struct translate_int_type_impl { + template + struct inner { + static typename TargetTr::int_type + translate(typename SourceTr::int_type c) + { + return SourceTr::eq_int_type(SourceTr::eof()) ? + TargetTr::eof() : + TargetTr::to_int_type(SourceTr::to_char_type(c)); + } + }; +}; + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_TRANSLATE_INT_TYPE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/close.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/close.hpp new file mode 100644 index 0000000000..f8936742b7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/close.hpp @@ -0,0 +1,129 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct close_impl; + +} // End namespace detail. + +template +void close(T& t) { detail::close_all(t); } + +template +void close(T& t, BOOST_IOS::openmode which) +{ + typedef typename detail::unwrapped_type::type unwrapped; + detail::close_impl::inner::close(detail::unwrap(t), which); +} + +template +void close(T& t, Sink& snk, BOOST_IOS::openmode which) +{ + typedef typename detail::unwrapped_type::type unwrapped; + detail::close_impl::inner::close(detail::unwrap(t), snk, which); +} + +namespace detail { + +//------------------Definition of close_impl----------------------------------// + +template +struct close_tag { + typedef typename category_of::type category; + typedef typename + mpl::eval_if< + is_convertible, + mpl::if_< + mpl::or_< + is_convertible, + is_convertible + >, + two_sequence, + closable_tag + >, + mpl::identity + >::type type; +}; + +template +struct close_impl + : mpl::if_< + is_custom, + operations, + close_impl::type> + >::type + { }; + +template<> +struct close_impl { + template + struct inner { + static void close(T& t, BOOST_IOS::openmode which) + { + if (which == BOOST_IOS::out) + iostreams::flush(t); + } + + template + static void close(T& t, Sink& snk, BOOST_IOS::openmode which) + { + if (which == BOOST_IOS::out) { + non_blocking_adapter nb(snk); + iostreams::flush(t, nb); + } + } + }; +}; + +template<> +struct close_impl { + template + struct inner { + static void close(T& t, BOOST_IOS::openmode which) + { + typedef typename category_of::type category; + const bool in = is_convertible::value && + !is_convertible::value; + if (in == (which == BOOST_IOS::in)) + t.close(); + } + template + static void close(T& t, Sink& snk, BOOST_IOS::openmode which) + { + typedef typename category_of::type category; + const bool in = is_convertible::value && + !is_convertible::value; + if (in == (which == BOOST_IOS::in)) { + non_blocking_adapter nb(snk); + t.close(nb); + } + } + }; +}; + +template<> +struct close_impl { + template + struct inner { + static void close(T& t, BOOST_IOS::openmode which) { t.close(which); } + + template + static void close(T& t, Sink& snk, BOOST_IOS::openmode which) + { + non_blocking_adapter nb(snk); + t.close(nb, which); + } + }; +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/read.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/read.hpp new file mode 100644 index 0000000000..1e01f665b9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/read.hpp @@ -0,0 +1,238 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct read_device_impl; + +template +struct read_filter_impl; + +} // End namespace detail. + +template +typename int_type_of::type get(T& t) +{ + typedef typename detail::unwrapped_type::type unwrapped; + return detail::read_device_impl::inner::get(detail::unwrap(t)); +} + +template +inline std::streamsize +read(T& t, typename char_type_of::type* s, std::streamsize n) +{ + typedef typename detail::unwrapped_type::type unwrapped; + return detail::read_device_impl::inner::read(detail::unwrap(t), s, n); +} + +template +std::streamsize +read(T& t, Source& src, typename char_type_of::type* s, std::streamsize n) +{ + typedef typename detail::unwrapped_type::type unwrapped; + return detail::read_filter_impl::inner::read(detail::unwrap(t), src, s, n); +} + +template +bool putback(T& t, typename char_type_of::type c) +{ + typedef typename detail::unwrapped_type::type unwrapped; + return detail::read_device_impl::inner::putback(detail::unwrap(t), c); +} + +//----------------------------------------------------------------------------// + +namespace detail { + +// Helper function for adding -1 as EOF indicator. +inline std::streamsize check_eof(std::streamsize n) { return n != 0 ? n : -1; } + +// Helper templates for reading from streambufs. +template +struct true_eof_impl; + +template<> +struct true_eof_impl { + template + static bool true_eof(T& t) { return t.true_eof(); } +}; + +template<> +struct true_eof_impl { + template + static bool true_eof(T& t) { return true; } +}; + +template +inline bool true_eof(T& t) +{ + const bool linked = is_linked::value; + return true_eof_impl::true_eof(t); +} + +//------------------Definition of read_device_impl----------------------------// + +template +struct read_device_impl + : mpl::if_< + detail::is_custom, + operations, + read_device_impl< + BOOST_DEDUCED_TYPENAME + detail::dispatch< + T, istream_tag, streambuf_tag, input + >::type + > + >::type + { }; + +template<> +struct read_device_impl { + template + struct inner { + static typename int_type_of::type get(T& t) + { return t.get(); } + + static std::streamsize + read(T& t, typename char_type_of::type* s, std::streamsize n) + { return check_eof(t.rdbuf()->sgetn(s, n)); } + + static bool putback(T& t, typename char_type_of::type c) + { + typedef typename char_type_of::type char_type; + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) traits_type; + return !traits_type::eq_int_type( t.rdbuf()->sputbackc(c), + traits_type::eof() ); + } + }; +}; + +template<> +struct read_device_impl { + template + struct inner { + static typename int_type_of::type + get(T& t) + { + typedef typename char_type_of::type char_type; + typedef char_traits traits_type; + typename int_type_of::type c; + return !traits_type::is_eof(c = t.sbumpc()) || + detail::true_eof(t) + ? + c : traits_type::would_block(); + } + + static std::streamsize + read(T& t, typename char_type_of::type* s, std::streamsize n) + { + std::streamsize amt; + return (amt = t.sgetn(s, n)) != 0 ? + amt : + detail::true_eof(t) ? + -1 : + 0; + } + + static bool putback(T& t, typename char_type_of::type c) + { + typedef typename char_type_of::type char_type; + typedef char_traits traits_type; + return !traits_type::is_eof(t.sputbackc(c)); + } + }; +}; + +template<> +struct read_device_impl { + template + struct inner { + static typename int_type_of::type + get(T& t) + { + typedef typename char_type_of::type char_type; + typedef char_traits traits_type; + char_type c; + std::streamsize amt; + return (amt = t.read(&c, 1)) == 1 ? + traits_type::to_int_type(c) : + amt == -1 ? + traits_type::eof() : + traits_type::would_block(); + } + + template + static std::streamsize + read(T& t, typename char_type_of::type* s, std::streamsize n) + { return t.read(s, n); } + + template + static bool putback(T& t, typename char_type_of::type c) + { // T must be Peekable. + return t.putback(c); + } + }; +}; + +//------------------Definition of read_filter_impl----------------------------// + +template +struct read_filter_impl + : mpl::if_< + detail::is_custom, + operations, + read_filter_impl< + BOOST_DEDUCED_TYPENAME + detail::dispatch< + T, multichar_tag, any_tag + >::type + > + >::type + { }; + +template<> +struct read_filter_impl { + template + struct inner { + template + static std::streamsize read + ( T& t, Source& src, typename char_type_of::type* s, + std::streamsize n ) + { return t.read(src, s, n); } + }; +}; + +template<> +struct read_filter_impl { + template + struct inner { + template + static std::streamsize read + ( T& t, Source& src, typename char_type_of::type* s, + std::streamsize n ) + { + typedef typename char_type_of::type char_type; + typedef char_traits traits_type; + for (std::streamsize off = 0; off < n; ++off) { + typename traits_type::int_type c = t.get(src); + if (traits_type::is_eof(c)) + return check_eof(off); + if (traits_type::would_block(c)) + return off; + s[off] = traits_type::to_char_type(c); + } + return n; + } + }; +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/write.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/write.hpp new file mode 100644 index 0000000000..ee8b9488ff --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/vc6/write.hpp @@ -0,0 +1,159 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct write_device_impl; + +template +struct write_filter_impl; + +} // End namespace detail. + +template +bool put(T& t, typename char_type_of::type c) +{ + typedef typename detail::unwrapped_type::type unwrapped; + return detail::write_device_impl::inner::put(detail::unwrap(t), c); +} + +template +inline std::streamsize write + (T& t, const typename char_type_of::type* s, std::streamsize n) +{ + typedef typename detail::unwrapped_type::type unwrapped; + return detail::write_device_impl::inner::write(detail::unwrap(t), s, n); +} + +template +inline std::streamsize +write( T& t, Sink& snk, const typename char_type_of::type* s, + std::streamsize n ) +{ + typedef typename detail::unwrapped_type::type unwrapped; + return detail::write_filter_impl::inner::write(detail::unwrap(t), snk, s, n); +} + +namespace detail { + +//------------------Definition of write_device_impl---------------------------// + +template +struct write_device_impl + : mpl::if_< + is_custom, + operations, + write_device_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, ostream_tag, streambuf_tag, output + >::type + > + >::type + { }; + +template<> +struct write_device_impl { + template + struct inner { + static bool put(T& t, typename char_type_of::type c) + { + typedef typename char_type_of::type char_type; + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) traits_type; + return !traits_type::eq_int_type( t.rdbuf()->s.sputc(), + traits_type::eof() ); + } + + static std::streamsize write + (T& t, const typename char_type_of::type* s, std::streamsize n) + { return t.rdbuf()->sputn(s, n); } + }; +}; + +template<> +struct write_device_impl { + template + struct inner { + static bool put(T& t, typename char_type_of::type c) + { + typedef typename char_type_of::type char_type; + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) traits_type; + return !traits_type::eq_int_type(t.sputc(c), traits_type::eof()); + } + + template + static std::streamsize write + (T& t, const typename char_type_of::type* s, std::streamsize n) + { return t.sputn(s, n); } + }; +}; + +template<> +struct write_device_impl { + template + struct inner { + static bool put(T& t, typename char_type_of::type c) + { return t.write(&c, 1) == 1; } + + template + static std::streamsize + write(T& t, const typename char_type_of::type* s, std::streamsize n) + { return t.write(s, n); } + }; +}; + +//------------------Definition of write_filter_impl---------------------------// + +template +struct write_filter_impl + : mpl::if_< + is_custom, + operations, + write_filter_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, multichar_tag, any_tag + >::type + > + >::type + { }; + +template<> +struct write_filter_impl { + template + struct inner { + template + static std::streamsize + write( T& t, Sink& snk, const typename char_type_of::type* s, + std::streamsize n ) + { return t.write(snk, s, n); } + }; +}; + +template<> +struct write_filter_impl { + template + struct inner { + template + static std::streamsize + write( T& t, Sink& snk, const typename char_type_of::type* s, + std::streamsize n ) + { + for (std::streamsize off = 0; off < n; ++off) + if (!t.put(snk, s[off])) + return off; + return n; + } + }; +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/wrap_unwrap.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/wrap_unwrap.hpp new file mode 100644 index 0000000000..6e3d231422 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/detail/wrap_unwrap.hpp @@ -0,0 +1,127 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_DETAIL_WRAP_UNWRAP_HPP_INCLUDED +#define BOOST_IOSTREAMS_DETAIL_WRAP_UNWRAP_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // SFINAE, MSVC. +#include +#include +#include // is_std_io. +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +//------------------Definition of wrap/unwrap traits--------------------------// + +template +struct wrapped_type + : mpl::if_, reference_wrapper, T> + { }; + +template +struct unwrapped_type + : unwrap_reference + { }; + +template +struct unwrap_ios + : mpl::eval_if< + is_std_io, + unwrap_reference, + mpl::identity + > + { }; + +//------------------Definition of wrap----------------------------------------// + +#ifndef BOOST_NO_SFINAE //----------------------------------------------------// + template + inline T wrap(const T& t BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)) + { return t; } + + template + inline typename wrapped_type::type + wrap(T& t BOOST_IOSTREAMS_ENABLE_IF_STREAM(T)) { return boost::ref(t); } +#else // #ifndef BOOST_NO_SFINAE //-------------------------------------------// + template + inline typename wrapped_type::type // BCC 5.x needs namespace qualification. + wrap_impl(const T& t, mpl::true_) { return boost::ref(const_cast(t)); } + + template + inline typename wrapped_type::type // BCC 5.x needs namespace qualification. + wrap_impl(T& t, mpl::true_) { return boost::ref(t); } + + template + inline typename wrapped_type::type + wrap_impl(const T& t, mpl::false_) { return t; } + + template + inline typename wrapped_type::type + wrap_impl(T& t, mpl::false_) { return t; } + + template + inline typename wrapped_type::type + wrap(const T& t) { return wrap_impl(t, is_std_io()); } + + template + inline typename wrapped_type::type + wrap(T& t) { return wrap_impl(t, is_std_io()); } +#endif // #ifndef BOOST_NO_SFINAE //------------------------------------------// + +//------------------Definition of unwrap--------------------------------------// + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) //----------------------------------// + +template +typename unwrapped_type::type& +unwrap(const reference_wrapper& ref) { return ref.get(); } + +template +typename unwrapped_type::type& unwrap(T& t) { return t; } + +template +const typename unwrapped_type::type& unwrap(const T& t) { return t; } + +#else // #if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) //-------------------------// + +// Since unwrap is a potential bottleneck, we avoid runtime tag dispatch. +template +struct unwrap_impl; + +template<> +struct unwrap_impl { + template + static typename unwrapped_type::type& unwrap(const T& t) + { return t.get(); } +}; + +template<> +struct unwrap_impl { + template + static typename unwrapped_type::type& unwrap(const T& t) + { return const_cast(t); } +}; + +template +typename unwrapped_type::type& +unwrap(const T& t) +{ return unwrap_impl::value>::unwrap(t); } + +#endif // #if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) //------------------------// + +} } } // End namespaces detail, iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_DETAIL_WRAP_UNWRAP_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/array.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/array.hpp new file mode 100644 index 0000000000..3e08f04470 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/array.hpp @@ -0,0 +1,144 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2004-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_ARRAY_HPP_INCLUDED +#define BOOST_IOSTREAMS_ARRAY_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC, make sure size_t is in std. +#include +#include // std::size_t. +#include // pair. +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +namespace detail { + +template +class array_adapter { +public: + typedef Ch char_type; + typedef std::pair pair_type; + struct category + : public Mode, + public device_tag, + public direct_tag + { }; + array_adapter(char_type* begin, char_type* end); + array_adapter(char_type* begin, std::size_t length); + array_adapter(const char_type* begin, const char_type* end); + array_adapter(const char_type* begin, std::size_t length); +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template + array_adapter(char_type (&ar)[N]) + : begin_(ar), end_(ar + N) + { } +#endif + pair_type input_sequence(); + pair_type output_sequence(); +private: + char_type* begin_; + char_type* end_; +}; + +} // End namespace detail. + +// Local macros, #undef'd below. +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# define BOOST_IOSTREAMS_ARRAY_CTOR(name, ch) \ + template \ + BOOST_PP_CAT(basic_, name)(ch (&ar)[N]) \ + : base_type(ar) { } \ + /**/ +#else +# define BOOST_IOSTREAMS_ARRAY_CTOR(name, ch) +#endif +#define BOOST_IOSTREAMS_ARRAY(name, mode) \ + template \ + struct BOOST_PP_CAT(basic_, name) : detail::array_adapter { \ + private: \ + typedef detail::array_adapter base_type; \ + public: \ + typedef typename base_type::char_type char_type; \ + typedef typename base_type::category category; \ + BOOST_PP_CAT(basic_, name)(char_type* begin, char_type* end) \ + : base_type(begin, end) { } \ + BOOST_PP_CAT(basic_, name)(char_type* begin, std::size_t length) \ + : base_type(begin, length) { } \ + BOOST_PP_CAT(basic_, name)(const char_type* begin, const char_type* end) \ + : base_type(begin, end) { } \ + BOOST_PP_CAT(basic_, name)(const char_type* begin, std::size_t length) \ + : base_type(begin, length) { } \ + BOOST_IOSTREAMS_ARRAY_CTOR(name, Ch) \ + }; \ + typedef BOOST_PP_CAT(basic_, name) name; \ + typedef BOOST_PP_CAT(basic_, name) BOOST_PP_CAT(w, name); \ + /**/ +BOOST_IOSTREAMS_ARRAY(array_source, input_seekable) +BOOST_IOSTREAMS_ARRAY(array_sink, output_seekable) +BOOST_IOSTREAMS_ARRAY(array, seekable) +#undef BOOST_IOSTREAMS_ARRAY_CTOR +#undef BOOST_IOSTREAMS_ARRAY + + +//------------------Implementation of array_adapter---------------------------// + +namespace detail { + +template +array_adapter::array_adapter + (char_type* begin, char_type* end) + : begin_(begin), end_(end) + { } + +template +array_adapter::array_adapter + (char_type* begin, std::size_t length) + : begin_(begin), end_(begin + length) + { } + +template +array_adapter::array_adapter + (const char_type* begin, const char_type* end) + : begin_(const_cast(begin)), // Treated as read-only. + end_(const_cast(end)) // Treated as read-only. +{ BOOST_STATIC_ASSERT((!is_convertible::value)); } + +template +array_adapter::array_adapter + (const char_type* begin, std::size_t length) + : begin_(const_cast(begin)), // Treated as read-only. + end_(const_cast(begin) + length) // Treated as read-only. +{ BOOST_STATIC_ASSERT((!is_convertible::value)); } + +template +typename array_adapter::pair_type +array_adapter::input_sequence() +{ BOOST_STATIC_ASSERT((is_convertible::value)); + return pair_type(begin_, end_); } + +template +typename array_adapter::pair_type +array_adapter::output_sequence() +{ BOOST_STATIC_ASSERT((is_convertible::value)); + return pair_type(begin_, end_); } + +} // End namespace detail. + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_ARRAY_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/back_inserter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/back_inserter.hpp new file mode 100644 index 0000000000..563e397918 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/back_inserter.hpp @@ -0,0 +1,41 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_BACK_INSERTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_BACK_INSERTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // streamsize. +#include + +namespace boost { namespace iostreams { + +template +class back_insert_device { +public: + typedef typename Container::value_type char_type; + typedef sink_tag category; + back_insert_device(Container& cnt) : container(&cnt) { } + std::streamsize write(const char_type* s, std::streamsize n) + { + container->insert(container->end(), s, s + n); + return n; + } +protected: + Container* container; +}; + +template +back_insert_device back_inserter(Container& cnt) +{ return back_insert_device(cnt); } + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_BACK_INSERTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/file.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/file.hpp new file mode 100644 index 0000000000..685077647c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/file.hpp @@ -0,0 +1,183 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// +// Contains wrappers for standard file buffers, together +// with convenience typedefs: +// - basic_file_source +// - basic_file_sink +// - basic_file +// + +#ifndef BOOST_IOSTREAMS_FILE_HPP_INCLUDED +#define BOOST_IOSTREAMS_FILE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#ifndef BOOST_IOSTREAMS_NO_LOCALE +# include +#endif +#include // pathnames, char_traits. +#include +#include // openmode, seekdir, int types. +#include +#include // seek. +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +template +class basic_file { +public: + typedef Ch char_type; + struct category + : public seekable_device_tag, + public closable_tag, + public localizable_tag + { }; + basic_file( const std::string& path, + BOOST_IOS::openmode mode = + BOOST_IOS::in | BOOST_IOS::out, + BOOST_IOS::openmode base_mode = + BOOST_IOS::in | BOOST_IOS::out ); + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); + void open( const std::string& path, + BOOST_IOS::openmode mode = + BOOST_IOS::in | BOOST_IOS::out, + BOOST_IOS::openmode base_mode = + BOOST_IOS::in | BOOST_IOS::out ); + bool is_open() const; + void close(); +#ifndef BOOST_IOSTREAMS_NO_LOCALE + void imbue(const std::locale& loc) { pimpl_->file_.pubimbue(loc); } +#endif +private: + struct impl { + impl(const std::string& path, BOOST_IOS::openmode mode) + { file_.open(path.c_str(), mode); } + ~impl() { if (file_.is_open()) file_.close(); } + BOOST_IOSTREAMS_BASIC_FILEBUF(Ch) file_; + }; + shared_ptr pimpl_; +}; + +typedef basic_file file; +typedef basic_file wfile; + +template +struct basic_file_source : private basic_file { + typedef Ch char_type; + struct category + : input_seekable, + device_tag, + closable_tag + { }; + using basic_file::read; + using basic_file::seek; + using basic_file::is_open; + using basic_file::close; + basic_file_source( const std::string& path, + BOOST_IOS::openmode mode = + BOOST_IOS::in ) + : basic_file(path, mode & ~BOOST_IOS::out, BOOST_IOS::in) + { } + void open( const std::string& path, + BOOST_IOS::openmode mode = BOOST_IOS::in ) + { + basic_file::open(path, mode & ~BOOST_IOS::out, BOOST_IOS::in); + } +}; + +typedef basic_file_source file_source; +typedef basic_file_source wfile_source; + +template +struct basic_file_sink : private basic_file { + typedef Ch char_type; + struct category + : output_seekable, + device_tag, + closable_tag + { }; + using basic_file::write; + using basic_file::seek; + using basic_file::is_open; + using basic_file::close; + basic_file_sink( const std::string& path, + BOOST_IOS::openmode mode = BOOST_IOS::out ) + : basic_file(path, mode & ~BOOST_IOS::in, BOOST_IOS::out) + { } + void open( const std::string& path, + BOOST_IOS::openmode mode = BOOST_IOS::out ) + { + basic_file::open(path, mode & ~BOOST_IOS::in, BOOST_IOS::out); + } +}; + +typedef basic_file_sink file_sink; +typedef basic_file_sink wfile_sink; + +//------------------Implementation of basic_file------------------------------// + +template +basic_file::basic_file + ( const std::string& path, BOOST_IOS::openmode mode, + BOOST_IOS::openmode base_mode ) +{ + open(path, mode, base_mode); +} + +template +inline std::streamsize basic_file::read + (char_type* s, std::streamsize n) +{ + std::streamsize result = pimpl_->file_.sgetn(s, n); + return result != 0 ? result : -1; +} + +template +inline std::streamsize basic_file::write + (const char_type* s, std::streamsize n) +{ return pimpl_->file_.sputn(s, n); } + +template +std::streampos basic_file::seek + ( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode ) +{ return iostreams::seek(pimpl_->file_, off, way); } + +template +void basic_file::open + ( const std::string& path, BOOST_IOS::openmode mode, + BOOST_IOS::openmode base_mode ) +{ + pimpl_.reset(new impl(path, mode | base_mode)); +} + +template +bool basic_file::is_open() const { return pimpl_->file_.is_open(); } + +template +void basic_file::close() { pimpl_->file_.close(); } + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#include // MSVC + +#endif // #ifndef BOOST_IOSTREAMS_FILE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/file_descriptor.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/file_descriptor.hpp new file mode 100644 index 0000000000..65f5dc092d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/file_descriptor.hpp @@ -0,0 +1,186 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Inspired by fdstream.hpp, (C) Copyright Nicolai M. Josuttis 2001, +// available at http://www.josuttis.com/cppcode/fdstream.html. + +#ifndef BOOST_IOSTREAMS_FILE_DESCRIPTOR_HPP_INCLUDED +#define BOOST_IOSTREAMS_FILE_DESCRIPTOR_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // file pathnames. +#include // intmax_t. +#include // tags. +#include +#include +#include +#include // openmode, seekdir, int types. +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +class BOOST_IOSTREAMS_DECL file_descriptor { +public: +#ifdef BOOST_IOSTREAMS_WINDOWS + typedef void* handle_type; // A.k.a HANDLE +#else + typedef int handle_type; +#endif + typedef char char_type; + struct category + : seekable_device_tag, + closable_tag + { }; + file_descriptor(); + explicit file_descriptor(handle_type fd, bool close_on_exit = false); +#ifdef BOOST_IOSTREAMS_WINDOWS + explicit file_descriptor(int fd, bool close_on_exit = false); +#endif + explicit file_descriptor( const std::string& path, + BOOST_IOS::openmode mode = + BOOST_IOS::in | BOOST_IOS::out, + BOOST_IOS::openmode base_mode = + BOOST_IOS::in | BOOST_IOS::out ); + explicit file_descriptor( const char* path, + BOOST_IOS::openmode mode = + BOOST_IOS::in | BOOST_IOS::out, + BOOST_IOS::openmode base_mode = + BOOST_IOS::in | BOOST_IOS::out ); + void open( const std::string& path, + BOOST_IOS::openmode = + BOOST_IOS::in | BOOST_IOS::out, + BOOST_IOS::openmode base_mode = + BOOST_IOS::in | BOOST_IOS::out ); + void open( const char* path, + BOOST_IOS::openmode = + BOOST_IOS::in | BOOST_IOS::out, + BOOST_IOS::openmode base_mode = + BOOST_IOS::in | BOOST_IOS::out ); + bool is_open() const { return pimpl_->flags_ != 0; } + std::streamsize read(char_type* s, std::streamsize n); + std::streamsize write(const char_type* s, std::streamsize n); + std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); + void close(); + handle_type handle() const { return pimpl_->handle_; } +private: + struct impl { + impl() : + #ifdef BOOST_IOSTREAMS_WINDOWS + handle_(reinterpret_cast(-1)), + #else + handle_(-1), + #endif + flags_(0) + { } + impl(handle_type fd, bool close_on_exit) + : handle_(fd), flags_(0) + { if (close_on_exit) flags_ |= impl::close_on_exit; } + ~impl() + { if (flags_ & close_on_exit) close_impl(*this); } + enum flags { + close_on_exit = 1, + append = 4 + }; + handle_type handle_; + int flags_; + }; + friend struct impl; + + static void close_impl(impl&); +#ifdef BOOST_IOSTREAMS_WINDOWS + static handle_type int_to_handle(int fd); +#endif + + shared_ptr pimpl_; +}; + +struct file_descriptor_source : private file_descriptor { +#ifdef BOOST_IOSTREAMS_WINDOWS + typedef void* handle_type; // A.k.a HANDLE +#else + typedef int handle_type; +#endif + typedef char char_type; + struct category + : input_seekable, + device_tag, + closable_tag + { }; + using file_descriptor::read; + using file_descriptor::seek; + using file_descriptor::open; + using file_descriptor::is_open; + using file_descriptor::close; + using file_descriptor::handle; + file_descriptor_source() { } + explicit file_descriptor_source(handle_type fd, bool close_on_exit = false) + : file_descriptor(fd, close_on_exit) + { } +#ifdef BOOST_IOSTREAMS_WINDOWS + explicit file_descriptor_source(int fd, bool close_on_exit = false) + : file_descriptor(fd, close_on_exit) + { } +#endif + explicit file_descriptor_source( const std::string& path, + BOOST_IOS::openmode m = BOOST_IOS::in ) + : file_descriptor(path, m & ~BOOST_IOS::out, BOOST_IOS::in) + { } + explicit file_descriptor_source( const char* path, + BOOST_IOS::openmode m = BOOST_IOS::in ) + : file_descriptor(path, m & ~BOOST_IOS::out, BOOST_IOS::in) + { } +}; + +struct file_descriptor_sink : private file_descriptor { +#ifdef BOOST_IOSTREAMS_WINDOWS + typedef void* handle_type; // A.k.a HANDLE +#else + typedef int handle_type; +#endif + typedef char char_type; + struct category + : output_seekable, + device_tag, + closable_tag + { }; + using file_descriptor::write; + using file_descriptor::seek; + using file_descriptor::open; + using file_descriptor::is_open; + using file_descriptor::close; + using file_descriptor::handle; + file_descriptor_sink() { } + explicit file_descriptor_sink(handle_type fd, bool close_on_exit = false) + : file_descriptor(fd, close_on_exit) + { } +#ifdef BOOST_IOSTREAMS_WINDOWS + explicit file_descriptor_sink(int fd, bool close_on_exit = false) + : file_descriptor(fd, close_on_exit) + { } +#endif + explicit file_descriptor_sink( const std::string& path, + BOOST_IOS::openmode m = BOOST_IOS::out ) + : file_descriptor(path, m & ~BOOST_IOS::in, BOOST_IOS::out) + { } + explicit file_descriptor_sink( const char* path, + BOOST_IOS::openmode m = BOOST_IOS::out ) + : file_descriptor(path, m & ~BOOST_IOS::in, BOOST_IOS::out) + { } +}; + +} } // End namespaces iostreams, boost. + +#include // pops abi_suffix.hpp pragmas + +#endif // #ifndef BOOST_IOSTREAMS_FILE_DESCRIPTOR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/mapped_file.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/mapped_file.hpp new file mode 100644 index 0000000000..3a604c71da --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/mapped_file.hpp @@ -0,0 +1,285 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// (C) Copyright Craig Henderson 2002. 'boost/memmap.hpp' from sandbox +// 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/iostreams for documentation. + +// +// This header and its accompanying source file libs/iostreams/memmap.cpp are +// an adaptation of Craig Henderson's memmory mapped file library. The +// interface has been revised significantly, but the underlying OS-specific +// code is essentially the same, with some code from Boost.Filesystem +// mixed in. (See notations in source.) +// +// The following changes have been made: +// +// 1. OS-specific code put in a .cpp file. +// 2. Name of main class changed to mapped_file. +// 3. mapped_file given an interface similar to std::fstream (open(), +// is_open(), close()) and std::string (data(), size(), begin(), end()). +// 4. An additional class readonly_mapped_file has been provided as a +// convenience. +// 5. [Obsolete: Error states are reported using filesystem::error_code.] +// 6. Read-only or read-write states are specified using ios_base::openmode. +// 7. Access to the underlying file handles and to security parameters +// has been removed. +// + +#ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED +#define BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // make sure size_t is in std. +#include // size_t. +#include // pathnames. +#include // pair. +#include // BOOST_MSVC. +#include +#include +#include +#include +#include +#include // openmode. +#include +#include +#include + +// Must come last. +#include +#include + +namespace boost { namespace iostreams { + +namespace detail { + +struct mapped_file_impl; + +} // End namespace detail. + +struct mapped_file_params { + explicit mapped_file_params() + #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) && defined(BOOST_RWSTD_VER) || \ + defined(__BORLANDC__) && defined(_CPPLIB_VER) + /**/ + : mode(std::ios_base::openmode(0)), + #else + : mode(), + #endif + offset(0), length(static_cast(-1)), + new_file_size(0), hint(0) + { } + explicit mapped_file_params(const std::string& path) + : path(path), + #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) && defined(BOOST_RWSTD_VER) || \ + defined(__BORLANDC__) && defined(_CPPLIB_VER) + mode(std::ios_base::openmode(0)), + #else + mode(), + #endif + offset(0), length(static_cast(-1)), + new_file_size(0), hint(0) + { } + std::string path; + BOOST_IOS::openmode mode; + stream_offset offset; + std::size_t length; + stream_offset new_file_size; + const char* hint; +}; + +//------------------Definition of mapped_file_source--------------------------// + +class BOOST_IOSTREAMS_DECL mapped_file_source { +private: + struct safe_bool_helper { int x; }; // From Bronek Kozicki. + typedef int safe_bool_helper::* safe_bool; + friend struct operations; +public: + typedef char char_type; + struct category + : public source_tag, + public direct_tag, + public closable_tag + { }; + typedef std::size_t size_type; + typedef const char* iterator; + BOOST_STATIC_CONSTANT(size_type, max_length = static_cast(-1)); + + mapped_file_source() { } + explicit mapped_file_source(mapped_file_params); + explicit mapped_file_source( const std::string& path, + size_type length = max_length, + boost::intmax_t offset = 0 ); + + //--------------Stream interface------------------------------------------// + + void open(mapped_file_params params); + void open( const std::string& path, + size_type length = max_length, + boost::intmax_t offset = 0 ); + bool is_open() const; + void close(); + + operator safe_bool() const; + bool operator!() const; + BOOST_IOS::openmode mode() const; + + //--------------Container interface---------------------------------------// + + size_type size() const; + const char* data() const; + iterator begin() const; + iterator end() const; + + //--------------Query admissible offsets----------------------------------// + + // Returns the allocation granularity for virtual memory. Values passed + // as offsets must be multiples of this value. + static int alignment(); +private: + friend class mapped_file; + typedef detail::mapped_file_impl impl_type; + void open_impl(mapped_file_params); + + boost::shared_ptr pimpl_; +}; + +//------------------Definition of mapped_file---------------------------------// + +class BOOST_IOSTREAMS_DECL mapped_file { +private: + typedef mapped_file_source delegate_type; + delegate_type delegate_; + friend struct operations; +public: + typedef char char_type; + struct category + : public seekable_device_tag, + public direct_tag, + public closable_tag + { }; + typedef mapped_file_source::size_type size_type; + typedef char* iterator; + typedef const char* const_iterator; + BOOST_STATIC_CONSTANT(size_type, max_length = delegate_type::max_length); + mapped_file() { } + explicit mapped_file(mapped_file_params p); + explicit mapped_file( const std::string& path, + BOOST_IOS::openmode mode = + BOOST_IOS::in | BOOST_IOS::out, + size_type length = max_length, + stream_offset offset = 0 ); + + //--------------Conversion to readonly_mapped_file------------------------// + + operator mapped_file_source&() { return delegate_; } + operator const mapped_file_source&() const { return delegate_; } + + //--------------Stream interface------------------------------------------// + + void open(mapped_file_params p); + void open( const std::string& path, + BOOST_IOS::openmode mode = + BOOST_IOS::in | BOOST_IOS::out, + size_type length = max_length, + stream_offset offset = 0 ); + bool is_open() const { return delegate_.is_open(); } + void close() { delegate_.close(); } + operator delegate_type::safe_bool() const { return delegate_; } + bool operator!() const { return !is_open(); } + BOOST_IOS::openmode mode() const { return delegate_.mode(); } + + //--------------Container interface---------------------------------------// + + size_type size() const { return delegate_.size(); } + char* data() const + { + return (mode() & BOOST_IOS::out) ? + const_cast(delegate_.data()) : + 0; + } + const char* const_data() const { return delegate_.data(); } + iterator begin() const { return data(); } + const_iterator const_begin() const { return data(); } + iterator end() const { return data() + size(); } + const_iterator const_end() const { return data() + size(); } + + //--------------Query admissible offsets----------------------------------// + + // Returns the allocation granularity for virtual memory. Values passed + // as offsets must be multiples of this value. + static int alignment() { return mapped_file_source::alignment(); } +}; + +struct BOOST_IOSTREAMS_DECL mapped_file_sink : private mapped_file { + friend struct operations; + typedef char char_type; + struct category + : public sink_tag, + public direct_tag, + public closable_tag + { }; + using mapped_file::close; + using mapped_file::size; + explicit mapped_file_sink(mapped_file_params p); + explicit mapped_file_sink( const std::string& path, + size_type length = max_length, + boost::intmax_t offset = 0 ); + void open(mapped_file_params p); + void open( const std::string& path, + size_type length = max_length, + boost::intmax_t offset = 0 ); +}; + +//------------------Specialization of direct_impl-----------------------------// + +template<> +struct operations + : detail::close_impl +{ + static std::pair + input_sequence(boost::iostreams::mapped_file_source& src) + { + return std::make_pair( const_cast(src.begin()), + const_cast(src.end()) ); + } +}; + +template<> +struct operations + : detail::close_impl +{ + static std::pair + output_sequence(boost::iostreams::mapped_file_sink& sink) + { + return std::make_pair(sink.begin(), sink.end()); + } +}; + +template<> +struct operations + : detail::close_impl +{ + static std::pair + input_sequence(boost::iostreams::mapped_file& file) + { + return std::make_pair(file.begin(), file.end()); + } + static std::pair + output_sequence(boost::iostreams::mapped_file& file) + { + return std::make_pair(file.begin(), file.end()); + } +}; + +} } // End namespaces iostreams, boost. + +#include // pops abi_suffix.hpp pragmas +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/null.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/null.hpp new file mode 100644 index 0000000000..6a723218e6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/device/null.hpp @@ -0,0 +1,66 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2004-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Inspired by Daryle Walker's nullbuf from his More I/O submission. + +#ifndef BOOST_IOSTREAMS_NULL_HPP_INCLUDED +#define BOOST_IOSTREAMS_NULL_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // openmode, streamsize. +#include + +namespace boost { namespace iostreams { + +template +class basic_null_device { +public: + typedef Ch char_type; + struct category + : public Mode, + public device_tag, + public closable_tag + { }; + std::streamsize read(Ch*, std::streamsize) { return 0; } + std::streamsize write(const Ch*, std::streamsize n) { return n; } + std::streampos seek( stream_offset, BOOST_IOS::seekdir, + BOOST_IOS::openmode = + BOOST_IOS::in | BOOST_IOS::out ) + { return -1; } + void close() { } + void close(BOOST_IOS::openmode) { } +}; + +template +struct basic_null_source : private basic_null_device { + typedef Ch char_type; + typedef source_tag category; + using basic_null_device::read; + using basic_null_device::close; +}; + +typedef basic_null_source null_source; +typedef basic_null_source wnull_source; + +template +struct basic_null_sink : private basic_null_device { + typedef Ch char_type; + typedef sink_tag category; + using basic_null_device::write; + using basic_null_device::close; +}; + +typedef basic_null_sink null_sink; +typedef basic_null_sink wnull_sink; + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_NULL_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/aggregate.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/aggregate.hpp new file mode 100644 index 0000000000..868b436ee6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/aggregate.hpp @@ -0,0 +1,168 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_AGGREGATE_FILTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_AGGREGATE_FILTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // copy, min. +#include +#include // back_inserter +#include +#include // default_device_buffer_size +#include +#include +#include // openmode, streamsize. +#include +#include // check_eof +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +// +// Template name: aggregate_filter. +// Template paramters: +// Ch - The character type. +// Alloc - The allocator type. +// Description: Utility for defining DualUseFilters which filter an +// entire stream at once. To use, override the protected virtual +// member do_filter. +// Note: This filter should not be copied while it is in use. +// +template > +class aggregate_filter { +public: + typedef Ch char_type; + struct category + : dual_use, + filter_tag, + multichar_tag, + closable_tag + { }; + aggregate_filter() : ptr_(0), state_(0) { } + virtual ~aggregate_filter() { } + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + using namespace std; + assert(!(state_ & f_write)); + state_ |= f_read; + if (!(state_ & f_eof)) + do_read(src); + std::streamsize amt = + (std::min)(n, static_cast(data_.size() - ptr_)); + if (amt) { + BOOST_IOSTREAMS_CHAR_TRAITS(char_type)::copy(s, &data_[ptr_], amt); + ptr_ += amt; + } + return detail::check_eof(amt); + } + + template + std::streamsize write(Sink&, const char_type* s, std::streamsize n) + { + assert(!(state_ & f_read)); + state_ |= f_write; + data_.insert(data_.end(), s, s + n); + return n; + } + + template + void close(Sink& sink, BOOST_IOS::openmode which) + { + if ((state_ & f_read) != 0 && which == BOOST_IOS::in) + close_impl(); + if ((state_ & f_write) != 0 && which == BOOST_IOS::out) { + try { + vector_type filtered; + do_filter(data_, filtered); + do_write( + sink, &filtered[0], + static_cast(filtered.size()) + ); + } catch (...) { + close_impl(); + throw; + } + close_impl(); + } + } + +protected: + typedef std::vector vector_type; + typedef typename vector_type::size_type size_type; +private: + virtual void do_filter(const vector_type& src, vector_type& dest) = 0; + virtual void do_close() { } + + template + void do_read(Source& src) + { + using std::streamsize; + vector_type data; + while (true) { + const std::streamsize size = default_device_buffer_size; + Ch buf[size]; + std::streamsize amt; + if ((amt = boost::iostreams::read(src, buf, size)) == -1) + break; + data.insert(data.end(), buf, buf + amt); + } + do_filter(data, data_); + state_ |= f_eof; + } + + template + void do_write(Sink& sink, const char* s, std::streamsize n) + { + typedef typename iostreams::category_of::type category; + typedef is_convertible can_write; + do_write(sink, s, n, can_write()); + } + + template + void do_write(Sink& sink, const char* s, std::streamsize n, mpl::true_) + { iostreams::write(sink, s, n); } + + template + void do_write(Sink&, const char*, std::streamsize, mpl::false_) { } + + void close_impl() + { + data_.clear(); + ptr_ = 0; + state_ = 0; + do_close(); + } + + enum flag_type { + f_read = 1, + f_write = f_read << 1, + f_eof = f_write << 1 + }; + + // Note: typically will not be copied while vector contains data. + vector_type data_; + size_type ptr_; + int state_; +}; +BOOST_IOSTREAMS_PIPABLE(aggregate_filter, 1) + +} } // End namespaces iostreams, boost. + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_AGGREGATE_FILTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/bzip2.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/bzip2.hpp new file mode 100644 index 0000000000..982d432bf3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/bzip2.hpp @@ -0,0 +1,397 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Note: custom allocators are not supported on VC6, since that compiler +// had trouble finding the function zlib_base::do_init. + +#ifndef BOOST_IOSTREAMS_BZIP2_HPP_INCLUDED +#define BOOST_IOSTREAMS_BZIP2_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // allocator. +#include // bad_alloc. +#include // MSVC, STATIC_CONSTANT, DEDUCED_TYPENAME, DINKUM. +#include +#include // buffer size. +#include +#include +#include +#include +#include // failure, streamsize. +#include +#include +#include + +// Must come last. +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4251 4231 4660) +#endif +#include + +// Temporary fix. +#undef small + +namespace boost { namespace iostreams { + +namespace bzip2 { + + // Typedefs. + +typedef void* (*alloc_func)(void*, int, int); +typedef void (*free_func)(void*, void*); + + // Status codes + +BOOST_IOSTREAMS_DECL extern const int ok; +BOOST_IOSTREAMS_DECL extern const int run_ok; +BOOST_IOSTREAMS_DECL extern const int flush_ok; +BOOST_IOSTREAMS_DECL extern const int finish_ok; +BOOST_IOSTREAMS_DECL extern const int stream_end; +BOOST_IOSTREAMS_DECL extern const int sequence_error; +BOOST_IOSTREAMS_DECL extern const int param_error; +BOOST_IOSTREAMS_DECL extern const int mem_error; +BOOST_IOSTREAMS_DECL extern const int data_error; +BOOST_IOSTREAMS_DECL extern const int data_error_magic; +BOOST_IOSTREAMS_DECL extern const int io_error; +BOOST_IOSTREAMS_DECL extern const int unexpected_eof; +BOOST_IOSTREAMS_DECL extern const int outbuff_full; +BOOST_IOSTREAMS_DECL extern const int config_error; + + // Action codes + +BOOST_IOSTREAMS_DECL extern const int finish; +BOOST_IOSTREAMS_DECL extern const int run; + + // Default values + +const int default_block_size = 9; +const int default_work_factor = 30; +const bool default_small = false; + +} // End namespace bzip2. + +// +// Class name: bzip2_params. +// Description: Encapsulates the parameters passed to deflateInit2 +// to customize compression. +// +struct bzip2_params { + + // Non-explicit constructor for compression. + bzip2_params( int block_size = bzip2::default_block_size, + int work_factor = bzip2::default_work_factor ) + : block_size(block_size), work_factor(work_factor) + { } + + // Constructor for decompression. + bzip2_params(bool small) + : small(small), work_factor(0) + { } + + union { + int block_size; // For compression. + bool small; // For decompression. + }; + int work_factor; +}; + +// +// Class name: bzip2_error. +// Description: Subclass of std::ios_base::failure thrown to indicate +// bzip2 errors other than out-of-memory conditions. +// +class BOOST_IOSTREAMS_DECL bzip2_error : public BOOST_IOSTREAMS_FAILURE { +public: + explicit bzip2_error(int error); + int error() const { return error_; } + static void check(int error); +private: + int error_; +}; + +namespace detail { + +template +struct bzip2_allocator_traits { +#ifndef BOOST_NO_STD_ALLOCATOR + typedef typename Alloc::template rebind::other type; +#else + typedef std::allocator type; +#endif +}; + +template< typename Alloc, + typename Base = // VC6 workaround (C2516) + BOOST_DEDUCED_TYPENAME bzip2_allocator_traits::type > +struct bzip2_allocator : private Base { +private: + typedef typename Base::size_type size_type; +public: + BOOST_STATIC_CONSTANT(bool, custom = + (!is_same, Base>::value)); + typedef typename bzip2_allocator_traits::type allocator_type; + static void* allocate(void* self, int items, int size); + static void deallocate(void* self, void* address); +}; + +class BOOST_IOSTREAMS_DECL bzip2_base { +public: + typedef char char_type; +protected: + bzip2_base(const bzip2_params& params); + ~bzip2_base(); + bzip2_params& params() { return params_; } + bool& ready() { return ready_; } + template + void init( bool compress, + bzip2_allocator& alloc ) + { + bool custom = bzip2_allocator::custom; + do_init( compress, + #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + custom ? bzip2_allocator::allocate : 0, + custom ? bzip2_allocator::deallocate : 0, + #endif + custom ? &alloc : 0 ); + } + void before( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end ); + void after(const char*& src_begin, char*& dest_begin); + int compress(int action); + int decompress(); + void end(bool compress); +private: + void do_init( bool compress, + #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + bzip2::alloc_func, + bzip2::free_func, + #endif + void* derived ); + bzip2_params params_; + void* stream_; // Actual type: bz_stream*. + bool ready_; +}; + +// +// Template name: bzip2_compressor_impl +// Description: Model of SymmetricFilter implementing compression by +// delegating to the libbzip2 function BZ_bzCompress. +// +template > +class bzip2_compressor_impl + : public bzip2_base, + #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) + public + #endif + bzip2_allocator +{ +public: + bzip2_compressor_impl(const bzip2_params&); + bool filter( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool flush ); + void close(); +private: + void init(); +}; + +// +// Template name: bzip2_compressor +// Description: Model of SymmetricFilter implementing decompression by +// delegating to the libbzip2 function BZ_bzDecompress. +// +template > +class bzip2_decompressor_impl + : public bzip2_base, + #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) + public + #endif + bzip2_allocator +{ +public: + bzip2_decompressor_impl(bool small = bzip2::default_small); + bool filter( const char*& begin_in, const char* end_in, + char*& begin_out, char* end_out, bool flush ); + void close(); +private: + void init(); + bool eof_; // Guard to make sure filter() isn't called after it returns false. +}; + +} // End namespace detail. + +// +// Template name: bzip2_compressor +// Description: Model of InputFilter and OutputFilter implementing +// compression using libbzip2. +// +template > +struct basic_bzip2_compressor + : symmetric_filter, Alloc> +{ +private: + typedef detail::bzip2_compressor_impl impl_type; + typedef symmetric_filter base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + basic_bzip2_compressor( const bzip2_params& = bzip2::default_block_size, + int buffer_size = default_device_buffer_size ); +}; +BOOST_IOSTREAMS_PIPABLE(basic_bzip2_compressor, 1) + +typedef basic_bzip2_compressor<> bzip2_compressor; + +// +// Template name: bzip2_decompressor +// Description: Model of InputFilter and OutputFilter implementing +// decompression using libbzip2. +// +template > +struct basic_bzip2_decompressor + : symmetric_filter, Alloc> +{ +private: + typedef detail::bzip2_decompressor_impl impl_type; + typedef symmetric_filter base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + basic_bzip2_decompressor( bool small = bzip2::default_small, + int buffer_size = default_device_buffer_size ); +}; +BOOST_IOSTREAMS_PIPABLE(basic_bzip2_decompressor, 1) + +typedef basic_bzip2_decompressor<> bzip2_decompressor; + +//----------------------------------------------------------------------------// + +//------------------Implementation of bzip2_allocator-------------------------// + +namespace detail { + +template +void* bzip2_allocator::allocate(void* self, int items, int size) +{ + size_type len = items * size; + char* ptr = + static_cast(self)->allocate + (len + sizeof(size_type) + #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) + , (char*)0 + #endif + ); + *reinterpret_cast(ptr) = len; + return ptr + sizeof(size_type); +} + +template +void bzip2_allocator::deallocate(void* self, void* address) +{ + char* ptr = reinterpret_cast(address) - sizeof(size_type); + size_type len = *reinterpret_cast(ptr) + sizeof(size_type); + static_cast(self)->deallocate(ptr, len); +} + +//------------------Implementation of bzip2_compressor_impl-------------------// + +template +bzip2_compressor_impl::bzip2_compressor_impl(const bzip2_params& p) + : bzip2_base(p) { } + +template +bool bzip2_compressor_impl::filter + ( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool flush ) +{ + if (!ready()) init(); + before(src_begin, src_end, dest_begin, dest_end); + int result = compress(flush ? bzip2::finish : bzip2::run); + after(src_begin, dest_begin); + bzip2_error::check(result); + return result != bzip2::stream_end; +} + +template +void bzip2_compressor_impl::close() +{ + end(true); +} + +template +inline void bzip2_compressor_impl::init() +{ bzip2_base::init(true, static_cast&>(*this)); } + +//------------------Implementation of bzip2_decompressor_impl-----------------// + +template +bzip2_decompressor_impl::bzip2_decompressor_impl(bool small) + : bzip2_base(bzip2_params(small)), eof_(false) { } + +template +bool bzip2_decompressor_impl::filter + ( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool /* flush */ ) +{ + if (!ready()) + init(); + if (eof_) + return false; + before(src_begin, src_end, dest_begin, dest_end); + int result = decompress(); + after(src_begin, dest_begin); + bzip2_error::check(result); + return !(eof_ = result == bzip2::stream_end); +} + +template +void bzip2_decompressor_impl::close() +{ + try { + end(false); + } catch (...) { + eof_ = false; + throw; + } + eof_ = false; +} + +template +inline void bzip2_decompressor_impl::init() +{ bzip2_base::init(false, static_cast&>(*this)); } +} // End namespace detail. + +//------------------Implementation of bzip2_decompressor----------------------// + +template +basic_bzip2_compressor::basic_bzip2_compressor + (const bzip2_params& p, int buffer_size) + : base_type(buffer_size, p) + { } + +//------------------Implementation of bzip2_decompressor----------------------// + +template +basic_bzip2_decompressor::basic_bzip2_decompressor + (bool small, int buffer_size) + : base_type(buffer_size, small) + { } + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#include // Pops abi_suffix.hpp pragmas. +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_IOSTREAMS_BZIP2_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/counter.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/counter.hpp new file mode 100644 index 0000000000..e47cba9417 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/counter.hpp @@ -0,0 +1,82 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_COUNTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_COUNTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // count. +#include +#include +#include +#include + +// Must come last. +#include // VC7.1 C4244. + +namespace boost { namespace iostreams { + +// +// Template name: basic_counter. +// Template paramters: +// Ch - The character type. +// Description: Filter which counts lines and characters. +// +template +class basic_counter { +public: + typedef Ch char_type; + struct category + : dual_use, + filter_tag, + multichar_tag, + optimally_buffered_tag + { }; + explicit basic_counter(int first_line = 0, int first_char = 0) + : lines_(first_line), chars_(first_char) + { } + int lines() const { return lines_; } + int characters() const { return chars_; } + std::streamsize optimal_buffer_size() const { return 0; } + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + std::streamsize result = iostreams::read(src, s, n); + if (result == -1) + return -1; + lines_ += std::count(s, s + result, char_traits::newline()); + chars_ += result; + return result; + } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { + std::streamsize result = iostreams::write(snk, s, n); + lines_ += std::count(s, s + result, char_traits::newline()); + chars_ += result; + return result; + } +private: + int lines_; + int chars_; +}; +BOOST_IOSTREAMS_PIPABLE(basic_counter, 1) + + +typedef basic_counter counter; +typedef basic_counter wcounter; + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_COUNTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/gzip.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/gzip.hpp new file mode 100644 index 0000000000..17bd1c4708 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/gzip.hpp @@ -0,0 +1,604 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains the definitions of the class templates gzip_compressor and +// gzip_decompressor for reading and writing files in the gzip file format +// (RFC 1952). Based in part on work of Jonathan de Halleux; see [...] + +#ifndef BOOST_IOSTREAMS_GZIP_HPP_INCLUDED +#define BOOST_IOSTREAMS_GZIP_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // STATIC_CONSTANT, STDC_NAMESPACE, + // DINKUMWARE_STDLIB, __STL_CONFIG_H. +#include // min. +#include // EOF. +#include // size_t. +#include // std::time_t. +#include // allocator. +#include // Put size_t in std. +#include +#include // uint8_t, uint32_t. +#include // buffer size. +#include +#include +#include +#include // failure. +#include +#include +#include +#include + +// Must come last. +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable: 4309) // Truncation of constant value. +#endif + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::time_t; } +#endif + +namespace boost { namespace iostreams { + +namespace gzip { + +using namespace boost::iostreams::zlib; + + // Error codes used by gzip_error. + +const int zlib_error = 1; +const int bad_crc = 2; // Recorded crc doesn't match data. +const int bad_length = 3; // Recorded length doesn't match data. +const int bad_header = 4; // Malformed header. +const int bad_footer = 5; // Malformed footer. + +namespace magic { + + // Magic numbers used by gzip header. + +const int id1 = 0x1f; +const int id2 = 0x8b; + +} // End namespace magic. + +namespace method { + + // Codes used for the 'CM' byte of the gzip header. + +const int deflate = 8; + +} // End namespace method. + +namespace flags { + + // Codes used for the 'FLG' byte of the gzip header. + +const int text = 1; +const int header_crc = 2; +const int extra = 4; +const int name = 8; +const int comment = 16; + +} // End namespace flags. + +namespace extra_flags { + + // Codes used for the 'XFL' byte of the gzip header. + +const int best_compression = 2; +const int best_speed = 4; + +} // End namespace extra_flags. + + // Codes used for the 'OS' byte of the gzip header. + +const int os_fat = 0; +const int os_amiga = 1; +const int os_vms = 2; +const int os_unix = 3; +const int os_vm_cms = 4; +const int os_atari = 5; +const int os_hpfs = 6; +const int os_macintosh = 7; +const int os_z_system = 8; +const int os_cp_m = 9; +const int os_tops_20 = 10; +const int os_ntfs = 11; +const int os_qdos = 12; +const int os_acorn = 13; +const int os_unknown = 255; + +} // End namespace gzip. + +// +// Class name: gzip_params. +// Description: Subclass of zlib_params with an additional field +// representing a file name. +// +struct gzip_params : zlib_params { + + // Non-explicit constructor. + gzip_params( int level = gzip::default_compression, + int method = gzip::deflated, + int window_bits = gzip::default_window_bits, + int mem_level = gzip::default_mem_level, + int strategy = gzip::default_strategy, + std::string file_name = "", + std::string comment = "", + std::time_t mtime = 0 ) + : zlib_params(level, method, window_bits, mem_level, strategy), + file_name(file_name), comment(comment), mtime(mtime) + { } + std::string file_name; + std::string comment; + std::time_t mtime; +}; + +// +// Class name: gzip_error. +// Description: Subclass of std::ios_base::failure thrown to indicate +// zlib errors other than out-of-memory conditions. +// +class gzip_error : public BOOST_IOSTREAMS_FAILURE { +public: + explicit gzip_error(int error) + : BOOST_IOSTREAMS_FAILURE("gzip error"), + error_(error), zlib_error_code_(zlib::okay) { } + explicit gzip_error(const zlib_error& e) + : BOOST_IOSTREAMS_FAILURE("gzip error"), + error_(gzip::zlib_error), zlib_error_code_(e.error()) + { } + int error() const { return error_; } + int zlib_error_code() const { return zlib_error_code_; } +private: + int error_; + int zlib_error_code_; +}; + +// +// Template name: gzip_compressor +// Description: Model of OutputFilter implementing compression in the +// gzip format. +// +template > +class basic_gzip_compressor : basic_zlib_compressor { +private: + typedef basic_zlib_compressor base_type; +public: + typedef char char_type; + struct category + : dual_use, + filter_tag, + multichar_tag, + closable_tag + { }; + basic_gzip_compressor( const gzip_params& = gzip::default_compression, + int buffer_size = default_device_buffer_size ); + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + std::streamsize result = 0; + + // Read header. + if (!(flags_ & f_header_done)) + result += read_string(s, n, header_); + + // Read body. + if (!(flags_ & f_body_done)) { + + // Read from basic_zlib_filter. + std::streamsize amt = base_type::read(src, s + result, n - result); + if (amt != -1) { + result += amt; + if (amt < n - result) { // Double-check for EOF. + amt = base_type::read(src, s + result, n - result); + if (amt != -1) + result += amt; + } + } + if (amt == -1) + prepare_footer(); + } + + // Read footer. + if ((flags_ & f_body_done) != 0 && result < n) + result += read_string(s + result, n - result, footer_); + + return result != 0 ? result : -1; + } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { + if (!(flags_ & f_header_done)) { + std::streamsize amt = + static_cast(header_.size() - offset_); + offset_ += boost::iostreams::write(snk, header_.data() + offset_, amt); + if (offset_ == header_.size()) + flags_ |= f_header_done; + else + return 0; + } + return base_type::write(snk, s, n); + } + + template + void close(Sink& snk, BOOST_IOS::openmode m) + { + if (m == BOOST_IOS::out) { + try { + + // Close zlib compressor. + base_type::close(snk, BOOST_IOS::out); + + if (flags_ & f_header_done) { + + // Write final fields of gzip file format. + write_long(this->crc(), snk); + write_long(this->total_in(), snk); + } + + } catch (...) { + close_impl(); + throw; + } + close_impl(); + } else { + close_impl(); + } + } +private: + static gzip_params normalize_params(gzip_params p); + void prepare_footer(); + std::streamsize read_string(char* s, std::streamsize n, std::string& str); + + template + static void write_long(long n, Sink& next) + { + boost::iostreams::put(next, static_cast(0xFF & n)); + boost::iostreams::put(next, static_cast(0xFF & (n >> 8))); + boost::iostreams::put(next, static_cast(0xFF & (n >> 16))); + boost::iostreams::put(next, static_cast(0xFF & (n >> 24))); + } + + void close_impl() + { + #if BOOST_WORKAROUND(__GNUC__, == 2) && defined(__STL_CONFIG_H) || \ + BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) \ + /**/ + footer_.erase(0, std::string::npos); + #else + footer_.clear(); + #endif + offset_ = 0; + flags_ = 0; + } + + enum flag_type { + f_header_done = 1, + f_body_done = f_header_done << 1, + f_footer_done = f_body_done << 1 + }; + std::string header_; + std::string footer_; + std::size_t offset_; + int flags_; +}; +BOOST_IOSTREAMS_PIPABLE(basic_gzip_compressor, 1) + +typedef basic_gzip_compressor<> gzip_compressor; + +// +// Template name: basic_gzip_decompressor +// Description: Model of InputFilter implementing compression in the +// gzip format. +// +template > +class basic_gzip_decompressor : basic_zlib_decompressor { +public: + typedef char char_type; + struct category + : multichar_input_filter_tag, + closable_tag + { }; + basic_gzip_decompressor( int window_bits = gzip::default_window_bits, + int buffer_size = default_device_buffer_size ); + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + if ((flags_ & f_header_read) == 0) { + non_blocking_adapter nb(src); + read_header(nb); + flags_ |= f_header_read; + } + + if ((flags_ & f_footer_read) != 0) + return -1; + + try { + std::streamsize result = 0; + std::streamsize amt; + if ((amt = base_type::read(src, s, n)) != -1) { + result += amt; + if (amt < n) { // Double check for EOF. + amt = base_type::read(src, s + result, n - result); + if (amt != -1) + result += amt; + } + } + if (amt == -1) { + non_blocking_adapter nb(src); + read_footer(nb); + flags_ |= f_footer_read; + } + return result; + } catch (const zlib_error& e) { + throw gzip_error(e); + } + } + + template + void close(Source& src) + { + try { + base_type::close(src, BOOST_IOS::in); + } catch (const zlib_error& e) { + flags_ = 0; + throw gzip_error(e); + } + flags_ = 0; + } + + std::string file_name() const { return file_name_; } + std::string comment() const { return comment_; } + bool text() const { return (flags_ & gzip::flags::text) != 0; } + int os() const { return os_; } + std::time_t mtime() const { return mtime_; } +private: + typedef basic_zlib_decompressor base_type; + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char) traits_type; + static bool is_eof(int c) { return traits_type::eq_int_type(c, EOF); } + static gzip_params make_params(int window_bits); + + template + static uint8_t read_uint8(Source& src, int error) + { + int c; + if ((c = boost::iostreams::get(src)) == EOF || c == WOULD_BLOCK) + throw gzip_error(error); + return static_cast(traits_type::to_char_type(c)); + } + + template + static uint32_t read_uint32(Source& src, int error) + { + uint8_t b1 = read_uint8(src, error); + uint8_t b2 = read_uint8(src, error); + uint8_t b3 = read_uint8(src, error); + uint8_t b4 = read_uint8(src, error); + return b1 + (b2 << 8) + (b3 << 16) + (b4 << 24); + } + + template + std::string read_string(Source& src) + { + std::string result; + while (true) { + int c; + if (is_eof(c = boost::iostreams::get(src))) + throw gzip_error(gzip::bad_header); + else if (c == 0) + return result; + else + result += static_cast(c); + } + } + + template + void read_header(Source& src) // Source is non-blocking. + { + // Reset saved values. + #if BOOST_WORKAROUND(__GNUC__, == 2) && defined(__STL_CONFIG_H) || \ + BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) \ + /**/ + file_name_.erase(0, std::string::npos); + comment_.erase(0, std::string::npos); + #else + file_name_.clear(); + comment_.clear(); + #endif + os_ = gzip::os_unknown; + mtime_ = 0; + + int flags; + + // Read header, without checking header crc. + if ( boost::iostreams::get(src) != gzip::magic::id1 || // ID1. + boost::iostreams::get(src) != gzip::magic::id2 || // ID2. + is_eof(boost::iostreams::get(src)) || // CM. + is_eof(flags = boost::iostreams::get(src)) ) // FLG. + { + throw gzip_error(gzip::bad_header); + } + mtime_ = read_uint32(src, gzip::bad_header); // MTIME. + read_uint8(src, gzip::bad_header); // XFL. + os_ = read_uint8(src, gzip::bad_header); // OS. + if (flags & boost::iostreams::gzip::flags::text) + flags_ |= f_text; + + // Skip extra field. (From J. Halleaux; see note at top.) + if (flags & gzip::flags::extra) { + int length = + static_cast( + read_uint8(src, gzip::bad_header) + + (read_uint8(src, gzip::bad_header) << 8) + ); + // length is garbage if EOF but the loop below will quit anyway. + do { } + while (length-- != 0 && !is_eof(boost::iostreams::get(src))); + } + + if (flags & gzip::flags::name) // Read file name. + file_name_ = read_string(src); + if (flags & gzip::flags::comment) // Read comment. + comment_ = read_string(src); + if (flags & gzip::flags::header_crc) { // Skip header crc. + read_uint8(src, gzip::bad_header); + read_uint8(src, gzip::bad_header); + } + } + + template + void read_footer(Source& src) + { + typename base_type::string_type footer = + this->unconsumed_input(); + int c; + while (!is_eof(c = boost::iostreams::get(src))) + footer += c; + detail::range_adapter + rng(footer.begin(), footer.end()); + if (read_uint32(rng, gzip::bad_footer) != this->crc()) + throw gzip_error(gzip::bad_crc); + if (static_cast(read_uint32(rng, gzip::bad_footer)) != this->total_out()) + throw gzip_error(gzip::bad_length); + } + enum flag_type { + f_header_read = 1, + f_footer_read = f_header_read << 1, + f_text = f_footer_read << 1 + }; + std::string file_name_; + std::string comment_; + int os_; + std::time_t mtime_; + int flags_; +}; +BOOST_IOSTREAMS_PIPABLE(basic_gzip_decompressor, 1) + +typedef basic_gzip_decompressor<> gzip_decompressor; + +//------------------Implementation of gzip_compressor-------------------------// + +template +basic_gzip_compressor::basic_gzip_compressor + (const gzip_params& p, int buffer_size) + : base_type(normalize_params(p), buffer_size), + offset_(0), flags_(0) +{ + // Calculate gzip header. + bool has_name = !p.file_name.empty(); + bool has_comment = !p.comment.empty(); + + std::string::size_type length = + 10 + + (has_name ? p.file_name.size() + 1 : 0) + + (has_comment ? p.comment.size() + 1 : 0); + // + 2; // Header crc confuses gunzip. + int flags = + //gzip::flags::header_crc + + (has_name ? gzip::flags::name : 0) + + (has_comment ? gzip::flags::comment : 0); + int extra_flags = + ( p.level == zlib::best_compression ? + gzip::extra_flags::best_compression : + 0 ) + + ( p.level == zlib::best_speed ? + gzip::extra_flags::best_speed : + 0 ); + header_.reserve(length); + header_ += gzip::magic::id1; // ID1. + header_ += gzip::magic::id2; // ID2. + header_ += gzip::method::deflate; // CM. + header_ += static_cast(flags); // FLG. + header_ += static_cast(0xFF & p.mtime); // MTIME. + header_ += static_cast(0xFF & (p.mtime >> 8)); + header_ += static_cast(0xFF & (p.mtime >> 16)); + header_ += static_cast(0xFF & (p.mtime >> 24)); + header_ += static_cast(extra_flags); // XFL. + header_ += static_cast(gzip::os_unknown); // OS. + if (has_name) { + header_ += p.file_name; + header_ += '\0'; + } + if (has_comment) { + header_ += p.comment; + header_ += '\0'; + } +} + +template +gzip_params basic_gzip_compressor::normalize_params(gzip_params p) +{ + p.noheader = true; + p.calculate_crc = true; + return p; +} + +template +void basic_gzip_compressor::prepare_footer() +{ + boost::iostreams::back_insert_device out(footer_); + write_long(this->crc(), out); + write_long(this->total_in(), out); + flags_ |= f_body_done; + offset_ = 0; +} + +template +std::streamsize basic_gzip_compressor::read_string + (char* s, std::streamsize n, std::string& str) +{ + std::streamsize avail = + static_cast(str.size() - offset_); + std::streamsize amt = (std::min)(avail, n); + std::copy( str.data() + offset_, + str.data() + offset_ + amt, + s ); + offset_ += amt; + if ( !(flags_ & f_header_done) && + offset_ == static_cast(str.size()) ) + { + flags_ |= f_header_done; + } + return amt; +} + +//------------------Implementation of gzip_decompressor-----------------------// + +template +basic_gzip_decompressor::basic_gzip_decompressor + (int window_bits, int buffer_size) + : base_type(make_params(window_bits), buffer_size), + os_(gzip::os_unknown), mtime_(0), flags_(0) + { } + +template +gzip_params basic_gzip_decompressor::make_params(int window_bits) +{ + gzip_params p; + p.window_bits = window_bits; + p.noheader = true; + p.calculate_crc = true; + return p; +} + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#if defined(BOOST_MSVC) +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_IOSTREAMS_GZIP_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/line.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/line.hpp new file mode 100644 index 0000000000..5f5cb46065 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/line.hpp @@ -0,0 +1,220 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_LINE_FILTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_LINE_FILTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // min. +#include +#include // allocator. +#include +#include // BOOST_STATIC_CONSTANT. +#include +#include // openmode, streamsize. +#include // check_eof +#include +#include + +// Must come last. +#include // VC7.1 C4244. + +namespace boost { namespace iostreams { + +// +// Template name: line_filter. +// Template paramters: +// Ch - The character type. +// Alloc - The allocator type. +// Description: Filter which processes data one line at a time. +// +template< typename Ch, + typename Alloc = + #if BOOST_WORKAROUND(__GNUC__, < 3) + typename std::basic_string::allocator_type + #else + std::allocator + #endif + > +class basic_line_filter { +private: + typedef typename std::basic_string::traits_type string_traits; +public: + typedef Ch char_type; + typedef char_traits traits_type; + typedef std::basic_string< + Ch, + string_traits, + Alloc + > string_type; + struct category + : dual_use, + filter_tag, + multichar_tag, + closable_tag + { }; +protected: + basic_line_filter() : pos_(string_type::npos), state_(0) { } +public: + virtual ~basic_line_filter() { } + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + using namespace std; + assert(!(state_ & f_write)); + state_ |= f_read; + + // Handle unfinished business. + std::streamsize result = 0; + if (!cur_line_.empty() && (result = read_line(s, n)) == n) + return n; + + typename traits_type::int_type status = traits_type::good(); + while (result < n && !traits_type::is_eof(status)) { + + // Call next_line() to retrieve a line of filtered test, and + // read_line() to copy it into buffer s. + if (traits_type::would_block(status = next_line(src))) + return result; + result += read_line(s + result, n - result); + } + + return detail::check_eof(result); + } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { + using namespace std; + assert(!(state_ & f_read)); + state_ |= f_write; + + // Handle unfinished business. + if (pos_ != string_type::npos && !write_line(snk)) + return 0; + + const char_type *cur = s, *next; + while (true) { + + // Search for the next full line in [cur, s + n), filter it + // and write it to snk. + typename string_type::size_type rest = n - (cur - s); + if ((next = traits_type::find(cur, rest, traits_type::newline()))) { + cur_line_.append(cur, next - cur); + cur = next + 1; + if (!write_line(snk)) + return static_cast(cur - s); + } else { + cur_line_.append(cur, rest); + return n; + } + } + } + + template + void close(Sink& snk, BOOST_IOS::openmode which) + { + if ((state_ & f_read) && which == BOOST_IOS::in) + close_impl(); + + if ((state_ & f_write) && which == BOOST_IOS::out) { + try { + if (!cur_line_.empty()) + write_line(snk); + } catch (...) { + try { + close_impl(); + } catch (...) { } + throw; + } + close_impl(); + } + } +private: + virtual string_type do_filter(const string_type& line) = 0; + + // Copies filtered characters fron the current line into + // the given buffer. + std::streamsize read_line(char_type* s, std::streamsize n) + { + using namespace std; + std::streamsize result = + (std::min) (n, static_cast(cur_line_.size())); + traits_type::copy(s, cur_line_.data(), result); + cur_line_.erase(0, result); + return result; + } + + // Attempts to retrieve a line of text from the given source; returns + // an int_type as a good/eof/would_block status code. + template + typename traits_type::int_type next_line(Source& src) + { + using namespace std; + typename traits_type::int_type c; + while ( traits_type::is_good(c = iostreams::get(src)) && + c != traits_type::newline() ) + { + cur_line_ += traits_type::to_int_type(c); + } + if (!traits_type::would_block(c)) { + if (!cur_line_.empty() || c == traits_type::newline()) + cur_line_ = do_filter(cur_line_); + if (c == traits_type::newline()) + cur_line_ += c; + } + return c; // status indicator. + } + + // Filters the current line and attemps to write it to the given sink. + // Returns true for success. + template + bool write_line(Sink& snk) + { + string_type line = do_filter(cur_line_) + traits_type::newline(); + std::streamsize amt = static_cast(line.size()); + bool result = iostreams::write(snk, line.data(), amt) == amt; + if (result) + clear(); + return result; + } + + void close_impl() + { + clear(); + state_ = 0; + } + + void clear() + { + cur_line_.erase(); + pos_ = string_type::npos; + } + + enum flag_type { + f_read = 1, + f_write = f_read << 1 + }; + + string_type cur_line_; + typename string_type::size_type pos_; + int state_; +}; +BOOST_IOSTREAMS_PIPABLE(basic_line_filter, 2) + +typedef basic_line_filter line_filter; +typedef basic_line_filter wline_filter; + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_LINE_FILTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/newline.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/newline.hpp new file mode 100644 index 0000000000..2e6d553fd6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/newline.hpp @@ -0,0 +1,441 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// NOTE: I hope to replace the current implementation with a much simpler +// one. + +#ifndef BOOST_IOSTREAMS_NEWLINE_FILTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_NEWLINE_FILTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include // logic_error. +#include // BOOST_STATIC_CONSTANT. +#include +#include +#include // BOOST_IOSTREAMS_FAILURE +#include // get +#include // put +#include +#include +#include +#include + +// Must come last. +#include + +#define BOOST_IOSTREAMS_ASSERT_UNREACHABLE(val) \ + (assert("unreachable code" == 0), val) \ + /**/ + +namespace boost { namespace iostreams { + +namespace newline { + +const char CR = 0x0D; +const char LF = 0x0A; + + // Flags for configuring newline_filter. + +// Exactly one of the following three flags must be present. + +const int posix = 1; // Use CR as line separator. +const int mac = 2; // Use LF as line separator. +const int dos = 4; // Use CRLF as line separator. +const int mixed = 8; // Mixed line endings. +const int final_newline = 16; +const int platform_mask = posix | dos | mac; + +} // End namespace newline. + +namespace detail { + +class newline_base { +public: + bool is_posix() const + { + return !is_mixed() && (flags_ & newline::posix) != 0; + } + bool is_dos() const + { + return !is_mixed() && (flags_ & newline::dos) != 0; + } + bool is_mac() const + { + return !is_mixed() && (flags_ & newline::mac) != 0; + } + bool is_mixed_posix() const { return (flags_ & newline::posix) != 0; } + bool is_mixed_dos() const { return (flags_ & newline::dos) != 0; } + bool is_mixed_mac() const { return (flags_ & newline::mac) != 0; } + bool is_mixed() const + { + int platform = + (flags_ & newline::posix) != 0 ? + newline::posix : + (flags_ & newline::dos) != 0 ? + newline::dos : + (flags_ & newline::mac) != 0 ? + newline::mac : + 0; + return (flags_ & ~platform & newline::platform_mask) != 0; + } + bool has_final_newline() const + { + return (flags_ & newline::final_newline) != 0; + } +protected: + newline_base(int flags) : flags_(flags) { } + int flags_; +}; + +} // End namespace detail. + +class newline_error + : public BOOST_IOSTREAMS_FAILURE, public detail::newline_base +{ +private: + friend class newline_checker; + newline_error(int flags) + : BOOST_IOSTREAMS_FAILURE("bad line endings"), + detail::newline_base(flags) + { } +}; + +class newline_filter { +public: + typedef char char_type; + struct category + : dual_use, + filter_tag, + closable_tag + { }; + + explicit newline_filter(int target) : flags_(target) + { + if ( target != newline::posix && + target != newline::dos && + target != newline::mac ) + { + throw std::logic_error("bad flags"); + } + } + + template + int get(Source& src) + { + using iostreams::newline::CR; + using iostreams::newline::LF; + + assert((flags_ & f_write) == 0); + flags_ |= f_read; + + if (flags_ & (f_has_LF | f_has_EOF)) { + if (flags_ & f_has_LF) + return newline(); + else + return EOF; + } + + int c = + (flags_ & f_has_CR) == 0 ? + iostreams::get(src) : + CR; + + if (c == WOULD_BLOCK ) + return WOULD_BLOCK; + + if (c == CR) { + flags_ |= f_has_CR; + + int d; + if ((d = iostreams::get(src)) == WOULD_BLOCK) + return WOULD_BLOCK; + + if (d == LF) { + flags_ &= ~f_has_CR; + return newline(); + } + + if (d == EOF) { + flags_ |= f_has_EOF; + } else { + iostreams::putback(src, d); + } + + flags_ &= ~f_has_CR; + return newline(); + } + + if (c == LF) + return newline(); + + return c; + } + + template + bool put(Sink& dest, char c) + { + using iostreams::newline::CR; + using iostreams::newline::LF; + + assert((flags_ & f_read) == 0); + flags_ |= f_write; + + if ((flags_ & f_has_LF) != 0) + return c == LF ? + newline(dest) : + newline(dest) && this->put(dest, c); + + if (c == LF) + return newline(dest); + + if ((flags_ & f_has_CR) != 0) + return newline(dest) ? + this->put(dest, c) : + false; + + if (c == CR) { + flags_ |= f_has_CR; + return true; + } + + return iostreams::put(dest, c); + } + + template + void close(Sink& dest, BOOST_IOS::openmode which) + { + typedef typename iostreams::category_of::type category; + if ((flags_ & f_write) != 0 && (flags_ & f_has_CR) != 0) + newline_if_sink(dest); + flags_ &= ~f_has_LF; // Restore original flags. + } +private: + + // Returns the appropriate element of a newline sequence. + int newline() + { + using iostreams::newline::CR; + using iostreams::newline::LF; + + switch (flags_ & newline::platform_mask) { + case newline::posix: + return LF; + case newline::mac: + return CR; + case newline::dos: + if (flags_ & f_has_LF) { + flags_ &= ~f_has_LF; + return LF; + } else { + flags_ |= f_has_LF; + return CR; + } + } + return BOOST_IOSTREAMS_ASSERT_UNREACHABLE(0); + } + + // Writes a newline sequence. + template + bool newline(Sink& dest) + { + using iostreams::newline::CR; + using iostreams::newline::LF; + + bool success = false; + switch (flags_ & newline::platform_mask) { + case newline::posix: + success = boost::iostreams::put(dest, LF); + break; + case newline::mac: + success = boost::iostreams::put(dest, CR); + break; + case newline::dos: + if ((flags_ & f_has_LF) != 0) { + if ((success = boost::iostreams::put(dest, LF))) + flags_ &= ~f_has_LF; + } else if (boost::iostreams::put(dest, CR)) { + if (!(success = boost::iostreams::put(dest, LF))) + flags_ |= f_has_LF; + } + break; + } + if (success) + flags_ &= ~f_has_CR; + return success; + } + + // Writes a newline sequence if the given device is a Sink. + template + void newline_if_sink(Device& dest) + { + typedef typename iostreams::category_of::type category; + newline_if_sink(dest, is_convertible()); + } + + template + void newline_if_sink(Sink& dest, mpl::true_) { newline(dest); } + + template + void newline_if_sink(Source&, mpl::false_) { } + + enum flags { + f_has_LF = 32768, + f_has_CR = f_has_LF << 1, + f_has_newline = f_has_CR << 1, + f_has_EOF = f_has_newline << 1, + f_read = f_has_EOF << 1, + f_write = f_read << 1 + }; + int flags_; +}; +BOOST_IOSTREAMS_PIPABLE(newline_filter, 0) + +class newline_checker : public detail::newline_base { +public: + typedef char char_type; + struct category + : dual_use_filter_tag, + closable_tag + { }; + explicit newline_checker(int target = newline::mixed) + : detail::newline_base(0), target_(target), open_(false) + { } + template + int get(Source& src) + { + using newline::CR; + using newline::LF; + + if (!open_) { + open_ = true; + source() = 0; + } + + int c; + if ((c = iostreams::get(src)) == WOULD_BLOCK) + return WOULD_BLOCK; + + // Update source flags. + if (c != EOF) + source() &= ~f_line_complete; + if ((source() & f_has_CR) != 0) { + if (c == LF) { + source() |= newline::dos; + source() |= f_line_complete; + } else { + source() |= newline::mac; + if (c == EOF) + source() |= f_line_complete; + } + } else if (c == LF) { + source() |= newline::posix; + source() |= f_line_complete; + } + source() = (source() & ~f_has_CR) | (c == CR ? f_has_CR : 0); + + // Check for errors. + if ( c == EOF && + (target_ & newline::final_newline) != 0 && + (source() & f_line_complete) == 0 ) + { + fail(); + } + if ( (target_ & newline::platform_mask) != 0 && + (source() & ~target_ & newline::platform_mask) != 0 ) + { + fail(); + } + + return c; + } + + template + bool put(Sink& dest, int c) + { + using iostreams::newline::CR; + using iostreams::newline::LF; + + if (!open_) { + open_ = true; + source() = 0; + } + + if (!iostreams::put(dest, c)) + return false; + + // Update source flags. + source() &= ~f_line_complete; + if ((source() & f_has_CR) != 0) { + if (c == LF) { + source() |= newline::dos; + source() |= f_line_complete; + } else { + source() |= newline::mac; + } + } else if (c == LF) { + source() |= newline::posix; + source() |= f_line_complete; + } + source() = (source() & ~f_has_CR) | (c == CR ? f_has_CR : 0); + + // Check for errors. + if ( (target_ & newline::platform_mask) != 0 && + (source() & ~target_ & newline::platform_mask) != 0 ) + { + fail(); + } + + return true; + } + + template + void close(Sink&, BOOST_IOS::openmode which) + { + using iostreams::newline::final_newline; + + // Update final_newline flag. + if ( (source() & f_has_CR) != 0 || + (source() & f_line_complete) != 0 ) + { + source() |= final_newline; + } + + // Clear non-sticky flags. + source() &= ~(f_has_CR | f_line_complete); + + // Check for errors. + if ( (target_ & final_newline) != 0 && + (source() & final_newline) == 0 ) + { + fail(); + } + } +private: + void fail() { throw newline_error(source()); } + int& source() { return flags_; } + int source() const { return flags_; } + + enum flags { + f_has_CR = 32768, + f_line_complete = f_has_CR << 1 + }; + + int target_; // Represents expected input. + bool open_; +}; +BOOST_IOSTREAMS_PIPABLE(newline_checker, 0) + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_NEWLINE_FILTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/regex.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/regex.hpp new file mode 100644 index 0000000000..e6efd6d8ae --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/regex.hpp @@ -0,0 +1,98 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_REGEX_FILTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_REGEX_FILTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // allocator. +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +template< typename Ch, + typename Tr = regex_traits, + typename Alloc = std::allocator > +class basic_regex_filter : public aggregate_filter { +private: + typedef aggregate_filter base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + typedef std::basic_string string_type; + typedef basic_regex regex_type; + typedef regex_constants::match_flag_type flag_type; + typedef match_results match_type; + typedef function1 formatter; + + basic_regex_filter( const regex_type& re, + const formatter& replace, + flag_type flags = regex_constants::match_default ) + : re_(re), replace_(replace), flags_(flags) { } + basic_regex_filter( const regex_type& re, + const string_type& fmt, + flag_type flags = regex_constants::match_default, + flag_type fmt_flags = regex_constants::format_default ) + : re_(re), replace_(simple_formatter(fmt, fmt_flags)), flags_(flags) { } + basic_regex_filter( const regex_type& re, + const char_type* fmt, + flag_type flags = regex_constants::match_default, + flag_type fmt_flags = regex_constants::format_default ) + : re_(re), replace_(simple_formatter(fmt, fmt_flags)), flags_(flags) { } +private: + typedef typename base_type::vector_type vector_type; + void do_filter(const vector_type& src, vector_type& dest) + { + typedef regex_iterator iterator; + if (src.empty()) + return; + iterator first(&src[0], &src[0] + src.size(), re_, flags_); + iterator last; + const Ch* suffix = 0; + for (; first != last; ++first) { + dest.insert( dest.end(), + first->prefix().first, + first->prefix().second ); + string_type replacement = replace_(*first); + dest.insert( dest.end(), + replacement.begin(), + replacement.end() ); + suffix = first->suffix().first; + } + if (suffix) { + dest.insert(dest.end(), suffix, &src[0] + src.size()); + } else { + dest.insert(dest.end(), &src[0], &src[0] + src.size()); + } + } + struct simple_formatter { + simple_formatter(const string_type& fmt, flag_type fmt_flags) + : fmt_(fmt), fmt_flags_(fmt_flags) { } + string_type operator() (const match_type& match) const + { return match.format(fmt_, fmt_flags_); } + string_type fmt_; + flag_type fmt_flags_; + }; + regex_type re_; + formatter replace_; + flag_type flags_; +}; +BOOST_IOSTREAMS_PIPABLE(basic_regex_filter, 3) + +typedef basic_regex_filter regex_filter; +typedef basic_regex_filter wregex_filter; + + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_REGEX_FILTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/stdio.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/stdio.hpp new file mode 100644 index 0000000000..e2addf569c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/stdio.hpp @@ -0,0 +1,84 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Based on the work of Christopher Diggins. + +#ifndef BOOST_IOSTREAMS_STDIO_FILTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_STDIO_FILTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // allocator. +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +namespace detail { + +} // End namespace detail. + +template > +class basic_stdio_filter : public aggregate_filter { +private: + typedef aggregate_filter base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + typedef typename base_type::vector_type vector_type; +private: + static std::istream& standard_input(char*) { return std::cin; } + static std::ostream& standard_output(char*) { return std::cout; } +#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS + static std::wistream& standard_input(wchar_t*) { return std::wcin; } + static std::wostream& standard_output(wchar_t*) { return std::wcout; } +#endif // BOOST_IOSTREAMS_NO_WIDE_STREAMS + + struct scoped_redirector { // Thanks to Maxim Egorushkin. + typedef BOOST_IOSTREAMS_CHAR_TRAITS(Ch) traits_type; + typedef BOOST_IOSTREAMS_BASIC_IOS(Ch, traits_type) ios_type; + typedef BOOST_IOSTREAMS_BASIC_STREAMBUF(Ch, traits_type) streambuf_type; + scoped_redirector( ios_type& ios, + streambuf_type* newbuf ) + : ios_(ios), old_(ios.rdbuf(newbuf)) + { } + ~scoped_redirector() { ios_.rdbuf(old_); } + scoped_redirector& operator=(const scoped_redirector&); + ios_type& ios_; + streambuf_type* old_; + }; + + virtual void do_filter() = 0; + virtual void do_filter(const vector_type& src, vector_type& dest) + { + stream_buffer< basic_array_source > + srcbuf(&src[0], &src[0] + src.size()); + stream_buffer< back_insert_device > + destbuf(iostreams::back_inserter(dest)); + scoped_redirector redirect_input(standard_input((Ch*)0), &srcbuf); + scoped_redirector redirect_output(standard_output((Ch*)0), &destbuf); + do_filter(); + } +}; +BOOST_IOSTREAMS_PIPABLE(basic_stdio_filter, 2) + +typedef basic_stdio_filter stdio_filter; +typedef basic_stdio_filter wstdio_wfilter; + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_STDIO_FILTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/symmetric.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/symmetric.hpp new file mode 100644 index 0000000000..6fd72f2f93 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/symmetric.hpp @@ -0,0 +1,304 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Contains the definitions of the class templates symmetric_filter, +// which models DualUseFilter based on a model of the Symmetric Filter. + +// +// Roughly, a Symmetric Filter is a class type with the following interface: +// +// struct symmetric_filter { +// typedef xxx char_type; +// +// bool filter( const char*& begin_in, const char* end_in, +// char*& begin_out, char* end_out, bool flush ) +// { +// // Consume as many characters as possible from the interval +// // [begin_in, end_in), without exhausting the output range +// // [begin_out, end_out). If flush is true, write as mush output +// // as possible. +// // A return value of true indicates that filter should be called +// // again. More precisely, if flush is false, a return value of +// // false indicates that the natural end of stream has been reached +// // and that all filtered data has been forwarded; if flush is +// // true, a return value of false indicates that all filtered data +// // has been forwarded. +// } +// void close() { /* Reset filter's state. */ } +// }; +// +// Symmetric Filter filters need not be CopyConstructable. +// + +#ifndef BOOST_IOSTREAMS_SYMMETRIC_FILTER_HPP_INCLUDED +#define BOOST_IOSTREAMS_SYMMETRIC_FILTER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // allocator, auto_ptr. +#include // BOOST_DEDUCED_TYPENAME. +#include +#include // buffer size. +#include +#include +#include +#include +#include +#include // read, write. +#include +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +template< typename SymmetricFilter, + typename Alloc = + std::allocator< + BOOST_DEDUCED_TYPENAME char_type_of::type + > > +class symmetric_filter { +public: + typedef typename char_type_of::type char_type; + typedef std::basic_string string_type; + struct category + : dual_use, + filter_tag, + multichar_tag, + closable_tag + { }; + + // Expands to a sequence of ctors which forward to impl. + #define BOOST_PP_LOCAL_MACRO(n) \ + BOOST_IOSTREAMS_TEMPLATE_PARAMS(n, T) \ + explicit symmetric_filter( \ + int buffer_size BOOST_PP_COMMA_IF(n) \ + BOOST_PP_ENUM_BINARY_PARAMS(n, const T, &t) ) \ + : pimpl_(new impl(buffer_size BOOST_PP_COMMA_IF(n) \ + BOOST_PP_ENUM_PARAMS(n, t))) \ + { } \ + /**/ + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_IOSTREAMS_MAX_FORWARDING_ARITY) + #include BOOST_PP_LOCAL_ITERATE() + #undef BOOST_PP_LOCAL_MACRO + + template + std::streamsize read(Source& src, char_type* s, std::streamsize n) + { + using namespace std; + if (!(state() & f_read)) + begin_read(); + + buffer_type& buf = pimpl_->buf_; + int status = (state() & f_eof) != 0 ? f_eof : f_good; + char_type *next_s = s, + *end_s = s + n; + while (true) + { + // Invoke filter if there are unconsumed characters in buffer or if + // filter must be flushed. + bool flush = status == f_eof; + if (buf.ptr() != buf.eptr() || flush) { + const char_type* next = buf.ptr(); + bool done = + !filter().filter(next, buf.eptr(), next_s, end_s, flush); + buf.ptr() = buf.data() + (next - buf.data()); + if (done) + return detail::check_eof( + static_cast(next_s - s) + ); + } + + // If no more characters are available without blocking, or + // if read request has been satisfied, return. + if ( status == f_would_block && buf.ptr() == buf.eptr() || + next_s == end_s ) + { + return static_cast(next_s - s); + } + + // Fill buffer. + if (status == f_good) + status = fill(src); + } + } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { + if (!(state() & f_write)) + begin_write(); + + buffer_type& buf = pimpl_->buf_; + const char_type *next_s, *end_s; + for (next_s = s, end_s = s + n; next_s != end_s; ) { + if (buf.ptr() == buf.eptr() && !flush(snk)) + break; + filter().filter(next_s, end_s, buf.ptr(), buf.eptr(), false); + } + return static_cast(next_s - s); + } + + template + void close(Sink& snk, BOOST_IOS::openmode which) + { + if ((state() & f_write) != 0) { + + // Repeatedly invoke filter() with no input. + try { + buffer_type& buf = pimpl_->buf_; + char dummy; + const char* end = &dummy; + bool again = true; + while (again) { + if (buf.ptr() != buf.eptr()) + again = filter().filter( end, end, buf.ptr(), + buf.eptr(), true ); + flush(snk); + } + } catch (...) { + try { close_impl(); } catch (...) { } + throw; + } + close_impl(); + } else { + close_impl(); + } + } + SymmetricFilter& filter() { return *pimpl_; } + string_type unconsumed_input() const; + +// Give impl access to buffer_type on Tru64 +#if !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + private: +#endif + typedef detail::buffer buffer_type; +private: + buffer_type& buf() { return pimpl_->buf_; } + const buffer_type& buf() const { return pimpl_->buf_; } + int& state() { return pimpl_->state_; } + void begin_read(); + void begin_write(); + + template + int fill(Source& src) + { + std::streamsize amt = iostreams::read(src, buf().data(), buf().size()); + if (amt == -1) { + state() |= f_eof; + return f_eof; + } + buf().set(0, amt); + return amt == buf().size() ? f_good : f_would_block; + } + + // Attempts to write the contents of the buffer the given Sink. + // Returns true if at least on character was written. + template + bool flush(Sink& snk) + { + typedef typename iostreams::category_of::type category; + typedef is_convertible can_write; + return flush(snk, can_write()); + } + + template + bool flush(Sink& snk, mpl::true_) + { + typedef char_traits traits_type; + std::streamsize amt = + static_cast(buf().ptr() - buf().data()); + std::streamsize result = + boost::iostreams::write(snk, buf().data(), amt); + if (result < amt && result > 0) + traits_type::move(buf().data(), buf().data() + result, amt - result); + buf().set(amt - result, buf().size()); + return result != 0; + } + + template + bool flush(Sink&, mpl::false_) { return true;} + + void close_impl(); + + enum flag_type { + f_read = 1, + f_write = f_read << 1, + f_eof = f_write << 1, + f_good, + f_would_block + }; + + struct impl : SymmetricFilter { + + // Expands to a sequence of ctors which forward to SymmetricFilter. + #define BOOST_PP_LOCAL_MACRO(n) \ + BOOST_IOSTREAMS_TEMPLATE_PARAMS(n, T) \ + impl( int buffer_size BOOST_PP_COMMA_IF(n) \ + BOOST_PP_ENUM_BINARY_PARAMS(n, const T, &t) ) \ + : SymmetricFilter(BOOST_PP_ENUM_PARAMS(n, t)), \ + buf_(buffer_size), state_(0) \ + { } \ + /**/ + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_IOSTREAMS_MAX_FORWARDING_ARITY) + #include BOOST_PP_LOCAL_ITERATE() + #undef BOOST_PP_LOCAL_MACRO + + buffer_type buf_; + int state_; + }; + + shared_ptr pimpl_; +}; +BOOST_IOSTREAMS_PIPABLE(symmetric_filter, 2) + +//------------------Implementation of symmetric_filter----------------// + +template +void symmetric_filter::begin_read() +{ + assert(!(state() & f_write)); + state() |= f_read; + buf().set(0, 0); +} + +template +void symmetric_filter::begin_write() +{ + assert(!(state() & f_read)); + state() |= f_write; + buf().set(0, buf().size()); +} + +template +void symmetric_filter::close_impl() +{ + state() = 0; + buf().set(0, 0); + filter().close(); +} + +template +typename symmetric_filter::string_type +symmetric_filter::unconsumed_input() const +{ return string_type(buf().ptr(), buf().eptr()); } + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_SYMMETRIC_FILTER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/test.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/test.hpp new file mode 100644 index 0000000000..bb7f3ca504 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/test.hpp @@ -0,0 +1,278 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_FILTER_TEST_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC,put size_t in std. +#include +#include // min. +#include // size_t. +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || \ + BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || \ + BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ + /**/ +# include // rand. +#endif +#include // memcpy, strlen. +#include +#include +#include +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ + !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ + !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ + /**/ +# include +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#undef memcpy +#undef rand +#undef strlen + +#if defined(BOOST_NO_STDC_NAMESPACE) && !defined(__LIBCOMO__) +namespace std { + using ::memcpy; + using ::strlen; + #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || \ + BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || \ + BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ + /**/ + using ::rand; + #endif +} +#endif + +namespace boost { namespace iostreams { + +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_string, std::basic_string, 3) + +const std::streamsize default_increment = 5; + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \ + !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ + !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ + /**/ + std::streamsize rand(int inc) + { + static rand48 random_gen; + static uniform_smallint random_dist(0, inc); + return random_dist(random_gen); + } +#else + std::streamsize rand(int inc) + { + return (std::rand() * inc + 1) / RAND_MAX; + } +#endif + +class non_blocking_source { +public: + typedef char char_type; + struct category + : source_tag, + peekable_tag + { }; + explicit non_blocking_source( const std::string& data, + std::streamsize inc = default_increment ) + : data_(data), inc_(inc), pos_(0) + { } + std::streamsize read(char* s, std::streamsize n) + { + if (pos_ == static_cast(data_.size())) + return -1; + std::streamsize avail = + (std::min) (n, static_cast(data_.size() - pos_)); + std::streamsize amt = (std::min) (rand(inc_), avail); + if (amt) + std::memcpy(s, data_.c_str() + pos_, amt); + pos_ += amt; + return amt; + } + + bool putback(char c) + { + if (pos_ > 0) { + data_[--pos_] = c; + return true; + } + return false; + } +private: + std::string data_; + std::streamsize inc_, pos_; +}; + +class non_blocking_sink : public sink { +public: + non_blocking_sink( std::string& dest, + std::streamsize inc = default_increment ) + : dest_(dest), inc_(inc) + { } + std::streamsize write(const char* s, std::streamsize n) + { + std::streamsize amt = (std::min) (rand(inc_), n); + dest_.insert(dest_.end(), s, s + amt); + return amt; + } +private: + non_blocking_sink& operator=(const non_blocking_sink&); + std::string& dest_; + std::streamsize inc_; +}; + +//--------------Definition of test_input_filter-------------------------------// + +template +bool test_input_filter( Filter filter, + const std::string& input, + const std::string& output, + mpl::true_ ) +{ + for ( int inc = default_increment; + inc < default_increment * 40; + inc += default_increment ) + { + non_blocking_source src(input, inc); + std::string dest; + iostreams::copy(compose(filter, src), iostreams::back_inserter(dest)); + if (dest != output) + return false; + } + return true; +} + +template +bool test_input_filter( Filter filter, + const Source1& input, + const Source2& output, + mpl::false_ ) +{ + std::string in; + std::string out; + iostreams::copy(input, iostreams::back_inserter(in)); + iostreams::copy(output, iostreams::back_inserter(out)); + return test_input_filter(filter, in, out); +} + +template +bool test_input_filter( Filter filter, + const Source1& input, + const Source2& output ) +{ + // Use tag dispatch to compensate for bad overload resolution. + return test_input_filter( filter, input, output, + is_string() ); +} + +//--------------Definition of test_output_filter------------------------------// + +template +bool test_output_filter( Filter filter, + const std::string& input, + const std::string& output, + mpl::true_ ) +{ + for ( int inc = default_increment; + inc < default_increment * 40; + inc += default_increment ) + { + array_source src(input.data(), input.data() + input.size()); + std::string dest; + iostreams::copy(src, compose(filter, non_blocking_sink(dest, inc))); + if (dest != output ) + return false; + } + return true; +} + +template +bool test_output_filter( Filter filter, + const Source1& input, + const Source2& output, + mpl::false_ ) +{ + std::string in; + std::string out; + iostreams::copy(input, iostreams::back_inserter(in)); + iostreams::copy(output, iostreams::back_inserter(out)); + return test_output_filter(filter, in, out); +} + +template +bool test_output_filter( Filter filter, + const Source1& input, + const Source2& output ) +{ + // Use tag dispatch to compensate for bad overload resolution. + return test_output_filter( filter, input, output, + is_string() ); +} + +//--------------Definition of test_filter_pair--------------------------------// + +template +bool test_filter_pair( OutputFilter out, + InputFilter in, + const std::string& data, + mpl::true_ ) +{ + for ( int inc = default_increment; + inc <= default_increment * 40; + inc += default_increment ) + { + array_source src(data.data(), data.data() + data.size()); + std::string temp; + std::string dest; + iostreams::copy(src, compose(out, non_blocking_sink(temp, inc))); + iostreams::copy( + compose(in, non_blocking_source(temp, inc)), + iostreams::back_inserter(dest) + ); + if (dest != data) + return false; + } + return true; +} + +template +bool test_filter_pair( OutputFilter out, + InputFilter in, + const Source& data, + mpl::false_ ) +{ + std::string str; + iostreams::copy(data, iostreams::back_inserter(str)); + return test_filter_pair(out, in, str); +} + +template +bool test_filter_pair( OutputFilter out, + InputFilter in, + const Source& data ) +{ + // Use tag dispatch to compensate for bad overload resolution. + return test_filter_pair(out, in, data, is_string()); +} + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_FILTER_TEST_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/zlib.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/zlib.hpp new file mode 100644 index 0000000000..59994ce59a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filter/zlib.hpp @@ -0,0 +1,416 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Note: custom allocators are not supported on VC6, since that compiler +// had trouble finding the function zlib_base::do_init. + +#ifndef BOOST_IOSTREAMS_ZLIB_HPP_INCLUDED +#define BOOST_IOSTREAMS_ZLIB_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // streamsize. +#include // allocator, bad_alloc. +#include +#include // MSVC, STATIC_CONSTANT, DEDUCED_TYPENAME, DINKUM. +#include +#include // buffer size. +#include +#include +#include +#include +#include // failure, streamsize. +#include +#include +#include + +// Must come last. +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4251 4231 4660) // Dependencies not exported. +#endif +#include + +namespace boost { namespace iostreams { + +namespace zlib { + // Typedefs + +typedef unsigned int uint; +typedef unsigned char byte; +typedef unsigned long ulong; + +typedef void* (*alloc_func)(void*, zlib::uint, zlib::uint); +typedef void (*free_func)(void*, void*); + + // Compression levels + +BOOST_IOSTREAMS_DECL extern const int no_compression; +BOOST_IOSTREAMS_DECL extern const int best_speed; +BOOST_IOSTREAMS_DECL extern const int best_compression; +BOOST_IOSTREAMS_DECL extern const int default_compression; + + // Compression methods + +BOOST_IOSTREAMS_DECL extern const int deflated; + + // Compression strategies + +BOOST_IOSTREAMS_DECL extern const int default_strategy; +BOOST_IOSTREAMS_DECL extern const int filtered; +BOOST_IOSTREAMS_DECL extern const int huffman_only; + + // Status codes + +BOOST_IOSTREAMS_DECL extern const int okay; +BOOST_IOSTREAMS_DECL extern const int stream_end; +BOOST_IOSTREAMS_DECL extern const int stream_error; +BOOST_IOSTREAMS_DECL extern const int version_error; +BOOST_IOSTREAMS_DECL extern const int data_error; +BOOST_IOSTREAMS_DECL extern const int mem_error; +BOOST_IOSTREAMS_DECL extern const int buf_error; + + // Flush codes + +BOOST_IOSTREAMS_DECL extern const int finish; +BOOST_IOSTREAMS_DECL extern const int no_flush; +BOOST_IOSTREAMS_DECL extern const int sync_flush; + + // Code for current OS + +//BOOST_IOSTREAMS_DECL extern const int os_code; + + // Null pointer constant. + +const int null = 0; + + // Default values + +const int default_window_bits = 15; +const int default_mem_level = 8; +const bool default_crc = false; +const bool default_noheader = false; + +} // End namespace zlib. + +// +// Class name: zlib_params. +// Description: Encapsulates the parameters passed to deflateInit2 +// and inflateInit2 to customize compression and decompression. +// +struct zlib_params { + + // Non-explicit constructor. + zlib_params( int level = zlib::default_compression, + int method = zlib::deflated, + int window_bits = zlib::default_window_bits, + int mem_level = zlib::default_mem_level, + int strategy = zlib::default_strategy, + bool noheader = zlib::default_noheader, + bool calculate_crc = zlib::default_crc ) + : level(level), method(method), window_bits(window_bits), + mem_level(mem_level), strategy(strategy), + noheader(noheader), calculate_crc(calculate_crc) + { } + int level; + int method; + int window_bits; + int mem_level; + int strategy; + bool noheader; + bool calculate_crc; +}; + +// +// Class name: zlib_error. +// Description: Subclass of std::ios::failure thrown to indicate +// zlib errors other than out-of-memory conditions. +// +class BOOST_IOSTREAMS_DECL zlib_error : public BOOST_IOSTREAMS_FAILURE { +public: + explicit zlib_error(int error); + int error() const { return error_; } + static void check(int error); +private: + int error_; +}; + +namespace detail { + +template +struct zlib_allocator_traits { +#ifndef BOOST_NO_STD_ALLOCATOR + typedef typename Alloc::template rebind::other type; +#else + typedef std::allocator type; +#endif +}; + +template< typename Alloc, + typename Base = // VC6 workaround (C2516) + BOOST_DEDUCED_TYPENAME zlib_allocator_traits::type > +struct zlib_allocator : private Base { +private: + typedef typename Base::size_type size_type; +public: + BOOST_STATIC_CONSTANT(bool, custom = + (!is_same, Base>::value)); + typedef typename zlib_allocator_traits::type allocator_type; + static void* allocate(void* self, zlib::uint items, zlib::uint size); + static void deallocate(void* self, void* address); +}; + +class BOOST_IOSTREAMS_DECL zlib_base { +public: + typedef char char_type; +protected: + zlib_base(); + ~zlib_base(); + void* stream() { return stream_; } + template + void init( const zlib_params& p, + bool compress, + zlib_allocator& zalloc ) + { + bool custom = zlib_allocator::custom; + do_init( p, compress, + #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + custom ? zlib_allocator::allocate : 0, + custom ? zlib_allocator::deallocate : 0, + #endif + &zalloc ); + } + void before( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end ); + void after( const char*& src_begin, char*& dest_begin, + bool compress ); + int deflate(int flush); + int inflate(int flush); + void reset(bool compress, bool realloc); +public: + zlib::ulong crc() const { return crc_; } + int total_in() const { return total_in_; } + int total_out() const { return total_out_; } +private: + void do_init( const zlib_params& p, bool compress, + #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + zlib::alloc_func, + zlib::free_func, + #endif + void* derived ); + void* stream_; // Actual type: z_stream*. + bool calculate_crc_; + zlib::ulong crc_; + int total_in_; + int total_out_; +}; + +// +// Template name: zlib_compressor_impl +// Description: Model of C-Style Filte implementing compression by +// delegating to the zlib function deflate. +// +template > +class zlib_compressor_impl : public zlib_base, public zlib_allocator { +public: + zlib_compressor_impl(const zlib_params& = zlib::default_compression); + ~zlib_compressor_impl(); + bool filter( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool flush ); + void close(); +}; + +// +// Template name: zlib_compressor +// Description: Model of C-Style Filte implementing decompression by +// delegating to the zlib function inflate. +// +template > +class zlib_decompressor_impl : public zlib_base, public zlib_allocator { +public: + zlib_decompressor_impl(const zlib_params&); + zlib_decompressor_impl(int window_bits = zlib::default_window_bits); + ~zlib_decompressor_impl(); + bool filter( const char*& begin_in, const char* end_in, + char*& begin_out, char* end_out, bool flush ); + void close(); +}; + +} // End namespace detail. + +// +// Template name: zlib_compressor +// Description: Model of InputFilter and OutputFilter implementing +// compression using zlib. +// +template > +struct basic_zlib_compressor + : symmetric_filter, Alloc> +{ +private: + typedef detail::zlib_compressor_impl impl_type; + typedef symmetric_filter base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + basic_zlib_compressor( const zlib_params& = zlib::default_compression, + int buffer_size = default_device_buffer_size ); + zlib::ulong crc() { return this->filter().crc(); } + int total_in() { return this->filter().total_in(); } +}; +BOOST_IOSTREAMS_PIPABLE(basic_zlib_compressor, 1) + +typedef basic_zlib_compressor<> zlib_compressor; + +// +// Template name: zlib_decompressor +// Description: Model of InputFilter and OutputFilter implementing +// decompression using zlib. +// +template > +struct basic_zlib_decompressor + : symmetric_filter, Alloc> +{ +private: + typedef detail::zlib_decompressor_impl impl_type; + typedef symmetric_filter base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + basic_zlib_decompressor( int window_bits = zlib::default_window_bits, + int buffer_size = default_device_buffer_size ); + basic_zlib_decompressor( const zlib_params& p, + int buffer_size = default_device_buffer_size ); + zlib::ulong crc() { return this->filter().crc(); } + int total_out() { return this->filter().total_out(); } +}; +BOOST_IOSTREAMS_PIPABLE(basic_zlib_decompressor, 1) + +typedef basic_zlib_decompressor<> zlib_decompressor; + +//----------------------------------------------------------------------------// + +//------------------Implementation of zlib_allocator--------------------------// + +namespace detail { + +template +void* zlib_allocator::allocate + (void* self, zlib::uint items, zlib::uint size) +{ + size_type len = items * size; + char* ptr = + static_cast(self)->allocate + (len + sizeof(size_type) + #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) + , (char*)0 + #endif + ); + *reinterpret_cast(ptr) = len; + return ptr + sizeof(size_type); +} + +template +void zlib_allocator::deallocate(void* self, void* address) +{ + char* ptr = reinterpret_cast(address) - sizeof(size_type); + size_type len = *reinterpret_cast(ptr) + sizeof(size_type); + static_cast(self)->deallocate(ptr, len); +} + +//------------------Implementation of zlib_compressor_impl--------------------// + +template +zlib_compressor_impl::zlib_compressor_impl(const zlib_params& p) +{ init(p, true, static_cast&>(*this)); } + +template +zlib_compressor_impl::~zlib_compressor_impl() +{ reset(true, false); } + +template +bool zlib_compressor_impl::filter + ( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool flush ) +{ + before(src_begin, src_end, dest_begin, dest_end); + int result = deflate(flush ? zlib::finish : zlib::no_flush); + after(src_begin, dest_begin, true); + zlib_error::check(result); + return result != zlib::stream_end; +} + +template +void zlib_compressor_impl::close() { reset(true, true); } + +//------------------Implementation of zlib_decompressor_impl------------------// + +template +zlib_decompressor_impl::zlib_decompressor_impl(const zlib_params& p) +{ init(p, false, static_cast&>(*this)); } + +template +zlib_decompressor_impl::~zlib_decompressor_impl() +{ reset(false, false); } + +template +zlib_decompressor_impl::zlib_decompressor_impl(int window_bits) +{ + zlib_params p; + p.window_bits = window_bits; + init(p, false, static_cast&>(*this)); +} + +template +bool zlib_decompressor_impl::filter + ( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool /* flush */ ) +{ + before(src_begin, src_end, dest_begin, dest_end); + int result = inflate(zlib::sync_flush); + after(src_begin, dest_begin, false); + zlib_error::check(result); + return result != zlib::stream_end; +} + +template +void zlib_decompressor_impl::close() { reset(false, true); } + +} // End namespace detail. + +//------------------Implementation of zlib_decompressor-----------------------// + +template +basic_zlib_compressor::basic_zlib_compressor + (const zlib_params& p, int buffer_size) + : base_type(buffer_size, p) { } + +//------------------Implementation of zlib_decompressor-----------------------// + +template +basic_zlib_decompressor::basic_zlib_decompressor + (int window_bits, int buffer_size) + : base_type(buffer_size, window_bits) { } + +template +basic_zlib_decompressor::basic_zlib_decompressor + (const zlib_params& p, int buffer_size) + : base_type(buffer_size, p) { } + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#include // Pops abi_suffix.hpp pragmas. +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_IOSTREAMS_ZLIB_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filtering_stream.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filtering_stream.hpp new file mode 100644 index 0000000000..548ef0c60a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filtering_stream.hpp @@ -0,0 +1,166 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2004-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_FILTER_STREAM_HPP_INCLUDED +#define BOOST_IOSTREAMS_FILTER_STREAM_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // allocator. +#include +#include +#include // standard streams. +#include +#include +#include // pubsync. +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +//--------------Definition of filtered_istream--------------------------------// + +namespace detail { + +template +struct filtering_stream_traits { + typedef typename + iostreams::select< // Disambiguation for Tru64 + mpl::and_< + is_convertible, + is_convertible + >, + BOOST_IOSTREAMS_BASIC_IOSTREAM(Ch, Tr), + is_convertible, + BOOST_IOSTREAMS_BASIC_ISTREAM(Ch, Tr), + else_, + BOOST_IOSTREAMS_BASIC_OSTREAM(Ch, Tr) + >::type stream_type; + typedef typename + iostreams::select< // Dismbiguation required for Tru64. + mpl::and_< + is_convertible, + is_convertible + >, + iostream_tag, + is_convertible, + istream_tag, + else_, + ostream_tag + >::type stream_tag; +}; + +template +class filtering_stream_base + : public access_control< + boost::iostreams::detail::chain_client, + Access + >, + public filtering_stream_traits< + typename Chain::mode, + typename Chain::char_type, + typename Chain::traits_type + >::stream_type +{ +public: + typedef Chain chain_type; + typedef access_control< + boost::iostreams::detail::chain_client, + Access + > client_type; +protected: + typedef typename + filtering_stream_traits< + typename Chain::mode, + typename Chain::char_type, + typename Chain::traits_type + >::stream_type stream_type; + filtering_stream_base() : stream_type(0) { this->set_chain(&chain_); } +private: + void notify() { this->rdbuf(chain_.empty() ? 0 : &chain_.front()); } + Chain chain_; +}; + +} // End namespace detail. + +// +// Macro: BOOST_IOSTREAMS_DEFINE_FILTER_STREAM(name_, chain_type_, default_char_) +// Description: Defines a template derived from std::basic_streambuf which uses +// a chain to perform i/o. The template has the following parameters: +// Mode - the i/o mode. +// Ch - The character type. +// Tr - The character traits type. +// Alloc - The allocator type. +// Access - Indicates accessibility of the chain interface; must be either +// public_ or protected_; defaults to public_. +// Macro parameters: +// name_ - The name of the template to be defined. +// chain_type_ - The name of the chain template. +// default_char_ - The default value for the char template parameter. +// +#define BOOST_IOSTREAMS_DEFINE_FILTER_STREAM(name_, chain_type_, default_char_) \ + template< typename Mode, \ + typename Ch = default_char_, \ + typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS(Ch), \ + typename Alloc = std::allocator, \ + typename Access = public_ > \ + class name_ \ + : public boost::iostreams::detail::filtering_stream_base< \ + chain_type_, Access \ + > \ + { \ + public: \ + typedef Ch char_type; \ + struct category \ + : Mode, \ + closable_tag, \ + detail::filtering_stream_traits::stream_tag \ + { }; \ + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) \ + typedef Mode mode; \ + typedef chain_type_ chain_type; \ + name_() { } \ + BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name_, mode, Ch, push_impl) \ + ~name_() { \ + if (this->is_complete()) \ + this->rdbuf()->BOOST_IOSTREAMS_PUBSYNC(); \ + } \ + private: \ + typedef access_control< \ + boost::iostreams::detail::chain_client< \ + chain_type_ \ + >, \ + Access \ + > client_type; \ + template \ + void push_impl(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()) \ + { client_type::push(t BOOST_IOSTREAMS_PUSH_ARGS()); } \ + }; \ + /**/ +BOOST_IOSTREAMS_DEFINE_FILTER_STREAM(filtering_stream, boost::iostreams::chain, char) +BOOST_IOSTREAMS_DEFINE_FILTER_STREAM(wfiltering_stream, boost::iostreams::chain, wchar_t) + +typedef filtering_stream filtering_istream; +typedef filtering_stream filtering_ostream; +typedef wfiltering_stream filtering_wistream; +typedef wfiltering_stream filtering_wostream; + +//----------------------------------------------------------------------------// + +} } // End namespace iostreams, boost + +#include // MSVC + +#endif // #ifndef BOOST_IOSTREAMS_FILTER_STREAM_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filtering_streambuf.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filtering_streambuf.hpp new file mode 100644 index 0000000000..e49bf612ee --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/filtering_streambuf.hpp @@ -0,0 +1,70 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED +#define BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // allocator. +#include +#include +#include +#include +#include // pubsync. +#include +#include + +namespace boost { namespace iostreams { + +// +// Macro: BOOST_IOSTREAMS_DEFINE_FILTERBUF(name_, chain_type_, default_char_) +// Description: Defines a template derived from std::basic_streambuf which uses +// a chain to perform i/o. The template has the following parameters: +// Ch - The character type. +// Tr - The character traits type. +// Alloc - The allocator type. +// Access - Indicates accessibility of the chain interface; must be either +// public_ or protected_; defaults to public_. +// +#define BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(name_, chain_type_, default_char_) \ + template< typename Mode, \ + typename Ch = default_char_, \ + typename Tr = BOOST_IOSTREAMS_CHAR_TRAITS(Ch), \ + typename Alloc = std::allocator, \ + typename Access = public_ > \ + class name_ : public boost::iostreams::detail::chainbuf< \ + chain_type_, Mode, Access \ + > \ + { \ + public: \ + typedef Ch char_type; \ + struct category \ + : Mode, closable_tag, streambuf_tag \ + { }; \ + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) \ + typedef Mode mode; \ + typedef chain_type_ chain_type; \ + name_() { } \ + BOOST_IOSTREAMS_DEFINE_PUSH_CONSTRUCTOR(name_, mode, Ch, push_impl) \ + ~name_() { if (this->is_complete()) this->BOOST_IOSTREAMS_PUBSYNC(); } \ + }; \ + /**/ +BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(filtering_streambuf, boost::iostreams::chain, char) +BOOST_IOSTREAMS_DEFINE_FILTER_STREAMBUF(filtering_wstreambuf, boost::iostreams::chain, wchar_t) + +typedef filtering_streambuf filtering_istreambuf; +typedef filtering_streambuf filtering_ostreambuf; +typedef filtering_wstreambuf filtering_wistreambuf; +typedef filtering_wstreambuf filtering_wostreambuf; + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_FILTERING_STREAMBUF_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/flush.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/flush.hpp new file mode 100644 index 0000000000..73d160051c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/flush.hpp @@ -0,0 +1,125 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_FLUSH_HPP_INCLUDED +#define BOOST_IOSTREAMS_FLUSH_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include +#include +#include +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct flush_device_impl; + +template +struct flush_filter_impl; + +} // End namespace detail. + +template +bool flush(T& t) +{ return detail::flush_device_impl::flush(detail::unwrap(t)); } + +template +bool flush(T& t, Sink& snk) +{ return detail::flush_filter_impl::flush(detail::unwrap(t), snk); } + +namespace detail { + +//------------------Definition of flush_device_impl---------------------------// + +template +struct flush_device_impl + : mpl::if_< + is_custom, + operations, + flush_device_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, ostream_tag, streambuf_tag, flushable_tag, any_tag + >::type + > + >::type + { }; + +template<> +struct flush_device_impl { + template + static bool flush(T& t) + { return t.rdbuf()->BOOST_IOSTREAMS_PUBSYNC() == 0; } +}; + +template<> +struct flush_device_impl { + template + static bool flush(T& t) + { return t.BOOST_IOSTREAMS_PUBSYNC() == 0; } +}; + +template<> +struct flush_device_impl { + template + static bool flush(T& t) { return t.flush(); } +}; + +template<> +struct flush_device_impl { + template + static bool flush(T&) { return true; } +}; + +//------------------Definition of flush_filter_impl---------------------------// + +template +struct flush_filter_impl + : mpl::if_< + is_custom, + operations, + flush_filter_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, flushable_tag, any_tag + >::type + > + >::type + { }; + +template<> +struct flush_filter_impl { + template + static bool flush(T& t, Sink& snk) { return t.flush(snk); } +}; + +template<> +struct flush_filter_impl { + template + static bool flush(T&, Sink&) { return false; } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_FLUSH_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/get.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/get.hpp new file mode 100644 index 0000000000..bb82204b79 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/get.hpp @@ -0,0 +1,17 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_GET_HPP_INCLUDED +#define BOOST_IOSTREAMS_GET_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +#endif // #ifndef BOOST_IOSTREAMS_GET_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/imbue.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/imbue.hpp new file mode 100644 index 0000000000..608481a505 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/imbue.hpp @@ -0,0 +1,82 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_IMBUE_HPP_INCLUDED +#define BOOST_IOSTREAMS_IMBUE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include +#include +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +namespace detail { + +// Implementation templates for simulated tag dispatch. +template +struct imbue_impl; + +} // End namespace detail. + +template +void imbue(T& t, const Locale& loc) +{ detail::imbue_impl::imbue(detail::unwrap(t), loc); } + +namespace detail { + +//------------------Definition of imbue_impl----------------------------------// + +template +struct imbue_impl + : mpl::if_< + is_custom, + operations, + imbue_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, streambuf_tag, localizable_tag, any_tag + >::type + > + >::type + { }; + +template<> +struct imbue_impl { + template + static void imbue(T&, const Locale&) { } +}; + +template<> +struct imbue_impl { + template + static void imbue(T& t, const Locale& loc) { t.pubimbue(loc); } +}; + +template<> +struct imbue_impl { + template + static void imbue(T& t, const Locale& loc) { t.imbue(loc); } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_IMBUE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/input_sequence.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/input_sequence.hpp new file mode 100644 index 0000000000..8e0e77b4f6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/input_sequence.hpp @@ -0,0 +1,72 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_INPUT_SEQUENCE_HPP_INCLUDED +#define BOOST_IOSTREAMS_INPUT_SEQUENCE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // pair. +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include // is_custom +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct input_sequence_impl; + +} // End namespace detail. + +template +inline std::pair< + BOOST_DEDUCED_TYPENAME char_type_of::type*, + BOOST_DEDUCED_TYPENAME char_type_of::type* +> +input_sequence(T& t) +{ return detail::input_sequence_impl::input_sequence(t); } + +namespace detail { + +//------------------Definition of direct_impl-------------------------------// + +template +struct input_sequence_impl + : mpl::if_< + detail::is_custom, + operations, + input_sequence_impl + >::type + { }; + +template<> +struct input_sequence_impl { + template + static std::pair< + BOOST_DEDUCED_TYPENAME char_type_of::type*, + BOOST_DEDUCED_TYPENAME char_type_of::type* + > + input_sequence(U& u) { return u.input_sequence(); } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_INPUT_SEQUENCE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/invert.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/invert.hpp new file mode 100644 index 0000000000..f26aad7e61 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/invert.hpp @@ -0,0 +1,166 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_INVERT_HPP_INCLUDED +#define BOOST_IOSTREAMS_INVERT_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // copy, min. +#include +#include // BOOST_DEDUCED_TYPENAME. +#include // default_filter_buffer_size. +#include +#include +#include +#include +#include +#include +#include +#include // clear_flags, call_reset +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { + +// +// Template name: inverse. +// Template paramters: +// Filter - A model of InputFilter or OutputFilter. +// Description: Generates an InputFilter from an OutputFilter or +// vice versa. +// +template +class inverse { +private: + typedef typename category_of::type base_category; + typedef reference_wrapper filter_ref; +public: + typedef typename char_type_of::type char_type; + typedef typename int_type_of::type int_type; + typedef char_traits traits_type; + typedef typename + mpl::if_< + is_convertible< + base_category, + input + >, + output, + input + >::type mode; + struct category + : mode, + filter_tag, + multichar_tag, + closable_tag + { }; + explicit inverse( const Filter& filter, + std::streamsize buffer_size = + default_filter_buffer_size) + : pimpl_(new impl(filter, buffer_size)) + { } + + template + std::streamsize read(Source& src, char* s, std::streamsize n) + { + typedef detail::counted_array_sink array_sink; + typedef composite filtered_array_sink; + + assert((flags() & f_write) == 0); + if (flags() == 0) { + flags() = f_read; + buf().set(0, 0); + } + + filtered_array_sink snk(filter(), array_sink(s, n)); + int_type status; + for ( status = traits_type::good(); + snk.second().count() < n && status == traits_type::good(); ) + { + status = buf().fill(src); + buf().flush(snk); + } + return snk.second().count() == 0 && + status == traits_type::eof() + ? + -1 + : + snk.second().count(); + } + + template + std::streamsize write(Sink& dest, const char* s, std::streamsize n) + { + typedef detail::counted_array_source array_source; + typedef composite filtered_array_source; + + assert((flags() & f_read) == 0); + if (flags() == 0) { + flags() = f_write; + buf().set(0, 0); + } + + filtered_array_source src(filter(), array_source(s, n)); + for (bool good = true; src.second().count() < n && good; ) { + buf().fill(src); + good = buf().flush(dest); + } + return src.second().count(); + } + + template + void close(Device& dev) + { + detail::execute_all( + detail::flush_buffer(buf(), dev, (flags() & f_write) != 0), + detail::call_close_all(pimpl_->filter_, dev), + detail::clear_flags(flags()) + ); + } +private: + filter_ref filter() { return boost::ref(pimpl_->filter_); } + detail::buffer& buf() { return pimpl_->buf_; } + int& flags() { return pimpl_->flags_; } + + enum flags_ { + f_read = 1, f_write = 2 + }; + + struct impl { + impl(const Filter& filter, std::streamsize n) + : filter_(filter), buf_(n), flags_(0) + { buf_.set(0, 0); } + Filter filter_; + detail::buffer buf_; + int flags_; + }; + shared_ptr pimpl_; +}; + +// +// Template name: invert. +// Template paramters: +// Filter - A model of InputFilter or OutputFilter. +// Description: Returns an instance of an appropriate specialization of inverse. +// +template +inverse invert(const Filter& f) { return inverse(f); } + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_INVERT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/operations.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/operations.hpp new file mode 100644 index 0000000000..5da1610816 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/operations.hpp @@ -0,0 +1,26 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_OPERATIONS_HPP_INCLUDED +#define BOOST_IOSTREAMS_OPERATIONS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // #ifndef BOOST_IOSTREAMS_OPERATIONS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/operations_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/operations_fwd.hpp new file mode 100644 index 0000000000..e2380b12f9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/operations_fwd.hpp @@ -0,0 +1,41 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_OPERATIONS_FWD_HPP_INCLUDED +#define BOOST_IOSTREAMS_OPERATIONS_FWD_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include + +namespace boost { namespace iostreams { + +template +struct operations; + +namespace detail { + +struct custom_tag { }; + +template +struct is_custom + : mpl::not_< + is_base_and_derived< custom_tag, operations > + > + { }; + +} // End namespace detail. + +template +struct operations : detail::custom_tag { }; + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_OPERATIONS_FWD_HPP_INCLUDED //--------------// diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/optimal_buffer_size.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/optimal_buffer_size.hpp new file mode 100644 index 0000000000..79715b2cb8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/optimal_buffer_size.hpp @@ -0,0 +1,87 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_OPTIMAL_BUFFER_SIZE_HPP_INCLUDED +#define BOOST_IOSTREAMS_OPTIMAL_BUFFER_SIZE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // DEDUCED_TYPENAME, MSVC. +#include +#include // constants. +#include +#include +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct optimal_buffer_size_impl; + +} // End namespace detail. + +template +std::streamsize optimal_buffer_size(const T& t) +{ + typedef detail::optimal_buffer_size_impl impl; + return impl::optimal_buffer_size(detail::unwrap(t)); +} + +namespace detail { + +//------------------Definition of optimal_buffer_size_impl--------------------// + +template +struct optimal_buffer_size_impl + : mpl::if_< + is_custom, + operations, + optimal_buffer_size_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, optimally_buffered_tag, device_tag, filter_tag + >::type + > + >::type + { }; + +template<> +struct optimal_buffer_size_impl { + template + static std::streamsize optimal_buffer_size(const T& t) + { return t.optimal_buffer_size(); } +}; + +template<> +struct optimal_buffer_size_impl { + template + static std::streamsize optimal_buffer_size(const T&) + { return default_device_buffer_size; } +}; + +template<> +struct optimal_buffer_size_impl { + template + static std::streamsize optimal_buffer_size(const T&) + { return default_filter_buffer_size; } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_OPTIMAL_BUFFER_SIZE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/output_sequence.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/output_sequence.hpp new file mode 100644 index 0000000000..36bd7e523b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/output_sequence.hpp @@ -0,0 +1,72 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_OUTPUT_SEQUENCE_HPP_INCLUDED +#define BOOST_IOSTREAMS_OUTPUT_SEQUENCE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // pair. +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include // is_custom +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct output_sequence_impl; + +} // End namespace detail. + +template +inline std::pair< + BOOST_DEDUCED_TYPENAME char_type_of::type*, + BOOST_DEDUCED_TYPENAME char_type_of::type* +> +output_sequence(T& t) +{ return detail::output_sequence_impl::output_sequence(t); } + +namespace detail { + +//------------------Definition of output_sequence_impl------------------------// + +template +struct output_sequence_impl + : mpl::if_< + detail::is_custom, + operations, + output_sequence_impl + >::type + { }; + +template<> +struct output_sequence_impl { + template + static std::pair< + BOOST_DEDUCED_TYPENAME char_type_of::type*, + BOOST_DEDUCED_TYPENAME char_type_of::type* + > + output_sequence(U& u) { return u.output_sequence(); } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_OUTPUT_SEQUENCE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/pipeline.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/pipeline.hpp new file mode 100644 index 0000000000..1573e160c2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/pipeline.hpp @@ -0,0 +1,128 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_PIPABLE_HPP_INCLUDED +#define BOOST_IOSTREAMS_PIPABLE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // BOOST_MSVC. +#include +#include +#include +#include +#include +#include +#include +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +# include +#endif + +#define BOOST_IOSTREAMS_PIPABLE(filter, arity) \ + template< BOOST_PP_ENUM_PARAMS(arity, typename T) \ + BOOST_PP_COMMA_IF(arity) typename Component> \ + ::boost::iostreams::pipeline< \ + ::boost::iostreams::detail::pipeline_segment< \ + filter BOOST_IOSTREAMS_TEMPLATE_ARGS(arity, T) \ + >, \ + Component \ + > operator|( const filter BOOST_IOSTREAMS_TEMPLATE_ARGS(arity, T)& f, \ + const Component& c ) \ + { \ + typedef ::boost::iostreams::detail::pipeline_segment< \ + filter BOOST_IOSTREAMS_TEMPLATE_ARGS(arity, T) \ + > segment; \ + return ::boost::iostreams::pipeline \ + (segment(f), c); \ + } \ + /**/ + +namespace boost { namespace iostreams { + +template +struct pipeline; + +namespace detail { + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + struct pipeline_base { }; + + template + struct is_pipeline + : is_base_and_derived + { }; +#endif +#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) + template + struct is_pipeline : mpl::false_ { }; + + template + struct is_pipeline< pipeline > : mpl::true_ { }; +#endif + +template +class pipeline_segment +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + : pipeline_base +#endif +{ +public: + pipeline_segment(const Component& component) + : component_(component) + { } + template + void for_each(Fn fn) const { fn(component_); } + template + void push(Chain& chn) const { chn.push(component_); } +private: + pipeline_segment operator=(const pipeline_segment&); + const Component& component_; +}; + +} // End namespace detail. + +//------------------Definition of Pipeline------------------------------------// + +template +struct pipeline : Pipeline { + typedef Pipeline pipeline_type; + typedef Component component_type; + pipeline(const Pipeline& p, const Component& component) + : Pipeline(p), component_(component) + { } + template + void for_each(Fn fn) const + { + Pipeline::for_each(fn); + fn(component_); + } + template + void push(Chain& chn) const + { + Pipeline::push(chn); + chn.push(component_); + } + const Pipeline& tail() const { return *this; } + const Component& head() const { return component_; } +private: + pipeline operator=(const pipeline&); + const Component& component_; +}; + +template +pipeline, Component> +operator|(const pipeline& p, const Component& cmp) +{ + BOOST_STATIC_ASSERT(is_filter::value); + return pipeline, Component>(p, cmp); +} + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_PIPABLE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/positioning.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/positioning.hpp new file mode 100644 index 0000000000..cb174dd45e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/positioning.hpp @@ -0,0 +1,115 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Thanks to Gareth Sylvester-Bradley for the Dinkumware versions of the +// positioning functions. + +#ifndef BOOST_IOSTREAMS_POSITIONING_HPP_INCLUDED +#define BOOST_IOSTREAMS_POSITIONING_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include // mbstate_t. +#include +#include // streamoff, streampos. + +// Must come last. +#include + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::fpos_t; } +#endif + +namespace boost { namespace iostreams { + +//------------------Definition of stream_offset-------------------------------// + +typedef boost::intmax_t stream_offset; + +//------------------Definition of stream_offset_to_streamoff------------------// + +inline std::streamoff stream_offset_to_streamoff(stream_offset off) +{ return static_cast(off); } + +//------------------Definition of offset_to_position--------------------------// + +# ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS + +inline std::streampos offset_to_position(stream_offset off) { return off; } + +# else // # ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS + +inline std::streampos offset_to_position(stream_offset off) +{ return std::streampos(std::mbstate_t(), off); } + +# endif // # ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS + +//------------------Definition of position_to_offset--------------------------// + +// Hande custom pos_type's +template +inline stream_offset position_to_offset(PosType pos) +{ return std::streamoff(pos); } + +# ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS + +inline stream_offset position_to_offset(std::streampos pos) { return pos; } + +# else // # ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS + +// In the Dinkumware standard library, a std::streampos consists of two stream +// offsets -- _Fpos, of type std::fpos_t, and _Myoff, of type std::streamoff -- +// together with a conversion state. A std::streampos is converted to a +// boost::iostreams::stream_offset by extracting the two stream offsets and +// summing them. The value of _Fpos can be extracted using the implementation- +// defined member functions seekpos() or get_fpos_t(), depending on the +// Dinkumware version. The value of _Myoff cannot be extracted directly, but can +// be calculated as the difference between the result of converting the +// std::fpos to a std::streamoff and the result of converting the member _Fpos +// to a long. The latter operation is accomplished with the macro _FPOSOFF, +// which works correctly on platforms where std::fpos_t is an integral type and +// platforms where it is a struct + +// Converts a std::fpos_t to a stream_offset +inline stream_offset fpos_t_to_offset(std::fpos_t pos) +{ +# if defined(_POSIX_) || (_INTEGRAL_MAX_BITS >= 64) || defined(__IBMCPP__) + return pos; +# else + return _FPOSOFF(pos); +# endif +} + +// Extracts the member _Fpos from a std::fpos +inline std::fpos_t streampos_to_fpos_t(std::streampos pos) +{ +# if defined (_CPPLIB_VER) || defined(__IBMCPP__) + return pos.seekpos(); +# else + return pos.get_fpos_t(); +# endif +} + +inline stream_offset position_to_offset(std::streampos pos) +{ + return fpos_t_to_offset(streampos_to_fpos_t(pos)) + + static_cast(static_cast(pos)) - + static_cast(_FPOSOFF(streampos_to_fpos_t(pos))); +} + +# endif // # ifndef BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_POSITIONING_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/put.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/put.hpp new file mode 100644 index 0000000000..5ad96ce629 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/put.hpp @@ -0,0 +1,17 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_PUT_HPP_INCLUDED +#define BOOST_IOSTREAMS_PUT_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +#endif // #ifndef BOOST_IOSTREAMS_PUT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/putback.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/putback.hpp new file mode 100644 index 0000000000..d0fabb311c --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/putback.hpp @@ -0,0 +1,17 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_PUTBACK_HPP_INCLUDED +#define BOOST_IOSTREAMS_PUTBACK_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +#endif // #ifndef BOOST_IOSTREAMS_PUTBACK_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/read.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/read.hpp new file mode 100644 index 0000000000..4443b62804 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/read.hpp @@ -0,0 +1,247 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_READ_HPP_INCLUDED +#define BOOST_IOSTREAMS_READ_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include +#include +#include // streamsize. +#include +#include +#include +#include + +// Must come last. +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-----------------------------------// +# include +#else // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //--------------------------// + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct read_device_impl; + +template +struct read_filter_impl; + +} // End namespace detail. + +template +typename int_type_of::type get(T& t) +{ return detail::read_device_impl::get(detail::unwrap(t)); } + +template +inline std::streamsize +read(T& t, typename char_type_of::type* s, std::streamsize n) +{ return detail::read_device_impl::read(detail::unwrap(t), s, n); } + +template +std::streamsize +read(T& t, Source& src, typename char_type_of::type* s, std::streamsize n) +{ return detail::read_filter_impl::read(detail::unwrap(t), src, s, n); } + +template +bool putback(T& t, typename char_type_of::type c) +{ return detail::read_device_impl::putback(detail::unwrap(t), c); } + +//----------------------------------------------------------------------------// + +namespace detail { + +// Helper function for adding -1 as EOF indicator. +inline std::streamsize check_eof(std::streamsize n) { return n != 0 ? n : -1; } + +// Helper templates for reading from streambufs. +template +struct true_eof_impl; + +template<> +struct true_eof_impl { + template + static bool true_eof(T& t) { return t.true_eof(); } +}; + +template<> +struct true_eof_impl { + template + static bool true_eof(T&) { return true; } +}; + +template +inline bool true_eof(T& t) +{ + const bool linked = is_linked::value; + return true_eof_impl::true_eof(t); +} + +//------------------Definition of read_device_impl----------------------------// + +template +struct read_device_impl + : mpl::if_< + detail::is_custom, + operations, + read_device_impl< + BOOST_DEDUCED_TYPENAME + detail::dispatch< + T, istream_tag, streambuf_tag, input + >::type + > + >::type + { }; + +template<> +struct read_device_impl { + template + static typename int_type_of::type get(T& t) + { return t.get(); } + + template + static std::streamsize + read(T& t, typename char_type_of::type* s, std::streamsize n) + { return check_eof(t.rdbuf()->sgetn(s, n)); } + + template + static bool putback(T& t, typename char_type_of::type c) + { + typedef typename char_type_of::type char_type; + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) traits_type; + return !traits_type::eq_int_type( t.rdbuf()->sputbackc(c), + traits_type::eof() ); + } +}; + +template<> +struct read_device_impl { + template + static typename int_type_of::type + get(T& t) + { // gcc 2.95 needs namespace qualification for char_traits. + typedef typename char_type_of::type char_type; + typedef iostreams::char_traits traits_type; + typename int_type_of::type c; + return !traits_type::is_eof(c = t.sbumpc()) || + detail::true_eof(t) + ? + c : traits_type::would_block(); + } + + template + static std::streamsize + read(T& t, typename char_type_of::type* s, std::streamsize n) + { + std::streamsize amt; + return (amt = t.sgetn(s, n)) != 0 ? + amt : + detail::true_eof(t) ? + -1 : + 0; + } + + template + static bool putback(T& t, typename char_type_of::type c) + { // gcc 2.95 needs namespace qualification for char_traits. + typedef typename char_type_of::type char_type; + typedef iostreams::char_traits traits_type; + return !traits_type::is_eof(t.sputbackc(c)); + } +}; + +template<> +struct read_device_impl { + template + static typename int_type_of::type + get(T& t) + { // gcc 2.95 needs namespace qualification for char_traits. + typedef typename char_type_of::type char_type; + typedef iostreams::char_traits traits_type; + char_type c; + std::streamsize amt; + return (amt = t.read(&c, 1)) == 1 ? + traits_type::to_int_type(c) : + amt == -1 ? + traits_type::eof() : + traits_type::would_block(); + } + + template + static std::streamsize + read(T& t, typename char_type_of::type* s, std::streamsize n) + { return t.read(s, n); } + + template + static bool putback(T& t, typename char_type_of::type c) + { // T must be Peekable. + return t.putback(c); + } +}; + +//------------------Definition of read_filter_impl----------------------------// + +template +struct read_filter_impl + : mpl::if_< + detail::is_custom, + operations, + read_filter_impl< + BOOST_DEDUCED_TYPENAME + detail::dispatch< + T, multichar_tag, any_tag + >::type + > + >::type + { }; + +template<> +struct read_filter_impl { + template + static std::streamsize read + (T& t, Source& src, typename char_type_of::type* s, std::streamsize n) + { return t.read(src, s, n); } +}; + +template<> +struct read_filter_impl { + template + static std::streamsize read + (T& t, Source& src, typename char_type_of::type* s, std::streamsize n) + { // gcc 2.95 needs namespace qualification for char_traits. + typedef typename char_type_of::type char_type; + typedef iostreams::char_traits traits_type; + for (std::streamsize off = 0; off < n; ++off) { + typename traits_type::int_type c = t.get(src); + if (traits_type::is_eof(c)) + return check_eof(off); + if (traits_type::would_block(c)) + return off; + s[off] = traits_type::to_char_type(c); + } + return n; + } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-------------------------// + +#include + +#endif // #ifndef BOOST_IOSTREAMS_READ_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/restrict.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/restrict.hpp new file mode 100644 index 0000000000..e17eb8c965 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/restrict.hpp @@ -0,0 +1,26 @@ +/* + * 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/iostreams for documentation. + * + * File: boost/iostreams/detail/restrict.hpp + * Date: Sun Jan 06 12:57:30 MST 2008 + * Copyright: 2008 CodeRage, LLC + 2004-2007 Jonathan Turkanis + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * Defines the class template boost::iostreams::restriction and the + * overloaded function template boost::iostreams::restrict + */ + +#ifndef BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED +#define BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED + +#include +#define BOOST_IOSTREAMS_RESTRICT restrict +#include +#undef BOOST_IOSTREAMS_RESTRICT + +#endif // #ifndef BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/seek.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/seek.hpp new file mode 100644 index 0000000000..efa3c7daf0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/seek.hpp @@ -0,0 +1,180 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_SEEK_HPP_INCLUDED +#define BOOST_IOSTREAMS_SEEK_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include +#include // streamsize, seekdir, openmode. +#include +#include +#include +#include +#include + +// Must come last. +#include + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct seek_device_impl; + +template +struct seek_filter_impl; + +} // End namespace detail. + +template +inline std::streampos +seek( T& t, stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) +{ + using namespace detail; + return seek_device_impl::seek(detail::unwrap(t), off, way, which); +} + +template +inline std::streampos +seek( T& t, Device& dev, stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) +{ + using namespace detail; + return seek_filter_impl::seek(detail::unwrap(t), dev, off, way, which); +} + +namespace detail { + +//------------------Definition of seek_device_impl----------------------------// + +template +struct seek_device_impl + : mpl::if_< + is_custom, + operations, + seek_device_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, iostream_tag, istream_tag, ostream_tag, + streambuf_tag, two_head, any_tag + >::type + > + >::type + { }; + +struct seek_impl_basic_ios { + template + static std::streampos seek( T& t, stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) + { + if ( way == BOOST_IOS::beg && + ( off < integer_traits::const_min || + off > integer_traits::const_max ) ) + { + return t.rdbuf()->pubseekpos(offset_to_position(off)); + } else { + return t.rdbuf()->pubseekoff(off, way, which); + } + } +}; + +template<> +struct seek_device_impl : seek_impl_basic_ios { }; + +template<> +struct seek_device_impl : seek_impl_basic_ios { }; + +template<> +struct seek_device_impl : seek_impl_basic_ios { }; + +template<> +struct seek_device_impl { + template + static std::streampos seek( T& t, stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) + { + if ( way == BOOST_IOS::beg && + ( off < integer_traits::const_min || + off > integer_traits::const_max ) ) + { + return t.BOOST_IOSTREAMS_PUBSEEKPOS(offset_to_position(off)); + } else { + return t.BOOST_IOSTREAMS_PUBSEEKOFF(off, way, which); + } + } +}; + +template<> +struct seek_device_impl { + template + static std::streampos seek( T& t, stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) + { return t.seek(off, way, which); } +}; + +template<> +struct seek_device_impl { + template + static std::streampos seek( T& t, stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode ) + { return t.seek(off, way); } +}; + +//------------------Definition of seek_filter_impl----------------------------// + +template +struct seek_filter_impl + : mpl::if_< + is_custom, + operations, + seek_filter_impl< + BOOST_DEDUCED_TYPENAME + dispatch::type + > + >::type + { }; + +template<> +struct seek_filter_impl { + template + static std::streampos seek( T& t, Device& d, + stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) + { return t.seek(d, off, way, which); } +}; + +template<> +struct seek_filter_impl { + template + static std::streampos seek( T& t, Device& d, + stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode ) + { return t.seek(d, off, way); } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#include + +#endif // #ifndef BOOST_IOSTREAMS_SEEK_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/skip.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/skip.hpp new file mode 100644 index 0000000000..f3fcd797ef --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/skip.hpp @@ -0,0 +1,111 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// To do: handle bidirection streams and output-seekable components. + +#ifndef BOOST_IOSTREAMS_SKIP_HPP_INCLUDED +#define BOOST_IOSTREAMS_SKIP_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // failure. +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +namespace detail { + +template +void skip(Device& dev, stream_offset off, mpl::true_) +{ iostreams::seek(dev, off, BOOST_IOS::cur); } + +template +void skip(Device& dev, stream_offset off, mpl::false_) +{ // gcc 2.95 needs namespace qualification for char_traits. + typedef typename char_type_of::type char_type; + typedef iostreams::char_traits traits_type; + for (stream_offset z = 0; z < off; ) { + typename traits_type::int_type c; + if (traits_type::is_eof(c = iostreams::get(dev))) + throw BOOST_IOSTREAMS_FAILURE("bad skip offset"); + if (!traits_type::would_block(c)) + ++z; + } +} + +template +void skip( Filter& flt, Device& dev, stream_offset off, + BOOST_IOS::openmode which, mpl::true_ ) +{ boost::iostreams::seek(flt, dev, off, BOOST_IOS::cur, which); } + +template +void skip( Filter& flt, Device& dev, stream_offset off, + BOOST_IOS::openmode, mpl::false_ ) +{ + typedef typename char_type_of::type char_type; + char_type c; + for (stream_offset z = 0; z < off; ) { + std::streamsize amt; + if ((amt = iostreams::read(flt, dev, &c, 1)) == -1) + throw BOOST_IOSTREAMS_FAILURE("bad skip offset"); + if (amt == 1) + ++z; + } +} + +} // End namespace detail. + +template +void skip(Device& dev, stream_offset off) +{ + typedef typename mode_of::type mode; + typedef mpl::or_< + is_convertible, + is_convertible + > can_seek; + BOOST_STATIC_ASSERT( + (can_seek::value || is_convertible::value) + ); + detail::skip(dev, off, can_seek()); +} + +template +void skip( Filter& flt, Device& dev, stream_offset off, + BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) +{ + typedef typename mode_of::type filter_mode; + typedef typename mode_of::type device_mode; + typedef mpl::or_< + mpl::and_< + is_convertible, + is_convertible + >, + mpl::and_< + is_convertible, + is_convertible + > + > can_seek; + BOOST_STATIC_ASSERT( + ( can_seek::value || + is_convertible::value && + is_convertible::value ) + ); + detail::skip(flt, dev, off, which, can_seek()); +} + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_SKIP_HPP_INCLUDED //------------------------// diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/slice.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/slice.hpp new file mode 100644 index 0000000000..820a316fe1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/slice.hpp @@ -0,0 +1,28 @@ +/* + * 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/iostreams for documentation. + * + * File: boost/iostreams/detail/restrict.hpp + * Date: Sun Jan 06 12:57:30 MST 2008 + * Copyright: 2008 CodeRage, LLC + 2004-2007 Jonathan Turkanis + * Author: Jonathan Turkanis + * Contact: turkanis at coderage dot com + * + * Defines the class template boost::iostreams::restriction and the + * overloaded function template boost::iostreams::slice. + * + * This header is provided for platforms on which "restrict" is a keyword. + */ + +#ifndef BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED +#define BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED + +#include +#define BOOST_IOSTREAMS_RESTRICT slice +#include +#undef BOOST_IOSTREAMS_RESTRICT + +#endif // #ifndef BOOST_IOSTREAMS_RESTRICT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/stream.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/stream.hpp new file mode 100644 index 0000000000..36eeefc84d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/stream.hpp @@ -0,0 +1,152 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_STREAM_HPP_INCLUDED +#define BOOST_IOSTREAMS_STREAM_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include // standard streams. +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { namespace detail { + +template +struct stream_traits { + typedef typename char_type_of::type char_type; + typedef Tr traits_type; + typedef typename category_of::type mode; + typedef typename + iostreams::select< // Dismbiguation required for Tru64. + mpl::and_< + is_convertible, + is_convertible + >, + BOOST_IOSTREAMS_BASIC_IOSTREAM(char_type, traits_type), + is_convertible, + BOOST_IOSTREAMS_BASIC_ISTREAM(char_type, traits_type), + else_, + BOOST_IOSTREAMS_BASIC_OSTREAM(char_type, traits_type) + >::type stream_type; + typedef typename + iostreams::select< // Dismbiguation required for Tru64. + mpl::and_< + is_convertible, + is_convertible + >, + iostream_tag, + is_convertible, + istream_tag, + else_, + ostream_tag + >::type stream_tag; +}; + +// By encapsulating initialization in a base, we can define the macro +// BOOST_IOSTREAMS_DEFINE_FORWARDING_FUNCTIONS to generate constuctors +// without base member initializer lists. +template< typename Device, + typename Tr = + BOOST_IOSTREAMS_CHAR_TRAITS( + BOOST_DEDUCED_TYPENAME char_type_of::type + ), + typename Alloc = + std::allocator< + BOOST_DEDUCED_TYPENAME char_type_of::type + >, + typename Base = // VC6 Workaround. + BOOST_DEDUCED_TYPENAME + detail::stream_traits::stream_type > +class stream_base + : protected base_from_member< stream_buffer >, + public Base +{ +private: + typedef base_from_member< stream_buffer > pbase_type; + typedef typename stream_traits::stream_type stream_type; +protected: + using pbase_type::member; // Avoid warning about 'this' in initializer list. +public: + stream_base() : pbase_type(), stream_type(&member) { } +}; + +} } } // End namespaces detail, iostreams, boost. + +#ifdef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION +# include +#else + +namespace boost { namespace iostreams { + +// +// Template name: stream. +// Description: A iostream which reads from and writes to an instance of a +// designated device type. +// Template paramters: +// Device - A device type. +// Alloc - The allocator type. +// +template< typename Device, + typename Tr = + BOOST_IOSTREAMS_CHAR_TRAITS( + BOOST_DEDUCED_TYPENAME char_type_of::type + ), + typename Alloc = + std::allocator< + BOOST_DEDUCED_TYPENAME char_type_of::type + > > +struct stream : detail::stream_base { +public: + typedef typename char_type_of::type char_type; + struct category + : mode_of::type, + closable_tag, + detail::stream_traits::stream_tag + { }; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) +private: + typedef typename + detail::stream_traits< + Device, Tr + >::stream_type stream_type; + typedef Device policy_type; +public: + stream() { } + BOOST_IOSTREAMS_FORWARD( stream, open_impl, Device, + BOOST_IOSTREAMS_PUSH_PARAMS, + BOOST_IOSTREAMS_PUSH_ARGS ) + bool is_open() const { return this->member.is_open(); } + void close() { this->member.close(); } + bool auto_close() const { return this->member.auto_close(); } + void set_auto_close(bool close) { this->member.set_auto_close(close); } + bool strict_sync() { return this->member.strict_sync(); } + Device& operator*() { return *this->member; } + Device* operator->() { return &*this->member; } + Device* component() { return this->member.component(); } +private: + void open_impl(const Device& dev BOOST_IOSTREAMS_PUSH_PARAMS()) // For forwarding. + { + this->clear(); + this->member.open(dev BOOST_IOSTREAMS_PUSH_ARGS()); + } +}; + +} } // End namespaces iostreams, boost. + +#endif // #ifdef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION + +#endif // #ifndef BOOST_IOSTREAMS_stream_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/stream_buffer.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/stream_buffer.hpp new file mode 100644 index 0000000000..95680cb47b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/stream_buffer.hpp @@ -0,0 +1,114 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_STREAM_BUFFER_HPP_INCLUDED +#define BOOST_IOSTREAMS_STREAM_BUFFER_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // allocator. +#include // BOOST_DEDUCED_TYPENAME. +#include +#include +#include +#include // failure, streamsize. +#include +#include +#include +#include +#include + +// Must come last. +#include // MSVC. + +namespace boost { namespace iostreams { namespace detail { + +template +struct stream_buffer_traits { + typedef typename + mpl::if_< + is_convertible< + BOOST_DEDUCED_TYPENAME category_of::type, + direct_tag + >, + direct_streambuf, + indirect_streambuf + >::type type; +}; + +} } } // End namespaces detail, iostreams, boost + +#ifdef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION +# include +#else + +namespace boost { namespace iostreams { + +template< typename T, + typename Tr = + BOOST_IOSTREAMS_CHAR_TRAITS( + BOOST_DEDUCED_TYPENAME char_type_of::type + ), + typename Alloc = + std::allocator< + BOOST_DEDUCED_TYPENAME char_type_of::type + >, + typename Mode = BOOST_DEDUCED_TYPENAME mode_of::type > +class stream_buffer + : public detail::stream_buffer_traits::type +{ +private: + BOOST_STATIC_ASSERT(( + is_convertible< + BOOST_DEDUCED_TYPENAME iostreams::category_of::type, Mode + >::value + )); + typedef typename + detail::stream_buffer_traits< + T, Tr, Alloc, Mode + >::type base_type; + typedef T policy_type; +public: + typedef typename char_type_of::type char_type; + struct category + : Mode, + closable_tag, + streambuf_tag + { }; + BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) +public: + stream_buffer() { } + ~stream_buffer() + { + try { + if (this->is_open() && this->auto_close()) + this->close(); + } catch (...) { } + } + BOOST_IOSTREAMS_FORWARD( stream_buffer, open_impl, T, + BOOST_IOSTREAMS_PUSH_PARAMS, + BOOST_IOSTREAMS_PUSH_ARGS ) + T& operator*() { return *this->component(); } + T* operator->() { return this->component(); } +private: + void open_impl(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()) + { // Used for forwarding. + if (this->is_open()) + BOOST_IOSTREAMS_FAILURE("already open"); + base_type::open(t BOOST_IOSTREAMS_PUSH_ARGS()); + } +}; + +} } // End namespaces iostreams, boost. + +#endif // #ifdef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION + +#include // MSVC. + +#endif // #ifndef BOOST_IOSTREAMS_STREAM_BUFFER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/tee.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/tee.hpp new file mode 100644 index 0000000000..0106cda6a4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/tee.hpp @@ -0,0 +1,173 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2005-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_TEE_HPP_INCLUDED +#define BOOST_IOSTREAMS_TEE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include // BOOST_DEDUCE_TYPENAME. +#include +#include +#include +#include +#include +#include // call_close_all +#include +#include +#include +#include +#include +#include + +namespace boost { namespace iostreams { + +// +// Template name: tee_filter. +// Template paramters: +// Device - A blocking Sink. +// +template +class tee_filter : public detail::filter_adapter { +public: + typedef typename detail::param_type::type param_type; + typedef typename char_type_of::type char_type; + struct category + : multichar_output_filter_tag, + closable_tag, + flushable_tag, + localizable_tag, + optimally_buffered_tag + { }; + + BOOST_STATIC_ASSERT(( + is_convertible< // Using mode_of causes failures on VC6-7.0. + BOOST_DEDUCED_TYPENAME iostreams::category_of::type, output + >::value + )); + + explicit tee_filter(param_type dev) + : detail::filter_adapter(dev) + { } + + template + std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) + { + std::streamsize result = iostreams::write(snk, s, n); + std::streamsize result2 = iostreams::write(this->component(), s, result); + (void) result2; // Suppress 'unused variable' warning. + assert(result == result2); + return result; + } + + template + void close(Next&) + { + detail::close_all(this->component()); + } + + template + bool flush(Sink& snk) + { + bool r1 = iostreams::flush(snk); + bool r2 = iostreams::flush(this->component()); + return r1 && r2; + } +}; +BOOST_IOSTREAMS_PIPABLE(tee_filter, 1) + +// +// Template name: tee_device. +// Template paramters: +// Sink1 - A blocking Sink. +// Sink2 - A blocking Sink. +// +template +class tee_device { +public: + typedef typename detail::param_type::type param_type1; + typedef typename detail::param_type::type param_type2; + typedef typename detail::value_type::type value_type1; + typedef typename detail::value_type::type value_type2; + typedef typename char_type_of::type char_type; + BOOST_STATIC_ASSERT(( + is_same< + char_type, + BOOST_DEDUCED_TYPENAME char_type_of::type + >::value + )); + BOOST_STATIC_ASSERT(( + is_convertible< // Using mode_of causes failures on VC6-7.0. + BOOST_DEDUCED_TYPENAME iostreams::category_of::type, output + >::value + )); + BOOST_STATIC_ASSERT(( + is_convertible< // Using mode_of causes failures on VC6-7.0. + BOOST_DEDUCED_TYPENAME iostreams::category_of::type, output + >::value + )); + struct category + : output, + device_tag, + closable_tag, + flushable_tag, + localizable_tag, + optimally_buffered_tag + { }; + tee_device(param_type1 sink1, param_type2 sink2) + : sink1_(sink1), sink2_(sink2) + { } + std::streamsize write(const char_type* s, std::streamsize n) + { + std::streamsize result1 = iostreams::write(sink1_, s, n); + std::streamsize result2 = iostreams::write(sink2_, s, n); + (void) result1; // Suppress 'unused variable' warning. + (void) result2; + assert(result1 == n && result2 == n); + return n; + } + void close() + { + detail::execute_all( detail::call_close_all(sink1_), + detail::call_close_all(sink2_) ); + } + bool flush() + { + bool r1 = iostreams::flush(sink1_); + bool r2 = iostreams::flush(sink2_); + return r1 && r2; + } + template + void imbue(const Locale& loc) + { + iostreams::imbue(sink1_, loc); + iostreams::imbue(sink2_, loc); + } + std::streamsize optimal_buffer_size() const + { + return (std::max) ( iostreams::optimal_buffer_size(sink1_), + iostreams::optimal_buffer_size(sink2_) ); + } +private: + value_type1 sink1_; + value_type2 sink2_; +}; + +template +tee_filter tee(const Sink& snk) +{ return tee_filter(snk); } + +template +tee_device tee(const Sink1& sink1, const Sink2& sink2) +{ return tee_device(sink1, sink2); } + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_TEE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/traits.hpp new file mode 100644 index 0000000000..08515412c0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/traits.hpp @@ -0,0 +1,364 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// +// Contains metafunctions char_type_of, category_of and mode_of used for +// deducing the i/o category and i/o mode of a model of Filter or Device. +// +// Also contains several utility metafunctions, functions and macros. +// + +#ifndef BOOST_IOSTREAMS_IO_TRAITS_HPP_INCLUDED +#define BOOST_IOSTREAMS_IO_TRAITS_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // stream types, char_traits. +#include // partial spec, deduced typename. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# include +# include +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +#include + +namespace boost { namespace iostreams { + +//----------Definitions of predicates for streams and stream buffers----------// + +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------------------// + +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_istream, std::basic_istream, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ostream, std::basic_ostream, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_iostream, std::basic_iostream, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_streambuf, std::basic_streambuf, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ifstream, std::basic_ifstream, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ofstream, std::basic_ofstream, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_fstream, std::basic_fstream, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_filebuf, std::basic_filebuf, 2) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_istringstream, std::basic_istringstream, 3) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ostringstream, std::basic_ostringstream, 3) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_stringstream, std::basic_stringstream, 3) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_stringbuf, std::basic_stringbuf, 3) + +#else // #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-----------------------// + +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_istream, std::istream, 0) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_ostream, std::ostream, 0) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_iostream, std::iostream, 0) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_streambuf, std::streambuf, 0) + +#endif // #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //----------------------// + +template +struct is_std_io + : mpl::or_< is_istream, is_ostream, is_streambuf > + { }; + +template +struct is_std_file_device + : mpl::or_< + is_ifstream, + is_ofstream, + is_fstream, + is_filebuf + > + { }; + +template +struct is_std_string_device + : mpl::or_< + is_istringstream, + is_ostringstream, + is_stringstream, + is_stringbuf + > + { }; + +template +struct stream; + +template +class stream_buffer; + +template< typename Mode, typename Ch, typename Tr, + typename Alloc, typename Access > +class filtering_stream; + +template< typename Mode, typename Ch, typename Tr, + typename Alloc, typename Access > +class wfiltering_stream; + +template< typename Mode, typename Ch, typename Tr, + typename Alloc, typename Access > +class filtering_streambuf; + +template< typename Mode, typename Ch, typename Tr, + typename Alloc, typename Access > +class filtering_wstreambuf; + +namespace detail { + +template +class linked_streambuf; + +BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_boost_stream, + boost::iostreams::stream, + 3 ) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_boost_stream_buffer, + boost::iostreams::stream_buffer, + 4 ) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_stream_impl, + boost::iostreams::filtering_stream, + 5 ) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_wstream_impl, + boost::iostreams::wfiltering_stream, + 5 ) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_streambuf_impl, + boost::iostreams::filtering_streambuf, + 5 ) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF( is_filtering_wstreambuf_impl, + boost::iostreams::filtering_wstreambuf, + 5 ) +BOOST_IOSTREAMS_BOOL_TRAIT_DEF(is_linked, linked_streambuf, 2) + +template +struct is_filtering_stream + : mpl::or_< + is_filtering_stream_impl, + is_filtering_wstream_impl + > + { }; + +template +struct is_filtering_streambuf + : mpl::or_< + is_filtering_streambuf_impl, + is_filtering_wstreambuf_impl + > + { }; + +template +struct is_boost + : mpl::or_< + is_boost_stream, + is_boost_stream_buffer, + is_filtering_stream, + is_filtering_streambuf + > + { }; + +} // End namespace detail. + +//------------------Definitions of char_type_of-------------------------------// + +namespace detail { + +template +struct member_char_type { typedef typename T::char_type type; }; + +} // End namespace detail. + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //---------------------------// +# ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------------------// + +template +struct char_type_of + : detail::member_char_type< + typename detail::unwrapped_type::type + > + { }; + +# else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //---------------------// + +template +struct char_type_of { + typedef typename detail::unwrapped_type::type U; + typedef typename + mpl::eval_if< + is_std_io, + mpl::identity, + detail::member_char_type + >::type type; +}; + +# endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------// + +template +struct char_type_of< iterator_range > { + typedef typename iterator_value::type type; +}; + +#else // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //------------------// + +template +struct char_type_of { + template + struct get_value_type { + #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + typedef typename range_value::type type; + #endif // #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + }; + typedef typename + mpl::eval_if< + is_iterator_range, + get_value_type, + detail::member_char_type< + BOOST_DEDUCED_TYPENAME detail::unwrapped_type::type + > + >::type type; +}; + +#endif // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //-----------------// + +//------------------Definitions of category_of--------------------------------// + +namespace detail { + +template +struct member_category { typedef typename T::category type; }; + +} // End namespace detail. + +template +struct category_of { + template + struct member_category { + typedef typename U::category type; + }; + typedef typename detail::unwrapped_type::type U; + typedef typename + mpl::eval_if< + mpl::and_< + is_std_io, + mpl::not_< detail::is_boost > + >, + iostreams::select< // Disambiguation for Tru64 + is_filebuf, filebuf_tag, + is_ifstream, ifstream_tag, + is_ofstream, ofstream_tag, + is_fstream, fstream_tag, + is_stringbuf, stringbuf_tag, + is_istringstream, istringstream_tag, + is_ostringstream, ostringstream_tag, + is_stringstream, stringstream_tag, + is_streambuf, generic_streambuf_tag, + is_iostream, generic_iostream_tag, + is_istream, generic_istream_tag, + is_ostream, generic_ostream_tag + >, + detail::member_category + >::type type; +}; + +//------------------Definition of get_category--------------------------------// + +// +// Returns an object of type category_of::type. +// +template +inline typename category_of::type get_category(const T&) +{ typedef typename category_of::type category; return category(); } + +//------------------Definition of int_type_of---------------------------------// + +template +struct int_type_of { +#ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES + typedef std::char_traits< + BOOST_DEDUCED_TYPENAME char_type_of::type + > traits_type; + typedef typename traits_type::int_type type; +#else + typedef int type; +#endif +}; + +//------------------Definition of mode----------------------------------------// + +namespace detail { + +template struct io_mode_impl; + +#define BOOST_IOSTREAMS_MODE_HELPER(tag_, id_) \ + case_ io_mode_impl_helper(tag_); \ + template<> struct io_mode_impl { typedef tag_ type; }; \ + /**/ +BOOST_IOSTREAMS_MODE_HELPER(input, 1) +BOOST_IOSTREAMS_MODE_HELPER(output, 2) +BOOST_IOSTREAMS_MODE_HELPER(bidirectional, 3) +BOOST_IOSTREAMS_MODE_HELPER(input_seekable, 4) +BOOST_IOSTREAMS_MODE_HELPER(output_seekable, 5) +BOOST_IOSTREAMS_MODE_HELPER(seekable, 6) +BOOST_IOSTREAMS_MODE_HELPER(dual_seekable, 7) +BOOST_IOSTREAMS_MODE_HELPER(bidirectional_seekable, 8) +BOOST_IOSTREAMS_MODE_HELPER(dual_use, 9) +#undef BOOST_IOSTREAMS_MODE_HELPER + +template +struct io_mode_id { + typedef typename category_of::type category; + BOOST_SELECT_BY_SIZE(int, value, detail::io_mode_impl_helper(category())); +}; + +} // End namespace detail. + +template // Borland 5.6.4 requires this circumlocution. +struct mode_of : detail::io_mode_impl< detail::io_mode_id::value > { }; + +//------------------Definition of is_device, is_filter and is_direct----------// + +namespace detail { + +template +struct has_trait_impl { + typedef typename category_of::type category; + BOOST_STATIC_CONSTANT(bool, value = (is_convertible::value)); +}; + +template +struct has_trait + : mpl::bool_::value> + { }; + +} // End namespace detail. + +template +struct is_device : detail::has_trait { }; + +template +struct is_filter : detail::has_trait { }; + +template +struct is_direct : detail::has_trait { }; + +//------------------Definition of BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS----------// + +#define BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr) \ + typedef Tr traits_type; \ + typedef typename traits_type::int_type int_type; \ + typedef typename traits_type::off_type off_type; \ + typedef typename traits_type::pos_type pos_type; \ + /**/ + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_IO_TRAITS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/traits_fwd.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/traits_fwd.hpp new file mode 100644 index 0000000000..7114f89b36 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/traits_fwd.hpp @@ -0,0 +1,111 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +// Forward declarations of templates defined in traits.hpp. + +#ifndef BOOST_IOSTREAMS_IO_TRAITS_FWD_HPP_INCLUDED +#define BOOST_IOSTREAMS_IO_TRAITS_FWD_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // stream types, char_traits. + +namespace boost { namespace iostreams { + +template +struct is_istream; + +template +struct is_ostream; + +template +struct is_iostream; + +template +struct is_streambuf; + +template +struct is_istringstream; + +template +struct is_ostringstream; + +template +struct is_stringstream; + +template +struct is_stringbuf; + +template +struct is_ifstream; + +template +struct is_ofstream; + +template +struct is_fstream; + +template +struct is_filebuf; + +template +struct is_std_io; + +template +struct is_std_file_device; + +template +struct is_std_string_device; + +template +struct char_type_of; + +template +struct category_of; + +template +struct int_type_of; + +template +struct mode_of; + +template +struct is_device; + +template +struct is_filter; + +template +struct is_direct; + +namespace detail { + +template +struct is_boost_stream; + +template +struct is_boost_stream_buffer; + +template +struct is_filtering_stream; + +template +struct is_filtering_streambuf; + +template +struct is_linked; + +template +struct is_boost; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#endif // #ifndef BOOST_IOSTREAMS_IO_TRAITS_FWD_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iostreams/write.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/write.hpp new file mode 100644 index 0000000000..4f3771a94e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iostreams/write.hpp @@ -0,0 +1,171 @@ +// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) +// (C) Copyright 2003-2007 Jonathan Turkanis +// 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/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_WRITE_HPP_INCLUDED +#define BOOST_IOSTREAMS_WRITE_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include // DEDUCED_TYPENAME, MSVC. +#include +#include +#include +#include +#include // streamsize. +#include +#include +#include +#include +#include + +// Must come last. +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-----------------------------------// +# include +#else // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //--------------------------// + +namespace boost { namespace iostreams { + +namespace detail { + +template +struct write_device_impl; + +template +struct write_filter_impl; + +} // End namespace detail. + +template +bool put(T& t, typename char_type_of::type c) +{ return detail::write_device_impl::put(detail::unwrap(t), c); } + +template +inline std::streamsize write + (T& t, const typename char_type_of::type* s, std::streamsize n) +{ return detail::write_device_impl::write(detail::unwrap(t), s, n); } + +template +inline std::streamsize +write( T& t, Sink& snk, const typename char_type_of::type* s, + std::streamsize n ) +{ return detail::write_filter_impl::write(detail::unwrap(t), snk, s, n); } + +namespace detail { + +//------------------Definition of write_device_impl---------------------------// + +template +struct write_device_impl + : mpl::if_< + is_custom, + operations, + write_device_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, ostream_tag, streambuf_tag, output + >::type + > + >::type + { }; + +template<> +struct write_device_impl { + template + static bool put(T& t, typename char_type_of::type c) + { + typedef typename char_type_of::type char_type; + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) traits_type; + return !traits_type::eq_int_type( t.rdbuf()->s.sputc(), + traits_type::eof() ); + } + + template + static std::streamsize write + (T& t, const typename char_type_of::type* s, std::streamsize n) + { return t.rdbuf()->sputn(s, n); } +}; + +template<> +struct write_device_impl { + template + static bool put(T& t, typename char_type_of::type c) + { + typedef typename char_type_of::type char_type; + typedef BOOST_IOSTREAMS_CHAR_TRAITS(char_type) traits_type; + return !traits_type::eq_int_type(t.sputc(c), traits_type::eof()); + } + + template + static std::streamsize write + (T& t, const typename char_type_of::type* s, std::streamsize n) + { return t.sputn(s, n); } +}; + +template<> +struct write_device_impl { + template + static bool put(T& t, typename char_type_of::type c) + { return t.write(&c, 1) == 1; } + + template + static std::streamsize + write(T& t, const typename char_type_of::type* s, std::streamsize n) + { return t.write(s, n); } +}; + +//------------------Definition of write_filter_impl---------------------------// + +template +struct write_filter_impl + : mpl::if_< + is_custom, + operations, + write_filter_impl< + BOOST_DEDUCED_TYPENAME + dispatch< + T, multichar_tag, any_tag + >::type + > + >::type + { }; + +template<> +struct write_filter_impl { + template + static std::streamsize + write( T& t, Sink& snk, const typename char_type_of::type* s, + std::streamsize n ) + { return t.write(snk, s, n); } +}; + +template<> +struct write_filter_impl { + template + static std::streamsize + write( T& t, Sink& snk, const typename char_type_of::type* s, + std::streamsize n ) + { + for (std::streamsize off = 0; off < n; ++off) + if (!t.put(snk, s[off])) + return off; + return n; + } +}; + +} // End namespace detail. + +} } // End namespaces iostreams, boost. + +#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) //-------------------------// + +#include + +#endif // #ifndef BOOST_IOSTREAMS_WRITE_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/is_placeholder.hpp b/deal.II/contrib/boost/include/boost-1.37.0/is_placeholder.hpp new file mode 100644 index 0000000000..5f1b544f94 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/is_placeholder.hpp @@ -0,0 +1,31 @@ +#ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED +#define BOOST_IS_PLACEHOLDER_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 ) +# pragma once +#endif + + +// is_placeholder.hpp - TR1 is_placeholder metafunction +// +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + + +namespace boost +{ + +template< class T > struct is_placeholder +{ + enum _vt { value = 0 }; +}; + +} // namespace boost + +#endif // #ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator.hpp new file mode 100644 index 0000000000..a43cfe138e --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator.hpp @@ -0,0 +1,59 @@ +// interator.hpp workarounds for non-conforming standard libraries ---------// + +// (C) Copyright Beman Dawes 2000. 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/utility for documentation. + +// Revision History +// 12 Jan 01 added for std::ptrdiff_t (Jens Maurer) +// 28 Jun 00 Workarounds to deal with known MSVC bugs (David Abrahams) +// 26 Jun 00 Initial version (Jeremy Siek) + +#ifndef BOOST_ITERATOR_HPP +#define BOOST_ITERATOR_HPP + +#include +#include // std::ptrdiff_t +#include + +namespace boost +{ +# if defined(BOOST_NO_STD_ITERATOR) && !defined(BOOST_MSVC_STD_ITERATOR) + template + struct iterator + { + typedef T value_type; + typedef Distance difference_type; + typedef Pointer pointer; + typedef Reference reference; + typedef Category iterator_category; + }; +# else + + // declare iterator_base in namespace detail to work around MSVC bugs which + // prevent derivation from an identically-named class in a different namespace. + namespace detail { + template +# if !defined(BOOST_MSVC_STD_ITERATOR) + struct iterator_base : std::iterator {}; +# else + struct iterator_base : std::iterator + { + typedef Reference reference; + typedef Pointer pointer; + typedef Distance difference_type; + }; +# endif + } + + template + struct iterator : boost::detail::iterator_base {}; +# endif +} // namespace boost + +#endif // BOOST_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/counting_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/counting_iterator.hpp new file mode 100644 index 0000000000..1298a31f55 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/counting_iterator.hpp @@ -0,0 +1,215 @@ +// Copyright David Abrahams 2003. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef COUNTING_ITERATOR_DWA200348_HPP +# define COUNTING_ITERATOR_DWA200348_HPP + +# include +# include +# include +# include +# include +# include + +namespace boost { + +template < + class Incrementable + , class CategoryOrTraversal + , class Difference +> +class counting_iterator; + +namespace detail +{ + // Try to detect numeric types at compile time in ways compatible + // with the limitations of the compiler and library. + template + struct is_numeric_impl + { + // For a while, this wasn't true, but we rely on it below. This is a regression assert. + BOOST_STATIC_ASSERT(::boost::is_integral::value); + +# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + + BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits::is_specialized); + +# else + +# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + BOOST_STATIC_CONSTANT( + bool, value = ( + boost::is_convertible::value + && boost::is_convertible::value + )); +# else + BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic::value); +# endif + +# endif + }; + + template + struct is_numeric + : mpl::bool_<(::boost::detail::is_numeric_impl::value)> + {}; + +# if defined(BOOST_HAS_LONG_LONG) + template <> + struct is_numeric< ::boost::long_long_type> + : mpl::true_ {}; + + template <> + struct is_numeric< ::boost::ulong_long_type> + : mpl::true_ {}; +# endif + + // Some compilers fail to have a numeric_limits specialization + template <> + struct is_numeric + : mpl::true_ {}; + + template + struct numeric_difference + { + typedef typename boost::detail::numeric_traits::difference_type type; + }; + + BOOST_STATIC_ASSERT(is_numeric::value); + + template + struct counting_iterator_base + { + typedef typename detail::ia_dflt_help< + CategoryOrTraversal + , mpl::eval_if< + is_numeric + , mpl::identity + , iterator_traversal + > + >::type traversal; + + typedef typename detail::ia_dflt_help< + Difference + , mpl::eval_if< + is_numeric + , numeric_difference + , iterator_difference + > + >::type difference; + + typedef iterator_adaptor< + counting_iterator // self + , Incrementable // Base + , Incrementable // Value +# ifndef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY + const // MSVC won't strip this. Instead we enable Thomas' + // criterion (see boost/iterator/detail/facade_iterator_category.hpp) +# endif + , traversal + , Incrementable const& // reference + , difference + > type; + }; + + // Template class distance_policy_select -- choose a policy for computing the + // distance between counting_iterators at compile-time based on whether or not + // the iterator wraps an integer or an iterator, using "poor man's partial + // specialization". + + template struct distance_policy_select; + + // A policy for wrapped iterators + template + struct iterator_distance + { + static Difference distance(Incrementable1 x, Incrementable2 y) + { + return y - x; + } + }; + + // A policy for wrapped numbers + template + struct number_distance + { + static Difference distance(Incrementable1 x, Incrementable2 y) + { + return numeric_distance(x, y); + } + }; +} + +template < + class Incrementable + , class CategoryOrTraversal = use_default + , class Difference = use_default +> +class counting_iterator + : public detail::counting_iterator_base< + Incrementable, CategoryOrTraversal, Difference + >::type +{ + typedef typename detail::counting_iterator_base< + Incrementable, CategoryOrTraversal, Difference + >::type super_t; + + friend class iterator_core_access; + + public: + typedef typename super_t::difference_type difference_type; + + counting_iterator() { } + + counting_iterator(counting_iterator const& rhs) : super_t(rhs.base()) {} + + counting_iterator(Incrementable x) + : super_t(x) + { + } + +# if 0 + template + counting_iterator( + counting_iterator const& t + , typename enable_if_convertible::type* = 0 + ) + : super_t(t.base()) + {} +# endif + + private: + + typename super_t::reference dereference() const + { + return this->base_reference(); + } + + template + difference_type + distance_to(counting_iterator const& y) const + { + typedef typename mpl::if_< + detail::is_numeric + , detail::number_distance + , detail::iterator_distance + >::type d; + + return d::distance(this->base(), y.base()); + } +}; + +// Manufacture a counting iterator for an arbitrary incrementable type +template +inline counting_iterator +make_counting_iterator(Incrementable x) +{ + typedef counting_iterator result_t; + return result_t(x); +} + + +} // namespace boost::iterator + +#endif // COUNTING_ITERATOR_DWA200348_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/any_conversion_eater.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/any_conversion_eater.hpp new file mode 100644 index 0000000000..25fa644889 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/any_conversion_eater.hpp @@ -0,0 +1,19 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef ANY_CONVERSION_EATER_DWA20031117_HPP +# define ANY_CONVERSION_EATER_DWA20031117_HPP + +namespace boost { namespace detail { + +// This type can be used in traits to "eat" up the one user-defined +// implicit conversion allowed. +struct any_conversion_eater +{ + template + any_conversion_eater(T const&); +}; + +}} // namespace boost::detail + +#endif // ANY_CONVERSION_EATER_DWA20031117_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/config_def.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/config_def.hpp new file mode 100644 index 0000000000..fa8d667d97 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/config_def.hpp @@ -0,0 +1,137 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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) + +// no include guard multiple inclusion intended + +// +// This is a temporary workaround until the bulk of this is +// available in boost config. +// 23/02/03 thw +// + +#include // for prior +#include + +#ifdef BOOST_ITERATOR_CONFIG_DEF +# error you have nested config_def #inclusion. +#else +# define BOOST_ITERATOR_CONFIG_DEF +#endif + +// We enable this always now. Otherwise, the simple case in +// libs/iterator/test/constant_iterator_arrow.cpp fails to compile +// because the operator-> return is improperly deduced as a non-const +// pointer. +#if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) + +// Recall that in general, compilers without partial specialization +// can't strip constness. Consider counting_iterator, which normally +// passes a const Value to iterator_facade. As a result, any code +// which makes a std::vector of the iterator's value_type will fail +// when its allocator declares functions overloaded on reference and +// const_reference (the same type). +// +// Furthermore, Borland 5.5.1 drops constness in enough ways that we +// end up using a proxy for operator[] when we otherwise shouldn't. +// Using reference constness gives it an extra hint that it can +// return the value_type from operator[] directly, but is not +// strictly necessary. Not sure how best to resolve this one. + +# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1 + +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \ + || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ + || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + +# define BOOST_NO_LVALUE_RETURN_DETECTION + +# if 0 // test code + struct v {}; + + typedef char (&no)[3]; + + template + no foo(T const&, ...); + + template + char foo(T&, int); + + + struct value_iterator + { + v operator*() const; + }; + + template + struct lvalue_deref_helper + { + static T& x; + enum { value = (sizeof(foo(*x,0)) == 1) }; + }; + + int z2[(lvalue_deref_helper::value == 1) ? 1 : -1]; + int z[(lvalue_deref_helper::value) == 1 ? -1 : 1 ]; +# endif + +#endif + +#if BOOST_WORKAROUND(__MWERKS__, <=0x2407) +# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types" +#endif + +#if BOOST_WORKAROUND(__GNUC__, == 2) \ + || BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: + +# if 0 // test code + #include + template + struct foo + { + foo(T); + + template + foo(foo const& other) : p(other.p) { } + + T p; + }; + + bool x = boost::is_convertible, foo >::value; +# endif + +#endif + + +#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) +# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +#endif + +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# define BOOST_ARG_DEPENDENT_TYPENAME typename +# else +# define BOOST_ARG_DEPENDENT_TYPENAME +# endif + +# if BOOST_WORKAROUND(__GNUC__, == 2) && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(95)) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + +// GCC-2.95 eagerly instantiates templated constructors and conversion +// operators in convertibility checks, causing premature errors. +// +// Borland's problems are harder to diagnose due to lack of an +// instantiation stack backtrace. They may be due in part to the fact +// that it drops cv-qualification willy-nilly in templates. +# define BOOST_NO_ONE_WAY_ITERATOR_INTEROP +# endif + +// no include guard; multiple inclusion intended diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/config_undef.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/config_undef.hpp new file mode 100644 index 0000000000..9dcd1d525f --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/config_undef.hpp @@ -0,0 +1,25 @@ +// (C) Copyright Thomas Witt 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) + +// no include guard multiple inclusion intended + +// +// This is a temporary workaround until the bulk of this is +// available in boost config. +// 23/02/03 thw +// + +#undef BOOST_NO_IS_CONVERTIBLE +#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE +#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +#undef BOOST_ARG_DEPENDENT_TYPENAME +#undef BOOST_NO_LVALUE_RETURN_DETECTION +#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP + +#ifdef BOOST_ITERATOR_CONFIG_DEF +# undef BOOST_ITERATOR_CONFIG_DEF +#else +# error missing or nested #include config_def +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/enable_if.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/enable_if.hpp new file mode 100644 index 0000000000..0fd36fc4bc --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/enable_if.hpp @@ -0,0 +1,86 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_ENABLE_IF_23022003THW_HPP +#define BOOST_ENABLE_IF_23022003THW_HPP + +#include +#include + +#include + +// +// Boost iterators uses its own enable_if cause we need +// special semantics for deficient compilers. +// 23/02/03 thw +// + +namespace boost +{ + + namespace iterators + { + // + // Base machinery for all kinds of enable if + // + template + struct enabled + { + template + struct base + { + typedef T type; + }; + }; + + // + // For compilers that don't support "Substitution Failure Is Not An Error" + // enable_if falls back to always enabled. See comments + // on operator implementation for consequences. + // + template<> + struct enabled + { + template + struct base + { +#ifdef BOOST_NO_SFINAE + + typedef T type; + + // This way to do it would give a nice error message containing + // invalid overload, but has the big disadvantage that + // there is no reference to user code in the error message. + // + // struct invalid_overload; + // typedef invalid_overload type; + // +#endif + }; + }; + + + template + struct enable_if +# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) + : enabled<(Cond::value)>::template base +# else + : mpl::identity +# endif + { +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + typedef Return type; +# endif + }; + + } // namespace iterators + +} // namespace boost + +#include + +#endif // BOOST_ENABLE_IF_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/facade_iterator_category.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/facade_iterator_category.hpp new file mode 100644 index 0000000000..2c4771d5aa --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/facade_iterator_category.hpp @@ -0,0 +1,200 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef FACADE_ITERATOR_CATEGORY_DWA20031118_HPP +# define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP + +# include + +# include // used in iterator_tag inheritance logic +# include +# include +# include +# include +# include + +# include +# include +# include +# include + +# include + +# include // try to keep this last + +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY +# include +# endif + +// +// iterator_category deduction for iterator_facade +// + +// forward declaration +namespace boost { struct use_default; } + +namespace boost { namespace detail { + +struct input_output_iterator_tag + : std::input_iterator_tag +{ + // Using inheritance for only input_iterator_tag helps to avoid + // ambiguities when a stdlib implementation dispatches on a + // function which is overloaded on both input_iterator_tag and + // output_iterator_tag, as STLPort does, in its __valid_range + // function. I claim it's better to avoid the ambiguity in these + // cases. + operator std::output_iterator_tag() const + { + return std::output_iterator_tag(); + } +}; + +// +// True iff the user has explicitly disabled writability of this +// iterator. Pass the iterator_facade's Value parameter and its +// nested ::reference type. +// +template +struct iterator_writability_disabled +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic? + : mpl::or_< + is_const + , boost::detail::indirect_traits::is_reference_to_const + , is_const + > +# else + : is_const +# endif +{}; + + +// +// Convert an iterator_facade's traversal category, Value parameter, +// and ::reference type to an appropriate old-style category. +// +// If writability has been disabled per the above metafunction, the +// result will not be convertible to output_iterator_tag. +// +// Otherwise, if Traversal == single_pass_traversal_tag, the following +// conditions will result in a tag that is convertible both to +// input_iterator_tag and output_iterator_tag: +// +// 1. Reference is a reference to non-const +// 2. Reference is not a reference and is convertible to Value +// +template +struct iterator_facade_default_category + : mpl::eval_if< + mpl::and_< + is_reference + , is_convertible + > + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::if_< + is_convertible + , std::bidirectional_iterator_tag + , std::forward_iterator_tag + > + > + , typename mpl::eval_if< + mpl::and_< + is_convertible + + // check for readability + , is_convertible + > + , mpl::identity + , mpl::identity + > + > +{ +}; + +// True iff T is convertible to an old-style iterator category. +template +struct is_iterator_category + : mpl::or_< + is_convertible + , is_convertible + > +{ +}; + +template +struct is_iterator_traversal + : is_convertible +{}; + +// +// A composite iterator_category tag convertible to Category (a pure +// old-style category) and Traversal (a pure traversal tag). +// Traversal must be a strict increase of the traversal power given by +// Category. +// +template +struct iterator_category_with_traversal + : Category, Traversal +{ +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + // Make sure this isn't used to build any categories where + // convertibility to Traversal is redundant. Should just use the + // Category element in that case. + BOOST_MPL_ASSERT_NOT(( + is_convertible< + typename iterator_category_to_traversal::type + , Traversal + >)); + + BOOST_MPL_ASSERT((is_iterator_category)); + BOOST_MPL_ASSERT_NOT((is_iterator_category)); + BOOST_MPL_ASSERT_NOT((is_iterator_traversal)); +# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) + BOOST_MPL_ASSERT((is_iterator_traversal)); +# endif +# endif +}; + +// Computes an iterator_category tag whose traversal is Traversal and +// which is appropriate for an iterator +template +struct facade_iterator_category_impl +{ +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_MPL_ASSERT_NOT((is_iterator_category)); +# endif + + typedef typename iterator_facade_default_category< + Traversal,ValueParam,Reference + >::type category; + + typedef typename mpl::if_< + is_same< + Traversal + , typename iterator_category_to_traversal::type + > + , category + , iterator_category_with_traversal + >::type type; +}; + +// +// Compute an iterator_category for iterator_facade +// +template +struct facade_iterator_category + : mpl::eval_if< + is_iterator_category + , mpl::identity // old-style categories are fine as-is + , facade_iterator_category_impl + > +{ +}; + +}} // namespace boost::detail + +# include + +#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/minimum_category.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/minimum_category.hpp new file mode 100644 index 0000000000..96501ddd46 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/detail/minimum_category.hpp @@ -0,0 +1,116 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef MINIMUM_CATEGORY_DWA20031119_HPP +# define MINIMUM_CATEGORY_DWA20031119_HPP + +# include +# include + +# include + +namespace boost { namespace detail { +// +// Returns the minimum category type or error_type +// if T1 and T2 are unrelated. +// +// For compilers not supporting is_convertible this only +// works with the new boost return and traversal category +// types. The exact boost _types_ are required. No derived types +// will work. +// +// +template +struct minimum_category_impl +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +{ + template struct apply + { + typedef T2 type; + }; + typedef void type; +} +# endif +; + +template +struct error_not_related_by_convertibility; + +template <> +struct minimum_category_impl +{ + template struct apply + { + typedef T2 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + { + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + { + BOOST_STATIC_ASSERT((is_same::value)); + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + : error_not_related_by_convertibility + { + }; +}; + +template +struct minimum_category +{ + typedef minimum_category_impl< +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround + is_same::value || +# endif + ::boost::is_convertible::value + , ::boost::is_convertible::value +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround + || is_same::value +# endif + > outer; + + typedef typename outer::template apply inner; + typedef typename inner::type type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2)) +}; + +template <> +struct minimum_category +{ + template + struct apply : minimum_category + {}; + + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) +}; + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround +template <> +struct minimum_category +{ + typedef int type; +}; +# endif + +}} // namespace boost::detail + +#endif // MINIMUM_CATEGORY_DWA20031119_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/filter_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/filter_iterator.hpp new file mode 100644 index 0000000000..14d640bf09 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/filter_iterator.hpp @@ -0,0 +1,135 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_FILTER_ITERATOR_23022003THW_HPP +#define BOOST_FILTER_ITERATOR_23022003THW_HPP + +#include +#include +#include + +#include +#include + +namespace boost +{ + template + class filter_iterator; + + namespace detail + { + template + struct filter_iterator_base + { + typedef iterator_adaptor< + filter_iterator + , Iterator + , use_default + , typename mpl::if_< + is_convertible< + typename iterator_traversal::type + , random_access_traversal_tag + > + , bidirectional_traversal_tag + , use_default + >::type + > type; + }; + } + + template + class filter_iterator + : public detail::filter_iterator_base::type + { + typedef typename detail::filter_iterator_base< + Predicate, Iterator + >::type super_t; + + friend class iterator_core_access; + + public: + filter_iterator() { } + + filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(f), m_end(end_) + { + satisfy_predicate(); + } + + filter_iterator(Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(), m_end(end_) + { + // Pro8 is a little too aggressive about instantiating the + // body of this function. +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + // Don't allow use of this constructor if Predicate is a + // function pointer type, since it will be 0. + BOOST_STATIC_ASSERT(is_class::value); +#endif + satisfy_predicate(); + } + + template + filter_iterator( + filter_iterator const& t + , typename enable_if_convertible::type* = 0 + ) + : super_t(t.base()), m_predicate(t.predicate()), m_end(t.end()) {} + + Predicate predicate() const { return m_predicate; } + + Iterator end() const { return m_end; } + + private: + void increment() + { + ++(this->base_reference()); + satisfy_predicate(); + } + + void decrement() + { + while(!this->m_predicate(*--(this->base_reference()))){}; + } + + void satisfy_predicate() + { + while (this->base() != this->m_end && !this->m_predicate(*this->base())) + ++(this->base_reference()); + } + + // Probably should be the initial base class so it can be + // optimized away via EBO if it is an empty class. + Predicate m_predicate; + Iterator m_end; + }; + + template + filter_iterator + make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) + { + return filter_iterator(f,x,end); + } + + template + filter_iterator + make_filter_iterator( + typename iterators::enable_if< + is_class + , Iterator + >::type x + , Iterator end = Iterator() +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + , Predicate* = 0 +#endif + ) + { + return filter_iterator(x,end); + } + +} // namespace boost + +#endif // BOOST_FILTER_ITERATOR_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/indirect_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/indirect_iterator.hpp new file mode 100644 index 0000000000..abff7e7634 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/indirect_iterator.hpp @@ -0,0 +1,139 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_INDIRECT_ITERATOR_23022003THW_HPP +#define BOOST_INDIRECT_ITERATOR_23022003THW_HPP + +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#ifdef BOOST_MPL_CFG_NO_HAS_XXX +# include +# include +# include +# include +#endif + +#include // must be last #include + +namespace boost +{ + template + class indirect_iterator; + + namespace detail + { + template + struct indirect_base + { + typedef typename iterator_traits::value_type dereferenceable; + + typedef iterator_adaptor< + indirect_iterator + , Iter + , typename ia_dflt_help< + Value, pointee + >::type + , Category + , typename ia_dflt_help< + Reference + , mpl::eval_if< + is_same + , indirect_reference + , add_reference + > + >::type + , Difference + > type; + }; + + template <> + struct indirect_base {}; + } // namespace detail + + + template < + class Iterator + , class Value = use_default + , class Category = use_default + , class Reference = use_default + , class Difference = use_default + > + class indirect_iterator + : public detail::indirect_base< + Iterator, Value, Category, Reference, Difference + >::type + { + typedef typename detail::indirect_base< + Iterator, Value, Category, Reference, Difference + >::type super_t; + + friend class iterator_core_access; + + public: + indirect_iterator() {} + + indirect_iterator(Iterator iter) + : super_t(iter) {} + + template < + class Iterator2, class Value2, class Category2 + , class Reference2, class Difference2 + > + indirect_iterator( + indirect_iterator< + Iterator2, Value2, Category2, Reference2, Difference2 + > const& y + , typename enable_if_convertible::type* = 0 + ) + : super_t(y.base()) + {} + + private: + typename super_t::reference dereference() const + { +# if BOOST_WORKAROUND(__BORLANDC__, < 0x5A0 ) + return const_cast(**this->base()); +# else + return **this->base(); +# endif + } + }; + + template + inline + indirect_iterator make_indirect_iterator(Iter x) + { + return indirect_iterator(x); + } + + template + inline + indirect_iterator make_indirect_iterator(Iter x, Traits* = 0) + { + return indirect_iterator(x); + } + +} // namespace boost + +#include + +#endif // BOOST_INDIRECT_ITERATOR_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/interoperable.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/interoperable.hpp new file mode 100644 index 0000000000..c13dd9b47b --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/interoperable.hpp @@ -0,0 +1,50 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_INTEROPERABLE_23022003THW_HPP +# define BOOST_INTEROPERABLE_23022003THW_HPP + +# include +# include + +# include + +# include // must appear last + +namespace boost +{ + + // + // Meta function that determines whether two + // iterator types are considered interoperable. + // + // Two iterator types A,B are considered interoperable if either + // A is convertible to B or vice versa. + // This interoperability definition is in sync with the + // standards requirements on constant/mutable container + // iterators (23.1 [lib.container.requirements]). + // + // For compilers that don't support is_convertible + // is_interoperable gives false positives. See comments + // on operator implementation for consequences. + // + template + struct is_interoperable +# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY + : mpl::true_ +# else + : mpl::or_< + is_convertible< A, B > + , is_convertible< B, A > > +# endif + { + }; + +} // namespace boost + +# include + +#endif // BOOST_INTEROPERABLE_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/is_lvalue_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/is_lvalue_iterator.hpp new file mode 100644 index 0000000000..3beb90df6d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/is_lvalue_iterator.hpp @@ -0,0 +1,150 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP +# define IS_LVALUE_ITERATOR_DWA2003112_HPP + +#include + +#include +#include + +#include + +// should be the last #includes +#include +#include + +#ifndef BOOST_NO_IS_CONVERTIBLE + +namespace boost { + +namespace detail +{ +#ifndef BOOST_NO_LVALUE_RETURN_DETECTION + // Calling lvalue_preserver( , 0 ) returns a reference + // to the expression's result if is an lvalue, or + // not_an_lvalue() otherwise. + struct not_an_lvalue {}; + + template + T& lvalue_preserver(T&, int); + + template + not_an_lvalue lvalue_preserver(U const&, ...); + +# define BOOST_LVALUE_PRESERVER(expr) detail::lvalue_preserver(expr,0) + +#else + +# define BOOST_LVALUE_PRESERVER(expr) expr + +#endif + + // Guts of is_lvalue_iterator. Value is the iterator's value_type + // and the result is computed in the nested rebind template. + template + struct is_lvalue_iterator_impl + { + // Eat implicit conversions so we don't report true for things + // convertible to Value const& + struct conversion_eater + { + conversion_eater(Value&); + }; + + static char tester(conversion_eater, int); + static char (& tester(any_conversion_eater, ...) )[2]; + + template + struct rebind + { + static It& x; + + BOOST_STATIC_CONSTANT( + bool + , value = ( + sizeof( + is_lvalue_iterator_impl::tester( + BOOST_LVALUE_PRESERVER(*x), 0 + ) + ) == 1 + ) + ); + }; + }; + +#undef BOOST_LVALUE_PRESERVER + + // + // void specializations to handle std input and output iterators + // + template <> + struct is_lvalue_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; + +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS + template <> + struct is_lvalue_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; + + template <> + struct is_lvalue_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; + + template <> + struct is_lvalue_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; +#endif + + // + // This level of dispatching is required for Borland. We might save + // an instantiation by removing it for others. + // + template + struct is_readable_lvalue_iterator_impl + : is_lvalue_iterator_impl< + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type const + >::template rebind + {}; + + template + struct is_non_const_lvalue_iterator_impl + : is_lvalue_iterator_impl< + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type + >::template rebind + {}; +} // namespace detail + +// Define the trait with full mpl lambda capability and various broken +// compiler workarounds +BOOST_TT_AUX_BOOL_TRAIT_DEF1( + is_lvalue_iterator,T,::boost::detail::is_readable_lvalue_iterator_impl::value) + +BOOST_TT_AUX_BOOL_TRAIT_DEF1( + is_non_const_lvalue_iterator,T,::boost::detail::is_non_const_lvalue_iterator_impl::value) + +} // namespace boost + +#endif + +#include +#include + +#endif // IS_LVALUE_ITERATOR_DWA2003112_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/is_readable_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/is_readable_iterator.hpp new file mode 100644 index 0000000000..60d6ff07f5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/is_readable_iterator.hpp @@ -0,0 +1,108 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef IS_READABLE_ITERATOR_DWA2003112_HPP +# define IS_READABLE_ITERATOR_DWA2003112_HPP + +#include +#include + +#include +#include + +// should be the last #include +#include + +#ifndef BOOST_NO_IS_CONVERTIBLE + +namespace boost { + +namespace detail +{ + // Guts of is_readable_iterator. Value is the iterator's value_type + // and the result is computed in the nested rebind template. + template + struct is_readable_iterator_impl + { + static char tester(Value&, int); + static char (& tester(any_conversion_eater, ...) )[2]; + + template + struct rebind + { + static It& x; + + BOOST_STATIC_CONSTANT( + bool + , value = ( + sizeof( + is_readable_iterator_impl::tester(*x, 1) + ) == 1 + ) + ); + }; + }; + +#undef BOOST_READABLE_PRESERVER + + // + // void specializations to handle std input and output iterators + // + template <> + struct is_readable_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; + +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS + template <> + struct is_readable_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; + + template <> + struct is_readable_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; + + template <> + struct is_readable_iterator_impl + { + template + struct rebind : boost::mpl::false_ + {}; + }; +#endif + + // + // This level of dispatching is required for Borland. We might save + // an instantiation by removing it for others. + // + template + struct is_readable_iterator_impl2 + : is_readable_iterator_impl< + BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type const + >::template rebind + {}; +} // namespace detail + +// Define the trait with full mpl lambda capability and various broken +// compiler workarounds +BOOST_TT_AUX_BOOL_TRAIT_DEF1( + is_readable_iterator,T,::boost::detail::is_readable_iterator_impl2::value) + +} // namespace boost + +#endif + +#include + +#endif // IS_READABLE_ITERATOR_DWA2003112_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_adaptor.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_adaptor.hpp new file mode 100644 index 0000000000..27b08ff018 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_adaptor.hpp @@ -0,0 +1,371 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_ITERATOR_ADAPTOR_23022003THW_HPP +#define BOOST_ITERATOR_ADAPTOR_23022003THW_HPP + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY +# include + +# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) +# include +# endif + +#else +# include +#endif + +#include + +#include + +namespace boost +{ + // Used as a default template argument internally, merely to + // indicate "use the default", this can also be passed by users + // explicitly in order to specify that the default should be used. + struct use_default; + +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // the incompleteness of use_default causes massive problems for + // is_convertible (naturally). This workaround is fortunately not + // needed for vc6/vc7. + template + struct is_convertible + : mpl::false_ {}; +# endif + + namespace detail + { + + // + // Result type used in enable_if_convertible meta function. + // This can be an incomplete type, as only pointers to + // enable_if_convertible< ... >::type are used. + // We could have used void for this, but conversion to + // void* is just to easy. + // + struct enable_type; + } + + + // + // enable_if for use in adapted iterators constructors. + // + // In order to provide interoperability between adapted constant and + // mutable iterators, adapted iterators will usually provide templated + // conversion constructors of the following form + // + // template + // class adapted_iterator : + // public iterator_adaptor< adapted_iterator, Iterator > + // { + // public: + // + // ... + // + // template + // adapted_iterator( + // OtherIterator const& it + // , typename enable_if_convertible::type* = 0); + // + // ... + // }; + // + // enable_if_convertible is used to remove those overloads from the overload + // set that cannot be instantiated. For all practical purposes only overloads + // for constant/mutable interaction will remain. This has the advantage that + // meta functions like boost::is_convertible do not return false positives, + // as they can only look at the signature of the conversion constructor + // and not at the actual instantiation. + // + // enable_if_interoperable can be safely used in user code. It falls back to + // always enabled for compilers that don't support enable_if or is_convertible. + // There is no need for compiler specific workarounds in user code. + // + // The operators implementation relies on boost::is_convertible not returning + // false positives for user/library defined iterator types. See comments + // on operator implementation for consequences. + // +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + + template + struct enable_if_convertible + { + typedef typename mpl::if_< + mpl::or_< + is_same + , is_convertible + > + , boost::detail::enable_type + , int& + >::type type; + }; + +# elif defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) + + template + struct enable_if_convertible + { + typedef boost::detail::enable_type type; + }; + +# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300 + + // For some reason vc7.1 needs us to "cut off" instantiation + // of is_convertible in a few cases. + template + struct enable_if_convertible + : iterators::enable_if< + mpl::or_< + is_same + , is_convertible + > + , boost::detail::enable_type + > + {}; + +# else + + template + struct enable_if_convertible + : iterators::enable_if< + is_convertible + , boost::detail::enable_type + > + {}; + +# endif + + // + // Default template argument handling for iterator_adaptor + // + namespace detail + { + // If T is use_default, return the result of invoking + // DefaultNullaryFn, otherwise return T. + template + struct ia_dflt_help + : mpl::eval_if< + is_same + , DefaultNullaryFn + , mpl::identity + > + { + }; + + // A metafunction which computes an iterator_adaptor's base class, + // a specialization of iterator_facade. + template < + class Derived + , class Base + , class Value + , class Traversal + , class Reference + , class Difference + > + struct iterator_adaptor_base + { + typedef iterator_facade< + Derived + +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY + , typename boost::detail::ia_dflt_help< + Value + , mpl::eval_if< + is_same + , iterator_value + , remove_reference + > + >::type +# else + , typename boost::detail::ia_dflt_help< + Value, iterator_value + >::type +# endif + + , typename boost::detail::ia_dflt_help< + Traversal + , iterator_traversal + >::type + + , typename boost::detail::ia_dflt_help< + Reference + , mpl::eval_if< + is_same + , iterator_reference + , add_reference + > + >::type + + , typename boost::detail::ia_dflt_help< + Difference, iterator_difference + >::type + > + type; + }; + + // workaround for aC++ CR JAGaf33512 + template + inline void iterator_adaptor_assert_traversal () + { + BOOST_STATIC_ASSERT((is_convertible::value)); + } + } + + // + // Iterator Adaptor + // + // The parameter ordering changed slightly with respect to former + // versions of iterator_adaptor The idea is that when the user needs + // to fiddle with the reference type it is highly likely that the + // iterator category has to be adjusted as well. Any of the + // following four template arguments may be ommitted or explicitly + // replaced by use_default. + // + // Value - if supplied, the value_type of the resulting iterator, unless + // const. If const, a conforming compiler strips constness for the + // value_type. If not supplied, iterator_traits::value_type is used + // + // Category - the traversal category of the resulting iterator. If not + // supplied, iterator_traversal::type is used. + // + // Reference - the reference type of the resulting iterator, and in + // particular, the result type of operator*(). If not supplied but + // Value is supplied, Value& is used. Otherwise + // iterator_traits::reference is used. + // + // Difference - the difference_type of the resulting iterator. If not + // supplied, iterator_traits::difference_type is used. + // + template < + class Derived + , class Base + , class Value = use_default + , class Traversal = use_default + , class Reference = use_default + , class Difference = use_default + > + class iterator_adaptor + : public boost::detail::iterator_adaptor_base< + Derived, Base, Value, Traversal, Reference, Difference + >::type + { + friend class iterator_core_access; + + protected: + typedef typename boost::detail::iterator_adaptor_base< + Derived, Base, Value, Traversal, Reference, Difference + >::type super_t; + public: + iterator_adaptor() {} + + explicit iterator_adaptor(Base const &iter) + : m_iterator(iter) + { + } + + typedef Base base_type; + + Base const& base() const + { return m_iterator; } + + protected: + // for convenience in derived classes + typedef iterator_adaptor iterator_adaptor_; + + // + // lvalue access to the Base object for Derived + // + Base const& base_reference() const + { return m_iterator; } + + Base& base_reference() + { return m_iterator; } + + private: + // + // Core iterator interface for iterator_facade. This is private + // to prevent temptation for Derived classes to use it, which + // will often result in an error. Derived classes should use + // base_reference(), above, to get direct access to m_iterator. + // + typename super_t::reference dereference() const + { return *m_iterator; } + + template < + class OtherDerived, class OtherIterator, class V, class C, class R, class D + > + bool equal(iterator_adaptor const& x) const + { + // Maybe readd with same_distance + // BOOST_STATIC_ASSERT( + // (detail::same_category_and_difference::value) + // ); + return m_iterator == x.base(); + } + + typedef typename iterator_category_to_traversal< + typename super_t::iterator_category + >::type my_traversal; + +# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ + boost::detail::iterator_adaptor_assert_traversal(); + + void advance(typename super_t::difference_type n) + { + BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag) + m_iterator += n; + } + + void increment() { ++m_iterator; } + + void decrement() + { + BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(bidirectional_traversal_tag) + --m_iterator; + } + + template < + class OtherDerived, class OtherIterator, class V, class C, class R, class D + > + typename super_t::difference_type distance_to( + iterator_adaptor const& y) const + { + BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag) + // Maybe readd with same_distance + // BOOST_STATIC_ASSERT( + // (detail::same_category_and_difference::value) + // ); + return y.base() - m_iterator; + } + +# undef BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL + + private: // data members + Base m_iterator; + }; + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_ADAPTOR_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_archetypes.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_archetypes.hpp new file mode 100644 index 0000000000..039de1cf74 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_archetypes.hpp @@ -0,0 +1,515 @@ +// (C) Copyright Jeremy Siek 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ITERATOR_ARCHETYPES_HPP +#define BOOST_ITERATOR_ARCHETYPES_HPP + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { + +template +struct access_archetype; + +template +struct traversal_archetype; + +namespace iterator_archetypes +{ + enum { + readable_iterator_bit = 1 + , writable_iterator_bit = 2 + , swappable_iterator_bit = 4 + , lvalue_iterator_bit = 8 + }; + + // Not quite tags, since dispatching wouldn't work. + typedef mpl::int_::type readable_iterator_t; + typedef mpl::int_::type writable_iterator_t; + + typedef mpl::int_< + (readable_iterator_bit|writable_iterator_bit) + >::type readable_writable_iterator_t; + + typedef mpl::int_< + (readable_iterator_bit|lvalue_iterator_bit) + >::type readable_lvalue_iterator_t; + + typedef mpl::int_< + (lvalue_iterator_bit|writable_iterator_bit) + >::type writable_lvalue_iterator_t; + + typedef mpl::int_::type swappable_iterator_t; + typedef mpl::int_::type lvalue_iterator_t; + + template + struct has_access + : mpl::equal_to< + mpl::bitand_ + , Base + > + {}; +} + +namespace detail +{ + template + struct assign_proxy + { + assign_proxy& operator=(T) { return *this; } + }; + + template + struct read_proxy + { + operator T() { return static_object::get(); } + }; + + template + struct read_write_proxy + : read_proxy // Use to inherit from assign_proxy, but that doesn't work. -JGS + { + read_write_proxy& operator=(T) { return *this; } + }; + + template + struct arrow_proxy + { + T const* operator->() const { return 0; } + }; + + struct no_operator_brackets {}; + + template + struct readable_operator_brackets + { + read_proxy operator[](std::ptrdiff_t n) const { return read_proxy(); } + }; + + template + struct writable_operator_brackets + { + read_write_proxy operator[](std::ptrdiff_t n) const { return read_write_proxy(); } + }; + + template + struct operator_brackets + : mpl::aux::msvc_eti_base< + typename mpl::eval_if< + is_convertible + , mpl::eval_if< + iterator_archetypes::has_access< + AccessCategory + , iterator_archetypes::writable_iterator_t + > + , mpl::identity > + , mpl::if_< + iterator_archetypes::has_access< + AccessCategory + , iterator_archetypes::readable_iterator_t + > + , readable_operator_brackets + , no_operator_brackets + > + > + , mpl::identity + >::type + >::type + {}; + + template + struct traversal_archetype_impl + { + template struct archetype; + }; + + // Constructor argument for those iterators that + // are not default constructible + struct ctor_arg {}; + + template + struct traversal_archetype_ + : mpl::aux::msvc_eti_base< + typename traversal_archetype_impl::template archetype + >::type + { + typedef typename + traversal_archetype_impl::template archetype + base; + + traversal_archetype_() {} + + traversal_archetype_(ctor_arg arg) + : base(arg) + {} + }; + + template <> + struct traversal_archetype_impl + { + template + struct archetype + { + explicit archetype(ctor_arg) {} + + struct bogus { }; // This use to be void, but that causes trouble for iterator_facade. Need more research. -JGS + typedef bogus difference_type; + + Derived& operator++() { return (Derived&)static_object::get(); } + Derived operator++(int) const { return (Derived&)static_object::get(); } + }; + }; + + template <> + struct traversal_archetype_impl + { + template + struct archetype + : public equality_comparable< traversal_archetype_ >, + public traversal_archetype_ + { + explicit archetype(ctor_arg arg) + : traversal_archetype_(arg) + {} + + typedef std::ptrdiff_t difference_type; + }; + }; + + template + bool operator==(traversal_archetype_ const&, + traversal_archetype_ const&) { return true; } + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + // doesn't seem to pick up != from equality_comparable + template + bool operator!=(traversal_archetype_ const&, + traversal_archetype_ const&) { return true; } +#endif + template <> + struct traversal_archetype_impl + { + template + struct archetype + : public traversal_archetype_ + { + archetype() + : traversal_archetype_(ctor_arg()) + {} + }; + }; + + template <> + struct traversal_archetype_impl + { + template + struct archetype + : public traversal_archetype_ + { + Derived& operator--() { return static_object::get(); } + Derived operator--(int) const { return static_object::get(); } + }; + }; + + template <> + struct traversal_archetype_impl + { + template + struct archetype + : public traversal_archetype_ + { + Derived& operator+=(std::ptrdiff_t) { return static_object::get(); } + Derived& operator-=(std::ptrdiff_t) { return static_object::get(); } + }; + }; + + template + Derived& operator+(traversal_archetype_ const&, + std::ptrdiff_t) { return static_object::get(); } + + template + Derived& operator+(std::ptrdiff_t, + traversal_archetype_ const&) + { return static_object::get(); } + + template + Derived& operator-(traversal_archetype_ const&, + std::ptrdiff_t) + { return static_object::get(); } + + template + std::ptrdiff_t operator-(traversal_archetype_ const&, + traversal_archetype_ const&) + { return 0; } + + template + bool operator<(traversal_archetype_ const&, + traversal_archetype_ const&) + { return true; } + + template + bool operator>(traversal_archetype_ const&, + traversal_archetype_ const&) + { return true; } + + template + bool operator<=(traversal_archetype_ const&, + traversal_archetype_ const&) + { return true; } + + template + bool operator>=(traversal_archetype_ const&, + traversal_archetype_ const&) + { return true; } + + struct bogus_type; + + template + struct convertible_type + : mpl::if_< is_const, + typename remove_const::type, + bogus_type > + {}; + +} // namespace detail + + +template struct undefined; + +template +struct iterator_access_archetype_impl +{ + template struct archetype; +}; + +template +struct iterator_access_archetype + : mpl::aux::msvc_eti_base< + typename iterator_access_archetype_impl< + AccessCategory + >::template archetype + >::type +{ +}; + +template <> +struct iterator_access_archetype_impl< + iterator_archetypes::readable_iterator_t +> +{ + template + struct archetype + { + typedef typename remove_cv::type value_type; + typedef Value reference; + typedef Value* pointer; + + value_type operator*() const { return static_object::get(); } + + detail::arrow_proxy operator->() const { return detail::arrow_proxy(); } + }; +}; + +template <> +struct iterator_access_archetype_impl< + iterator_archetypes::writable_iterator_t +> +{ + template + struct archetype + { +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_STATIC_ASSERT(!is_const::value); +# endif + typedef void value_type; + typedef void reference; + typedef void pointer; + + detail::assign_proxy operator*() const { return detail::assign_proxy(); } + }; +}; + +template <> +struct iterator_access_archetype_impl< + iterator_archetypes::readable_writable_iterator_t +> +{ + template + struct archetype + : public virtual iterator_access_archetype< + Value, iterator_archetypes::readable_iterator_t + > + { + typedef detail::read_write_proxy reference; + + detail::read_write_proxy operator*() const { return detail::read_write_proxy(); } + }; +}; + +template <> +struct iterator_access_archetype_impl +{ + template + struct archetype + : public virtual iterator_access_archetype< + Value, iterator_archetypes::readable_iterator_t + > + { + typedef Value& reference; + + Value& operator*() const { return static_object::get(); } + Value* operator->() const { return 0; } + }; +}; + +template <> +struct iterator_access_archetype_impl +{ + template + struct archetype + : public virtual iterator_access_archetype< + Value, iterator_archetypes::readable_lvalue_iterator_t + > + { +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_STATIC_ASSERT((!is_const::value)); +# endif + }; +}; + + +template +struct iterator_archetype; + +template +struct traversal_archetype_base + : detail::operator_brackets< + typename remove_cv::type + , AccessCategory + , TraversalCategory + > + , detail::traversal_archetype_< + iterator_archetype + , Value + , TraversalCategory + > +{ +}; + +namespace detail +{ + template + struct iterator_archetype_base + : iterator_access_archetype + , traversal_archetype_base + { + typedef iterator_access_archetype access; + + typedef typename detail::facade_iterator_category< + TraversalCategory + , typename mpl::eval_if< + iterator_archetypes::has_access< + AccessCategory, iterator_archetypes::writable_iterator_t + > + , remove_const + , add_const + >::type + , typename access::reference + >::type iterator_category; + + // Needed for some broken libraries (see below) + typedef boost::iterator< + iterator_category + , Value + , typename traversal_archetype_base< + Value, AccessCategory, TraversalCategory + >::difference_type + , typename access::pointer + , typename access::reference + > workaround_iterator_base; + }; +} + +template +struct iterator_archetype + : public detail::iterator_archetype_base + + // These broken libraries require derivation from std::iterator + // (or related magic) in order to handle iter_swap and other + // iterator operations +# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, < 310) \ + || BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(0x20101)) + , public detail::iterator_archetype_base< + Value, AccessCategory, TraversalCategory + >::workaround_iterator_base +# endif +{ + // Derivation from std::iterator above caused references to nested + // types to be ambiguous, so now we have to redeclare them all + // here. +# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, < 310) \ + || BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(0x20101)) + + typedef detail::iterator_archetype_base< + Value,AccessCategory,TraversalCategory + > base; + + typedef typename base::value_type value_type; + typedef typename base::reference reference; + typedef typename base::pointer pointer; + typedef typename base::difference_type difference_type; + typedef typename base::iterator_category iterator_category; +# endif + + iterator_archetype() { } + iterator_archetype(iterator_archetype const& x) + : detail::iterator_archetype_base< + Value + , AccessCategory + , TraversalCategory + >(x) + {} + + iterator_archetype& operator=(iterator_archetype const&) + { return *this; } + +# if 0 + // Optional conversion from mutable + iterator_archetype( + iterator_archetype< + typename detail::convertible_type::type + , AccessCategory + , TraversalCategory> const& + ); +# endif +}; + +} // namespace boost + + +#endif // BOOST_ITERATOR_ARCHETYPES_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_categories.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_categories.hpp new file mode 100644 index 0000000000..1740d9818a --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_categories.hpp @@ -0,0 +1,188 @@ +// (C) Copyright Jeremy Siek 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ITERATOR_CATEGORIES_HPP +# define BOOST_ITERATOR_CATEGORIES_HPP + +# include +# include +# include + +# include + +# include +# include +# include +# include + +# include + +# include + +namespace boost { + +// +// Traversal Categories +// + +struct no_traversal_tag {}; + +struct incrementable_traversal_tag + : no_traversal_tag +{ +// incrementable_traversal_tag() {} +// incrementable_traversal_tag(std::output_iterator_tag const&) {}; +}; + +struct single_pass_traversal_tag + : incrementable_traversal_tag +{ +// single_pass_traversal_tag() {} +// single_pass_traversal_tag(std::input_iterator_tag const&) {}; +}; + +struct forward_traversal_tag + : single_pass_traversal_tag +{ +// forward_traversal_tag() {} +// forward_traversal_tag(std::forward_iterator_tag const&) {}; +}; + +struct bidirectional_traversal_tag + : forward_traversal_tag +{ +// bidirectional_traversal_tag() {}; +// bidirectional_traversal_tag(std::bidirectional_iterator_tag const&) {}; +}; + +struct random_access_traversal_tag + : bidirectional_traversal_tag +{ +// random_access_traversal_tag() {}; +// random_access_traversal_tag(std::random_access_iterator_tag const&) {}; +}; + +namespace detail +{ + // + // Convert a "strictly old-style" iterator category to a traversal + // tag. This is broken out into a separate metafunction to reduce + // the cost of instantiating iterator_category_to_traversal, below, + // for new-style types. + // + template + struct old_category_to_traversal + : mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , void + > + > + > + > + > + {}; + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template <> + struct old_category_to_traversal + { + typedef int type; + }; +# endif + + template + struct pure_traversal_tag + : mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , void + > + > + > + > + > + { + }; + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template <> + struct pure_traversal_tag + { + typedef int type; + }; +# endif + +} // namespace detail + + +// +// Convert an iterator category into a traversal tag +// +template +struct iterator_category_to_traversal + : mpl::eval_if< // if already convertible to a traversal tag, we're done. + is_convertible + , mpl::identity + , boost::detail::old_category_to_traversal + > +{}; + +// Trait to get an iterator's traversal category +template +struct iterator_traversal + : iterator_category_to_traversal< + typename boost::detail::iterator_traits::iterator_category + > +{}; + +# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT +// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work +// out well. Instantiating the nested apply template also +// requires instantiating iterator_traits on the +// placeholder. Instead we just specialize it as a metafunction +// class. +template <> +struct iterator_traversal +{ + template + struct apply : iterator_traversal + {}; +}; +template <> +struct iterator_traversal + : iterator_traversal +{}; +# endif + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_CATEGORIES_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_concepts.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_concepts.hpp new file mode 100644 index 0000000000..ced1112a61 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_concepts.hpp @@ -0,0 +1,284 @@ +// (C) Copyright Jeremy Siek 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ITERATOR_CONCEPTS_HPP +#define BOOST_ITERATOR_CONCEPTS_HPP + +#include +#include + +// Use boost::detail::iterator_traits to work around some MSVC/Dinkumware problems. +#include + +#include +#include + +#include +#include +#include +#include + +#include + +// Use boost/limits to work around missing limits headers on some compilers +#include +#include + +#include + +#include + +namespace boost_concepts +{ + // Used a different namespace here (instead of "boost") so that the + // concept descriptions do not take for granted the names in + // namespace boost. + + //=========================================================================== + // Iterator Access Concepts + + BOOST_concept(ReadableIterator,(Iterator)) + : boost::Assignable + , boost::CopyConstructible + + { + typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference reference; + + BOOST_CONCEPT_USAGE(ReadableIterator) + { + + value_type v = *i; + boost::ignore_unused_variable_warning(v); + } + private: + Iterator i; + }; + + template < + typename Iterator + , typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type + > + struct WritableIterator + : boost::CopyConstructible + { + BOOST_CONCEPT_USAGE(WritableIterator) + { + *i = v; + } + private: + ValueType v; + Iterator i; + }; + + template < + typename Iterator + , typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type + > + struct WritableIteratorConcept : WritableIterator {}; + + BOOST_concept(SwappableIterator,(Iterator)) + { + BOOST_CONCEPT_USAGE(SwappableIterator) + { + std::iter_swap(i1, i2); + } + private: + Iterator i1; + Iterator i2; + }; + + BOOST_concept(LvalueIterator,(Iterator)) + { + typedef typename boost::detail::iterator_traits::value_type value_type; + + BOOST_CONCEPT_USAGE(LvalueIterator) + { + value_type& r = const_cast(*i); + boost::ignore_unused_variable_warning(r); + } + private: + Iterator i; + }; + + + //=========================================================================== + // Iterator Traversal Concepts + + BOOST_concept(IncrementableIterator,(Iterator)) + : boost::Assignable + , boost::CopyConstructible + { + typedef typename boost::iterator_traversal::type traversal_category; + + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + traversal_category + , boost::incrementable_traversal_tag + >)); + + BOOST_CONCEPT_USAGE(IncrementableIterator) + { + ++i; + (void)i++; + } + private: + Iterator i; + }; + + BOOST_concept(SinglePassIterator,(Iterator)) + : IncrementableIterator + , boost::EqualityComparable + + { + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME SinglePassIterator::traversal_category + , boost::single_pass_traversal_tag + > )); + }; + + BOOST_concept(ForwardTraversal,(Iterator)) + : SinglePassIterator + , boost::DefaultConstructible + { + typedef typename boost::detail::iterator_traits::difference_type difference_type; + + BOOST_MPL_ASSERT((boost::is_integral)); + BOOST_MPL_ASSERT_RELATION(std::numeric_limits::is_signed, ==, true); + + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME ForwardTraversal::traversal_category + , boost::forward_traversal_tag + > )); + }; + + BOOST_concept(BidirectionalTraversal,(Iterator)) + : ForwardTraversal + { + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalTraversal::traversal_category + , boost::bidirectional_traversal_tag + > )); + + BOOST_CONCEPT_USAGE(BidirectionalTraversal) + { + --i; + (void)i--; + } + private: + Iterator i; + }; + + BOOST_concept(RandomAccessTraversal,(Iterator)) + : BidirectionalTraversal + { + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME RandomAccessTraversal::traversal_category + , boost::random_access_traversal_tag + > )); + + BOOST_CONCEPT_USAGE(RandomAccessTraversal) + { + i += n; + i = i + n; + i = n + i; + i -= n; + i = i - n; + n = i - j; + } + + private: + typename BidirectionalTraversal::difference_type n; + Iterator i, j; + }; + + //=========================================================================== + // Iterator Interoperability + + namespace detail + { + template + void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2) + { + bool b; + b = i1 == i2; + b = i1 != i2; + + b = i2 == i1; + b = i2 != i1; + boost::ignore_unused_variable_warning(b); + } + + template + void interop_rand_access_constraints( + Iterator1 const& i1, Iterator2 const& i2, + boost::random_access_traversal_tag, boost::random_access_traversal_tag) + { + bool b; + typename boost::detail::iterator_traits::difference_type n; + b = i1 < i2; + b = i1 <= i2; + b = i1 > i2; + b = i1 >= i2; + n = i1 - i2; + + b = i2 < i1; + b = i2 <= i1; + b = i2 > i1; + b = i2 >= i1; + n = i2 - i1; + boost::ignore_unused_variable_warning(b); + boost::ignore_unused_variable_warning(n); + } + + template + void interop_rand_access_constraints( + Iterator1 const&, Iterator2 const&, + boost::single_pass_traversal_tag, boost::single_pass_traversal_tag) + { } + + } // namespace detail + + BOOST_concept(InteroperableIterator,(Iterator)(ConstIterator)) + { + private: + typedef typename boost::detail::pure_traversal_tag< + typename boost::iterator_traversal< + Iterator + >::type + >::type traversal_category; + + typedef typename boost::detail::pure_traversal_tag< + typename boost::iterator_traversal< + ConstIterator + >::type + >::type const_traversal_category; + + public: + BOOST_CONCEPT_ASSERT((SinglePassIterator)); + BOOST_CONCEPT_ASSERT((SinglePassIterator)); + + BOOST_CONCEPT_USAGE(InteroperableIterator) + { + detail::interop_single_pass_constraints(i, ci); + detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category()); + + ci = i; + } + + private: + Iterator i; + ConstIterator ci; + }; + +} // namespace boost_concepts + +#include + +#endif // BOOST_ITERATOR_CONCEPTS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_facade.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_facade.hpp new file mode 100644 index 0000000000..967d60f2ba --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_facade.hpp @@ -0,0 +1,878 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP +#define BOOST_ITERATOR_FACADE_23022003THW_HPP + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include // this goes last + +namespace boost +{ + // This forward declaration is required for the friend declaration + // in iterator_core_access + template class iterator_facade; + + namespace detail + { + // A binary metafunction class that always returns bool. VC6 + // ICEs on mpl::always, probably because of the default + // parameters. + struct always_bool2 + { + template + struct apply + { + typedef bool type; + }; + }; + + // + // enable if for use in operator implementation. + // + template < + class Facade1 + , class Facade2 + , class Return + > + struct enable_if_interoperable +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + { + typedef typename mpl::if_< + mpl::or_< + is_convertible + , is_convertible + > + , Return + , int[3] + >::type type; + }; +#else + : ::boost::iterators::enable_if< + mpl::or_< + is_convertible + , is_convertible + > + , Return + > + {}; +#endif + + // + // Generates associated types for an iterator_facade with the + // given parameters. + // + template < + class ValueParam + , class CategoryOrTraversal + , class Reference + , class Difference + > + struct iterator_facade_types + { + typedef typename facade_iterator_category< + CategoryOrTraversal, ValueParam, Reference + >::type iterator_category; + + typedef typename remove_const::type value_type; + + typedef typename mpl::eval_if< + boost::detail::iterator_writability_disabled + , add_pointer + , add_pointer + >::type pointer; + +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \ + || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \ + || BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \ + || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310) + + // To interoperate with some broken library/compiler + // combinations, user-defined iterators must be derived from + // std::iterator. It is possible to implement a standard + // library for broken compilers without this limitation. +# define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1 + + typedef + iterator + base; +# endif + }; + + // iterators whose dereference operators reference the same value + // for all iterators into the same sequence (like many input + // iterators) need help with their postfix ++: the referenced + // value must be read and stored away before the increment occurs + // so that *a++ yields the originally referenced element and not + // the next one. + template + class postfix_increment_proxy + { + typedef typename iterator_value::type value_type; + public: + explicit postfix_increment_proxy(Iterator const& x) + : stored_value(*x) + {} + + // Returning a mutable reference allows nonsense like + // (*r++).mutate(), but it imposes fewer assumptions about the + // behavior of the value_type. In particular, recall taht + // (*r).mutate() is legal if operator* returns by value. + value_type& + operator*() const + { + return this->stored_value; + } + private: + mutable value_type stored_value; + }; + + // + // In general, we can't determine that such an iterator isn't + // writable -- we also need to store a copy of the old iterator so + // that it can be written into. + template + class writable_postfix_increment_proxy + { + typedef typename iterator_value::type value_type; + public: + explicit writable_postfix_increment_proxy(Iterator const& x) + : stored_value(*x) + , stored_iterator(x) + {} + + // Dereferencing must return a proxy so that both *r++ = o and + // value_type(*r++) can work. In this case, *r is the same as + // *r++, and the conversion operator below is used to ensure + // readability. + writable_postfix_increment_proxy const& + operator*() const + { + return *this; + } + + // Provides readability of *r++ + operator value_type&() const + { + return stored_value; + } + + // Provides writability of *r++ + template + T const& operator=(T const& x) const + { + *this->stored_iterator = x; + return x; + } + + // This overload just in case only non-const objects are writable + template + T& operator=(T& x) const + { + *this->stored_iterator = x; + return x; + } + + // Provides X(r++) + operator Iterator const&() const + { + return stored_iterator; + } + + private: + mutable value_type stored_value; + Iterator stored_iterator; + }; + +# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + template + struct is_non_proxy_reference_impl + { + static Reference r; + + template + static typename mpl::if_< + is_convertible< + R const volatile* + , Value const volatile* + > + , char[1] + , char[2] + >::type& helper(R const&); + + BOOST_STATIC_CONSTANT(bool, value = sizeof(helper(r)) == 1); + }; + + template + struct is_non_proxy_reference + : mpl::bool_< + is_non_proxy_reference_impl::value + > + {}; +# else + template + struct is_non_proxy_reference + : is_convertible< + typename remove_reference::type + const volatile* + , Value const volatile* + > + {}; +# endif + + // A metafunction to choose the result type of postfix ++ + // + // Because the C++98 input iterator requirements say that *r++ has + // type T (value_type), implementations of some standard + // algorithms like lexicographical_compare may use constructions + // like: + // + // *r++ < *s++ + // + // If *r++ returns a proxy (as required if r is writable but not + // multipass), this sort of expression will fail unless the proxy + // supports the operator<. Since there are any number of such + // operations, we're not going to try to support them. Therefore, + // even if r++ returns a proxy, *r++ will only return a proxy if + // *r also returns a proxy. + template + struct postfix_increment_result + : mpl::eval_if< + mpl::and_< + // A proxy is only needed for readable iterators + is_convertible + + // No multipass iterator can have values that disappear + // before positions can be re-visited + , mpl::not_< + is_convertible< + typename iterator_category_to_traversal::type + , forward_traversal_tag + > + > + > + , mpl::if_< + is_non_proxy_reference + , postfix_increment_proxy + , writable_postfix_increment_proxy + > + , mpl::identity + > + {}; + + // operator->() needs special support for input iterators to strictly meet the + // standard's requirements. If *i is not a reference type, we must still + // produce a lvalue to which a pointer can be formed. We do that by + // returning an instantiation of this special proxy class template. + template + struct operator_arrow_proxy + { + operator_arrow_proxy(T const* px) : m_value(*px) {} + T* operator->() const { return &m_value; } + // This function is needed for MWCW and BCC, which won't call operator-> + // again automatically per 13.3.1.2 para 8 + operator T*() const { return &m_value; } + mutable T m_value; + }; + + // A metafunction that gets the result type for operator->. Also + // has a static function make() which builds the result from a + // Reference + template + struct operator_arrow_result + { + // CWPro8.3 won't accept "operator_arrow_result::type", and we + // need that type below, so metafunction forwarding would be a + // losing proposition here. + typedef typename mpl::if_< + is_reference + , Pointer + , operator_arrow_proxy + >::type type; + + static type make(Reference x) + { + return implicit_cast(&x); + } + }; + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + // Deal with ETI + template<> + struct operator_arrow_result + { + typedef int type; + }; +# endif + + // A proxy return type for operator[], needed to deal with + // iterators that may invalidate referents upon destruction. + // Consider the temporary iterator in *(a + n) + template + class operator_brackets_proxy + { + // Iterator is actually an iterator_facade, so we do not have to + // go through iterator_traits to access the traits. + typedef typename Iterator::reference reference; + typedef typename Iterator::value_type value_type; + + public: + operator_brackets_proxy(Iterator const& iter) + : m_iter(iter) + {} + + operator reference() const + { + return *m_iter; + } + + operator_brackets_proxy& operator=(value_type const& val) + { + *m_iter = val; + return *this; + } + + private: + Iterator m_iter; + }; + + // A metafunction that determines whether operator[] must return a + // proxy, or whether it can simply return a copy of the value_type. + template + struct use_operator_brackets_proxy + : mpl::not_< + mpl::and_< + // Really we want an is_copy_constructible trait here, + // but is_POD will have to suffice in the meantime. + boost::is_POD + , iterator_writability_disabled + > + > + {}; + + template + struct operator_brackets_result + { + typedef typename mpl::if_< + use_operator_brackets_proxy + , operator_brackets_proxy + , Value + >::type type; + }; + + template + operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, mpl::true_) + { + return operator_brackets_proxy(iter); + } + + template + typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_) + { + return *iter; + } + + struct choose_difference_type + { + template + struct apply + : +# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP + iterator_difference +# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300) + mpl::if_< + is_convertible + , typename I1::difference_type + , typename I2::difference_type + > +# else + mpl::eval_if< + is_convertible + , iterator_difference + , iterator_difference + > +# endif + {}; + + }; + } // namespace detail + + + // Macros which describe the declarations of binary operators +# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ + > \ + prefix typename mpl::apply2::type \ + operator op( \ + iterator_facade const& lhs \ + , iterator_facade const& rhs) +# else +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ + > \ + prefix typename boost::detail::enable_if_interoperable< \ + Derived1, Derived2 \ + , typename mpl::apply2::type \ + >::type \ + operator op( \ + iterator_facade const& lhs \ + , iterator_facade const& rhs) +# endif + +# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ + template \ + prefix Derived operator+ args + + // + // Helper class for granting access to the iterator core interface. + // + // The simple core interface is used by iterator_facade. The core + // interface of a user/library defined iterator type should not be made public + // so that it does not clutter the public interface. Instead iterator_core_access + // should be made friend so that iterator_facade can access the core + // interface through iterator_core_access. + // + class iterator_core_access + { +# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + // Tasteless as this may seem, making all members public allows member templates + // to work in the absence of member template friends. + public: +# else + + template friend class iterator_facade; + +# define BOOST_ITERATOR_FACADE_RELATION(op) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::detail::always_bool2); + + BOOST_ITERATOR_FACADE_RELATION(==) + BOOST_ITERATOR_FACADE_RELATION(!=) + + BOOST_ITERATOR_FACADE_RELATION(<) + BOOST_ITERATOR_FACADE_RELATION(>) + BOOST_ITERATOR_FACADE_RELATION(<=) + BOOST_ITERATOR_FACADE_RELATION(>=) +# undef BOOST_ITERATOR_FACADE_RELATION + + BOOST_ITERATOR_FACADE_INTEROP_HEAD( + friend, -, boost::detail::choose_difference_type) + ; + + BOOST_ITERATOR_FACADE_PLUS_HEAD( + friend inline + , (iterator_facade const& + , typename Derived::difference_type) + ) + ; + + BOOST_ITERATOR_FACADE_PLUS_HEAD( + friend inline + , (typename Derived::difference_type + , iterator_facade const&) + ) + ; + +# endif + + template + static typename Facade::reference dereference(Facade const& f) + { + return f.dereference(); + } + + template + static void increment(Facade& f) + { + f.increment(); + } + + template + static void decrement(Facade& f) + { + f.decrement(); + } + + template + static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_) + { + return f1.equal(f2); + } + + template + static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_) + { + return f2.equal(f1); + } + + template + static void advance(Facade& f, typename Facade::difference_type n) + { + f.advance(n); + } + + template + static typename Facade1::difference_type distance_from( + Facade1 const& f1, Facade2 const& f2, mpl::true_) + { + return -f1.distance_to(f2); + } + + template + static typename Facade2::difference_type distance_from( + Facade1 const& f1, Facade2 const& f2, mpl::false_) + { + return f2.distance_to(f1); + } + + // + // Curiously Recurring Template interface. + // + template + static I& derived(iterator_facade& facade) + { + return *static_cast(&facade); + } + + template + static I const& derived(iterator_facade const& facade) + { + return *static_cast(&facade); + } + + private: + // objects of this class are useless + iterator_core_access(); //undefined + }; + + // + // iterator_facade - use as a public base class for defining new + // standard-conforming iterators. + // + template < + class Derived // The derived iterator type being constructed + , class Value + , class CategoryOrTraversal + , class Reference = Value& + , class Difference = std::ptrdiff_t + > + class iterator_facade +# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE + : public boost::detail::iterator_facade_types< + Value, CategoryOrTraversal, Reference, Difference + >::base +# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE +# endif + { + private: + // + // Curiously Recurring Template interface. + // + Derived& derived() + { + return *static_cast(this); + } + + Derived const& derived() const + { + return *static_cast(this); + } + + typedef boost::detail::iterator_facade_types< + Value, CategoryOrTraversal, Reference, Difference + > associated_types; + + protected: + // For use by derived classes + typedef iterator_facade iterator_facade_; + + public: + + typedef typename associated_types::value_type value_type; + typedef Reference reference; + typedef Difference difference_type; + typedef typename associated_types::pointer pointer; + typedef typename associated_types::iterator_category iterator_category; + + reference operator*() const + { + return iterator_core_access::dereference(this->derived()); + } + + typename boost::detail::operator_arrow_result< + value_type + , reference + , pointer + >::type + operator->() const + { + return boost::detail::operator_arrow_result< + value_type + , reference + , pointer + >::make(*this->derived()); + } + + typename boost::detail::operator_brackets_result::type + operator[](difference_type n) const + { + typedef boost::detail::use_operator_brackets_proxy use_proxy; + + return boost::detail::make_operator_brackets_result( + this->derived() + n + , use_proxy() + ); + } + + Derived& operator++() + { + iterator_core_access::increment(this->derived()); + return this->derived(); + } + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + typename boost::detail::postfix_increment_result::type + operator++(int) + { + typename boost::detail::postfix_increment_result::type + tmp(this->derived()); + ++*this; + return tmp; + } +# endif + + Derived& operator--() + { + iterator_core_access::decrement(this->derived()); + return this->derived(); + } + + Derived operator--(int) + { + Derived tmp(this->derived()); + --*this; + return tmp; + } + + Derived& operator+=(difference_type n) + { + iterator_core_access::advance(this->derived(), n); + return this->derived(); + } + + Derived& operator-=(difference_type n) + { + iterator_core_access::advance(this->derived(), -n); + return this->derived(); + } + + Derived operator-(difference_type x) const + { + Derived result(this->derived()); + return result -= x; + } + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + // There appears to be a bug which trashes the data of classes + // derived from iterator_facade when they are assigned unless we + // define this assignment operator. This bug is only revealed + // (so far) in STLPort debug mode, but it's clearly a codegen + // problem so we apply the workaround for all MSVC6. + iterator_facade& operator=(iterator_facade const&) + { + return *this; + } +# endif + }; + +# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template + inline typename boost::detail::postfix_increment_result::type + operator++( + iterator_facade& i + , int + ) + { + typename boost::detail::postfix_increment_result::type + tmp(*static_cast(&i)); + + ++i; + + return tmp; + } +# endif + + + // + // Comparison operator implementation. The library supplied operators + // enables the user to provide fully interoperable constant/mutable + // iterator types. I.e. the library provides all operators + // for all mutable/constant iterator combinations. + // + // Note though that this kind of interoperability for constant/mutable + // iterators is not required by the standard for container iterators. + // All the standard asks for is a conversion mutable -> constant. + // Most standard library implementations nowadays provide fully interoperable + // iterator implementations, but there are still heavily used implementations + // that do not provide them. (Actually it's even worse, they do not provide + // them for only a few iterators.) + // + // ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should + // enable the user to turn off mixed type operators + // + // The library takes care to provide only the right operator overloads. + // I.e. + // + // bool operator==(Iterator, Iterator); + // bool operator==(ConstIterator, Iterator); + // bool operator==(Iterator, ConstIterator); + // bool operator==(ConstIterator, ConstIterator); + // + // ... + // + // In order to do so it uses c++ idioms that are not yet widely supported + // by current compiler releases. The library is designed to degrade gracefully + // in the face of compiler deficiencies. In general compiler + // deficiencies result in less strict error checking and more obscure + // error messages, functionality is not affected. + // + // For full operation compiler support for "Substitution Failure Is Not An Error" + // (aka. enable_if) and boost::is_convertible is required. + // + // The following problems occur if support is lacking. + // + // Pseudo code + // + // --------------- + // AdaptorA a1; + // AdaptorA a2; + // + // // This will result in a no such overload error in full operation + // // If enable_if or is_convertible is not supported + // // The instantiation will fail with an error hopefully indicating that + // // there is no operator== for Iterator1, Iterator2 + // // The same will happen if no enable_if is used to remove + // // false overloads from the templated conversion constructor + // // of AdaptorA. + // + // a1 == a2; + // ---------------- + // + // AdaptorA a; + // AdaptorB b; + // + // // This will result in a no such overload error in full operation + // // If enable_if is not supported the static assert used + // // in the operator implementation will fail. + // // This will accidently work if is_convertible is not supported. + // + // a == b; + // ---------------- + // + +# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP +# define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_() +# else +# define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible() +# endif + +# define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \ + { \ + /* For those compilers that do not support enable_if */ \ + BOOST_STATIC_ASSERT(( \ + is_interoperable< Derived1, Derived2 >::value \ + )); \ + return_prefix iterator_core_access::base_op( \ + *static_cast(&lhs) \ + , *static_cast(&rhs) \ + , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ + ); \ + } + +# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP( \ + op \ + , boost::detail::always_bool2 \ + , return_prefix \ + , base_op \ + ) + + BOOST_ITERATOR_FACADE_RELATION(==, return, equal) + BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal) + + BOOST_ITERATOR_FACADE_RELATION(<, return 0 >, distance_from) + BOOST_ITERATOR_FACADE_RELATION(>, return 0 <, distance_from) + BOOST_ITERATOR_FACADE_RELATION(<=, return 0 >=, distance_from) + BOOST_ITERATOR_FACADE_RELATION(>=, return 0 <=, distance_from) +# undef BOOST_ITERATOR_FACADE_RELATION + + // operator- requires an additional part in the static assertion + BOOST_ITERATOR_FACADE_INTEROP( + - + , boost::detail::choose_difference_type + , return + , distance_from + ) +# undef BOOST_ITERATOR_FACADE_INTEROP +# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD + +# define BOOST_ITERATOR_FACADE_PLUS(args) \ + BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \ + { \ + Derived tmp(static_cast(i)); \ + return tmp += n; \ + } + +BOOST_ITERATOR_FACADE_PLUS(( + iterator_facade const& i + , typename Derived::difference_type n +)) + +BOOST_ITERATOR_FACADE_PLUS(( + typename Derived::difference_type n + , iterator_facade const& i +)) +# undef BOOST_ITERATOR_FACADE_PLUS +# undef BOOST_ITERATOR_FACADE_PLUS_HEAD + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_FACADE_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_traits.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_traits.hpp new file mode 100644 index 0000000000..960970e8db --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/iterator_traits.hpp @@ -0,0 +1,92 @@ +// Copyright David Abrahams 2003. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef ITERATOR_TRAITS_DWA200347_HPP +# define ITERATOR_TRAITS_DWA200347_HPP + +# include +# include + +namespace boost { + +// Unfortunately, g++ 2.95.x chokes when we define a class template +// iterator_category which has the same name as its +// std::iterator_category() function, probably due in part to the +// "std:: is visible globally" hack it uses. Use +// BOOST_ITERATOR_CATEGORY to write code that's portable to older +// GCCs. + +# if BOOST_WORKAROUND(__GNUC__, <= 2) +# define BOOST_ITERATOR_CATEGORY iterator_category_ +# else +# define BOOST_ITERATOR_CATEGORY iterator_category +# endif + + +template +struct iterator_value +{ + typedef typename boost::detail::iterator_traits::value_type type; +}; + +template +struct iterator_reference +{ + typedef typename boost::detail::iterator_traits::reference type; +}; + + +template +struct iterator_pointer +{ + typedef typename boost::detail::iterator_traits::pointer type; +}; + +template +struct iterator_difference +{ + typedef typename boost::detail::iterator_traits::difference_type type; +}; + +template +struct BOOST_ITERATOR_CATEGORY +{ + typedef typename boost::detail::iterator_traits::iterator_category type; +}; + +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +template <> +struct iterator_value +{ + typedef void type; +}; + +template <> +struct iterator_reference +{ + typedef void type; +}; + +template <> +struct iterator_pointer +{ + typedef void type; +}; + +template <> +struct iterator_difference +{ + typedef void type; +}; + +template <> +struct BOOST_ITERATOR_CATEGORY +{ + typedef void type; +}; +# endif + +} // namespace boost::iterator + +#endif // ITERATOR_TRAITS_DWA200347_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/new_iterator_tests.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/new_iterator_tests.hpp new file mode 100644 index 0000000000..caad700aef --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/new_iterator_tests.hpp @@ -0,0 +1,264 @@ +#ifndef BOOST_NEW_ITERATOR_TESTS_HPP +# define BOOST_NEW_ITERATOR_TESTS_HPP + +// +// Copyright (c) David Abrahams 2001. +// Copyright (c) Jeremy Siek 2001-2003. +// Copyright (c) Thomas Witt 2002. +// +// Use, modification and distribution is subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +// This is meant to be the beginnings of a comprehensive, generic +// test suite for STL concepts such as iterators and containers. +// +// Revision History: +// 28 Oct 2002 Started update for new iterator categories +// (Jeremy Siek) +// 28 Apr 2002 Fixed input iterator requirements. +// For a == b a++ == b++ is no longer required. +// See 24.1.1/3 for details. +// (Thomas Witt) +// 08 Feb 2001 Fixed bidirectional iterator test so that +// --i is no longer a precondition. +// (Jeremy Siek) +// 04 Feb 2001 Added lvalue test, corrected preconditions +// (David Abrahams) + +# include +# include +# include +# include // for detail::dummy_constructor +# include +# include +# include +# include + +# include +# include +# include + +namespace boost { + + +// Do separate tests for *i++ so we can treat, e.g., smart pointers, +// as readable and/or writable iterators. +template +void readable_iterator_traversal_test(Iterator i1, T v, mpl::true_) +{ + T v2(*i1++); + BOOST_TEST(v == v2); +} + +template +void readable_iterator_traversal_test(const Iterator i1, T v, mpl::false_) +{} + +template +void writable_iterator_traversal_test(Iterator i1, T v, mpl::true_) +{ + ++i1; // we just wrote into that position + *i1++ = v; + Iterator x(i1++); + (void)x; +} + +template +void writable_iterator_traversal_test(const Iterator i1, T v, mpl::false_) +{} + + +// Preconditions: *i == v +template +void readable_iterator_test(const Iterator i1, T v) +{ + Iterator i2(i1); // Copy Constructible + typedef typename detail::iterator_traits::reference ref_t; + ref_t r1 = *i1; + ref_t r2 = *i2; + T v1 = r1; + T v2 = r2; + BOOST_TEST(v1 == v); + BOOST_TEST(v2 == v); + +# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) + readable_iterator_traversal_test(i1, v, detail::is_postfix_incrementable()); + + // I think we don't really need this as it checks the same things as + // the above code. + BOOST_STATIC_ASSERT(is_readable_iterator::value); +# endif +} + +template +void writable_iterator_test(Iterator i, T v, T v2) +{ + Iterator i2(i); // Copy Constructible + *i2 = v; + +# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) + writable_iterator_traversal_test( + i, v2, mpl::and_< + detail::is_incrementable + , detail::is_postfix_incrementable + >()); +# endif +} + +template +void swappable_iterator_test(Iterator i, Iterator j) +{ + Iterator i2(i), j2(j); + typename detail::iterator_traits::value_type bi = *i, bj = *j; + iter_swap(i2, j2); + typename detail::iterator_traits::value_type ai = *i, aj = *j; + BOOST_TEST(bi == aj && bj == ai); +} + +template +void constant_lvalue_iterator_test(Iterator i, T v1) +{ + Iterator i2(i); + typedef typename detail::iterator_traits::value_type value_type; + typedef typename detail::iterator_traits::reference reference; + BOOST_STATIC_ASSERT((is_same::value)); + const T& v2 = *i2; + BOOST_TEST(v1 == v2); +# ifndef BOOST_NO_LVALUE_RETURN_DETECTION + BOOST_STATIC_ASSERT(is_lvalue_iterator::value); + BOOST_STATIC_ASSERT(!is_non_const_lvalue_iterator::value); +# endif +} + +template +void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) +{ + Iterator i2(i); + typedef typename detail::iterator_traits::value_type value_type; + typedef typename detail::iterator_traits::reference reference; + BOOST_STATIC_ASSERT((is_same::value)); + T& v3 = *i2; + BOOST_TEST(v1 == v3); + + // A non-const lvalue iterator is not neccessarily writable, but we + // are assuming the value_type is assignable here + *i = v2; + + T& v4 = *i2; + BOOST_TEST(v2 == v4); +# ifndef BOOST_NO_LVALUE_RETURN_DETECTION + BOOST_STATIC_ASSERT(is_lvalue_iterator::value); + BOOST_STATIC_ASSERT(is_non_const_lvalue_iterator::value); +# endif +} + +template +void forward_readable_iterator_test(Iterator i, Iterator j, T val1, T val2) +{ + Iterator i2; + Iterator i3(i); + i2 = i; + BOOST_TEST(i2 == i3); + BOOST_TEST(i != j); + BOOST_TEST(i2 != j); + readable_iterator_test(i, val1); + readable_iterator_test(i2, val1); + readable_iterator_test(i3, val1); + + BOOST_TEST(i == i2++); + BOOST_TEST(i != ++i3); + + readable_iterator_test(i2, val2); + readable_iterator_test(i3, val2); + + readable_iterator_test(i, val1); +} + +template +void forward_swappable_iterator_test(Iterator i, Iterator j, T val1, T val2) +{ + forward_readable_iterator_test(i, j, val1, val2); + Iterator i2 = i; + ++i2; + swappable_iterator_test(i, i2); +} + +// bidirectional +// Preconditions: *i == v1, *++i == v2 +template +void bidirectional_readable_iterator_test(Iterator i, T v1, T v2) +{ + Iterator j(i); + ++j; + forward_readable_iterator_test(i, j, v1, v2); + ++i; + + Iterator i1 = i, i2 = i; + + BOOST_TEST(i == i1--); + BOOST_TEST(i != --i2); + + readable_iterator_test(i, v2); + readable_iterator_test(i1, v1); + readable_iterator_test(i2, v1); + + --i; + BOOST_TEST(i == i1); + BOOST_TEST(i == i2); + ++i1; + ++i2; + + readable_iterator_test(i, v1); + readable_iterator_test(i1, v2); + readable_iterator_test(i2, v2); +} + +// random access +// Preconditions: [i,i+N) is a valid range +template +void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals) +{ + bidirectional_readable_iterator_test(i, vals[0], vals[1]); + const Iterator j = i; + int c; + + for (c = 0; c < N-1; ++c) + { + BOOST_TEST(i == j + c); + BOOST_TEST(*i == vals[c]); + typename detail::iterator_traits::value_type x = j[c]; + BOOST_TEST(*i == x); + BOOST_TEST(*i == *(j + c)); + BOOST_TEST(*i == *(c + j)); + ++i; + BOOST_TEST(i > j); + BOOST_TEST(i >= j); + BOOST_TEST(j <= i); + BOOST_TEST(j < i); + } + + Iterator k = j + N - 1; + for (c = 0; c < N-1; ++c) + { + BOOST_TEST(i == k - c); + BOOST_TEST(*i == vals[N - 1 - c]); + typename detail::iterator_traits::value_type x = j[N - 1 - c]; + BOOST_TEST(*i == x); + Iterator q = k - c; + BOOST_TEST(*i == *q); + BOOST_TEST(i > j); + BOOST_TEST(i >= j); + BOOST_TEST(j <= i); + BOOST_TEST(j < i); + --i; + } +} + +} // namespace boost + +# include + +#endif // BOOST_NEW_ITERATOR_TESTS_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/permutation_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/permutation_iterator.hpp new file mode 100644 index 0000000000..23d11986da --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/permutation_iterator.hpp @@ -0,0 +1,72 @@ +// (C) Copyright Toon Knapen 2001. +// (C) Copyright David Abrahams 2003. +// (C) Copyright Roland Richter 2003. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_PERMUTATION_ITERATOR_HPP +#define BOOST_PERMUTATION_ITERATOR_HPP + +#include + +#include + + +namespace boost +{ + +template< class ElementIterator + , class IndexIterator> +class permutation_iterator + : public iterator_adaptor< + permutation_iterator + , IndexIterator, typename detail::iterator_traits::value_type + , use_default, typename detail::iterator_traits::reference> +{ + typedef iterator_adaptor< + permutation_iterator + , IndexIterator, typename detail::iterator_traits::value_type + , use_default, typename detail::iterator_traits::reference> super_t; + + friend class iterator_core_access; + +public: + permutation_iterator() : m_elt_iter() {} + + explicit permutation_iterator(ElementIterator x, IndexIterator y) + : super_t(y), m_elt_iter(x) {} + + template + permutation_iterator( + permutation_iterator const& r + , typename enable_if_convertible::type* = 0 + , typename enable_if_convertible::type* = 0 + ) + : super_t(r.base()), m_elt_iter(r.m_elt_iter) + {} + +private: + typename super_t::reference dereference() const + { return *(m_elt_iter + *this->base()); } + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + template friend class permutation_iterator; +#else + public: +#endif + ElementIterator m_elt_iter; +}; + + +template +permutation_iterator +make_permutation_iterator( ElementIterator e, IndexIterator i ) +{ + return permutation_iterator( e, i ); +} + + +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/reverse_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/reverse_iterator.hpp new file mode 100644 index 0000000000..97b6b4861d --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/reverse_iterator.hpp @@ -0,0 +1,69 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP +#define BOOST_REVERSE_ITERATOR_23022003THW_HPP + +#include +#include +#include + +namespace boost +{ + + // + // + // + template + class reverse_iterator + : public iterator_adaptor< reverse_iterator, Iterator > + { + typedef iterator_adaptor< reverse_iterator, Iterator > super_t; + + friend class iterator_core_access; + + public: + reverse_iterator() {} + + explicit reverse_iterator(Iterator x) + : super_t(x) {} + + template + reverse_iterator( + reverse_iterator const& r + , typename enable_if_convertible::type* = 0 + ) + : super_t(r.base()) + {} + + private: + typename super_t::reference dereference() const { return *boost::prior(this->base()); } + + void increment() { --this->base_reference(); } + void decrement() { ++this->base_reference(); } + + void advance(typename super_t::difference_type n) + { + this->base_reference() += -n; + } + + template + typename super_t::difference_type + distance_to(reverse_iterator const& y) const + { + return this->base_reference() - y.base(); + } + }; + + template + reverse_iterator make_reverse_iterator(BidirectionalIterator x) + { + return reverse_iterator(x); + } + +} // namespace boost + +#endif // BOOST_REVERSE_ITERATOR_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/transform_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/transform_iterator.hpp new file mode 100644 index 0000000000..e449a8b0d3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/transform_iterator.hpp @@ -0,0 +1,188 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP +#define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) +# include + +#endif +#include + + +namespace boost +{ + template + class transform_iterator; + + namespace detail + { + + template + struct function_object_result + { + typedef typename UnaryFunc::result_type type; + }; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template + struct function_object_result + { + typedef Return type; + }; +#endif + + // Compute the iterator_adaptor instantiation to be used for transform_iterator + template + struct transform_iterator_base + { + private: + // By default, dereferencing the iterator yields the same as + // the function. Do we need to adjust the way + // function_object_result is computed for the standard + // proposal (e.g. using Doug's result_of)? + typedef typename ia_dflt_help< + Reference + , function_object_result + >::type reference; + + // To get the default for Value: remove any reference on the + // result type, but retain any constness to signal + // non-writability. Note that if we adopt Thomas' suggestion + // to key non-writability *only* on the Reference argument, + // we'd need to strip constness here as well. + typedef typename ia_dflt_help< + Value + , remove_reference + >::type cv_value_type; + + public: + typedef iterator_adaptor< + transform_iterator + , Iterator + , cv_value_type + , use_default // Leave the traversal category alone + , reference + > type; + }; + } + + template + class transform_iterator + : public boost::detail::transform_iterator_base::type + { + typedef typename + boost::detail::transform_iterator_base::type + super_t; + + friend class iterator_core_access; + + public: + transform_iterator() { } + + transform_iterator(Iterator const& x, UnaryFunc f) + : super_t(x), m_f(f) { } + + explicit transform_iterator(Iterator const& x) + : super_t(x) + { + // Pro8 is a little too aggressive about instantiating the + // body of this function. +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + // don't provide this constructor if UnaryFunc is a + // function pointer type, since it will be 0. Too dangerous. + BOOST_STATIC_ASSERT(is_class::value); +#endif + } + + template< + class OtherUnaryFunction + , class OtherIterator + , class OtherReference + , class OtherValue> + transform_iterator( + transform_iterator const& t + , typename enable_if_convertible::type* = 0 +#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310) + , typename enable_if_convertible::type* = 0 +#endif + ) + : super_t(t.base()), m_f(t.functor()) + {} + + UnaryFunc functor() const + { return m_f; } + + private: + typename super_t::reference dereference() const + { return m_f(*this->base()); } + + // Probably should be the initial base class so it can be + // optimized away via EBO if it is an empty class. + UnaryFunc m_f; + }; + + template + transform_iterator + make_transform_iterator(Iterator it, UnaryFunc fun) + { + return transform_iterator(it, fun); + } + + // Version which allows explicit specification of the UnaryFunc + // type. + // + // This generator is not provided if UnaryFunc is a function + // pointer type, because it's too dangerous: the default-constructed + // function pointer in the iterator be 0, leading to a runtime + // crash. + template +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + typename mpl::if_< +#else + typename iterators::enable_if< +#endif + is_class // We should probably find a cheaper test than is_class<> + , transform_iterator +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + , int[3] +#endif + >::type + make_transform_iterator(Iterator it) + { + return transform_iterator(it, UnaryFunc()); + } + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template + transform_iterator< Return (*)(Argument), Iterator, Return> + make_transform_iterator(Iterator it, Return (*fun)(Argument)) + { + return transform_iterator(it, fun); + } +#endif + +} // namespace boost + +#include + +#endif // BOOST_TRANSFORM_ITERATOR_23022003THW_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator/zip_iterator.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator/zip_iterator.hpp new file mode 100644 index 0000000000..f3896ad955 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator/zip_iterator.hpp @@ -0,0 +1,585 @@ +// Copyright David Abrahams and Thomas Becker 2000-2006. 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_ZIP_ITERATOR_TMB_07_13_2003_HPP_ +# define BOOST_ZIP_ITERATOR_TMB_07_13_2003_HPP_ + +#include +#include +#include +#include +#include // for enable_if_convertible +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + // Zip iterator forward declaration for zip_iterator_base + template + class zip_iterator; + + // One important design goal of the zip_iterator is to isolate all + // functionality whose implementation relies on the current tuple + // implementation. This goal has been achieved as follows: Inside + // the namespace detail there is a namespace tuple_impl_specific. + // This namespace encapsulates all functionality that is specific + // to the current Boost tuple implementation. More precisely, the + // namespace tuple_impl_specific provides the following tuple + // algorithms and meta-algorithms for the current Boost tuple + // implementation: + // + // tuple_meta_transform + // tuple_meta_accumulate + // tuple_transform + // tuple_for_each + // + // If the tuple implementation changes, all that needs to be + // replaced is the implementation of these four (meta-)algorithms. + + namespace detail + { + + // Functors to be used with tuple algorithms + // + template + class advance_iterator + { + public: + advance_iterator(DiffType step) : m_step(step) {} + + template + void operator()(Iterator& it) const + { it += m_step; } + + private: + DiffType m_step; + }; + // + struct increment_iterator + { + template + void operator()(Iterator& it) + { ++it; } + }; + // + struct decrement_iterator + { + template + void operator()(Iterator& it) + { --it; } + }; + // + struct dereference_iterator + { + template + struct apply + { + typedef typename + iterator_traits::reference + type; + }; + + template + typename apply::type operator()(Iterator const& it) + { return *it; } + }; + + + // The namespace tuple_impl_specific provides two meta- + // algorithms and two algorithms for tuples. + // + namespace tuple_impl_specific + { + // Meta-transform algorithm for tuples + // + template + struct tuple_meta_transform; + + template + struct tuple_meta_transform_impl + { + typedef tuples::cons< + typename mpl::apply1< + typename mpl::lambda::type + , typename Tuple::head_type + >::type + , typename tuple_meta_transform< + typename Tuple::tail_type + , UnaryMetaFun + >::type + > type; + }; + + template + struct tuple_meta_transform + : mpl::eval_if< + boost::is_same + , mpl::identity + , tuple_meta_transform_impl + > + { + }; + + // Meta-accumulate algorithm for tuples. Note: The template + // parameter StartType corresponds to the initial value in + // ordinary accumulation. + // + template + struct tuple_meta_accumulate; + + template< + typename Tuple + , class BinaryMetaFun + , typename StartType + > + struct tuple_meta_accumulate_impl + { + typedef typename mpl::apply2< + typename mpl::lambda::type + , typename Tuple::head_type + , typename tuple_meta_accumulate< + typename Tuple::tail_type + , BinaryMetaFun + , StartType + >::type + >::type type; + }; + + template< + typename Tuple + , class BinaryMetaFun + , typename StartType + > + struct tuple_meta_accumulate + : mpl::eval_if< +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + mpl::or_< +#endif + boost::is_same +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + , boost::is_same + > +#endif + , mpl::identity + , tuple_meta_accumulate_impl< + Tuple + , BinaryMetaFun + , StartType + > + > + { + }; + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + || ( \ + BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, != 0) && defined(_MSC_VER) \ + ) +// Not sure why intel's partial ordering fails in this case, but I'm +// assuming int's an MSVC bug-compatibility feature. + +# define BOOST_TUPLE_ALGO_DISPATCH +# define BOOST_TUPLE_ALGO(algo) algo##_impl +# define BOOST_TUPLE_ALGO_TERMINATOR , int +# define BOOST_TUPLE_ALGO_RECURSE , ... +#else +# define BOOST_TUPLE_ALGO(algo) algo +# define BOOST_TUPLE_ALGO_TERMINATOR +# define BOOST_TUPLE_ALGO_RECURSE +#endif + + // transform algorithm for tuples. The template parameter Fun + // must be a unary functor which is also a unary metafunction + // class that computes its return type based on its argument + // type. For example: + // + // struct to_ptr + // { + // template + // struct apply + // { + // typedef Arg* type; + // } + // + // template + // Arg* operator()(Arg x); + // }; + template + tuples::null_type BOOST_TUPLE_ALGO(tuple_transform) + (tuples::null_type const&, Fun BOOST_TUPLE_ALGO_TERMINATOR) + { return tuples::null_type(); } + + template + typename tuple_meta_transform< + Tuple + , Fun + >::type + + BOOST_TUPLE_ALGO(tuple_transform)( + const Tuple& t, + Fun f + BOOST_TUPLE_ALGO_RECURSE + ) + { + typedef typename tuple_meta_transform< + BOOST_DEDUCED_TYPENAME Tuple::tail_type + , Fun + >::type transformed_tail_type; + + return tuples::cons< + BOOST_DEDUCED_TYPENAME mpl::apply1< + Fun, BOOST_DEDUCED_TYPENAME Tuple::head_type + >::type + , transformed_tail_type + >( + f(boost::tuples::get<0>(t)), tuple_transform(t.get_tail(), f) + ); + } + +#ifdef BOOST_TUPLE_ALGO_DISPATCH + template + typename tuple_meta_transform< + Tuple + , Fun + >::type + + tuple_transform( + const Tuple& t, + Fun f + ) + { + return tuple_transform_impl(t, f, 1); + } +#endif + + // for_each algorithm for tuples. + // + template + Fun BOOST_TUPLE_ALGO(tuple_for_each)( + tuples::null_type + , Fun f BOOST_TUPLE_ALGO_TERMINATOR + ) + { return f; } + + + template + Fun BOOST_TUPLE_ALGO(tuple_for_each)( + Tuple& t + , Fun f BOOST_TUPLE_ALGO_RECURSE) + { + f( t.get_head() ); + return tuple_for_each(t.get_tail(), f); + } + +#ifdef BOOST_TUPLE_ALGO_DISPATCH + template + Fun + tuple_for_each( + Tuple& t, + Fun f + ) + { + return tuple_for_each_impl(t, f, 1); + } +#endif + + // Equality of tuples. NOTE: "==" for tuples currently (7/2003) + // has problems under some compilers, so I just do my own. + // No point in bringing in a bunch of #ifdefs here. This is + // going to go away with the next tuple implementation anyway. + // + inline bool tuple_equal(tuples::null_type, tuples::null_type) + { return true; } + + template + bool tuple_equal( + Tuple1 const& t1, + Tuple2 const& t2 + ) + { + return t1.get_head() == t2.get_head() && + tuple_equal(t1.get_tail(), t2.get_tail()); + } + } + // + // end namespace tuple_impl_specific + + template + struct iterator_reference + { + typedef typename iterator_traits::reference type; + }; + +#ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT + // Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work + // out well. Instantiating the nested apply template also + // requires instantiating iterator_traits on the + // placeholder. Instead we just specialize it as a metafunction + // class. + template<> + struct iterator_reference + { + template + struct apply : iterator_reference {}; + }; +#endif + + // Metafunction to obtain the type of the tuple whose element types + // are the reference types of an iterator tuple. + // + template + struct tuple_of_references + : tuple_impl_specific::tuple_meta_transform< + IteratorTuple, + iterator_reference + > + { + }; + + // Metafunction to obtain the minimal traversal tag in a tuple + // of iterators. + // + template + struct minimum_traversal_category_in_iterator_tuple + { + typedef typename tuple_impl_specific::tuple_meta_transform< + IteratorTuple + , iterator_traversal<> + >::type tuple_of_traversal_tags; + + typedef typename tuple_impl_specific::tuple_meta_accumulate< + tuple_of_traversal_tags + , minimum_category<> + , random_access_traversal_tag + >::type type; + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround + template <> + struct minimum_traversal_category_in_iterator_tuple + { + typedef int type; + }; +#endif + + // We need to call tuple_meta_accumulate with mpl::and_ as the + // accumulating functor. To this end, we need to wrap it into + // a struct that has exactly two arguments (that is, template + // parameters) and not five, like mpl::and_ does. + // + template + struct and_with_two_args + : mpl::and_ + { + }; + +# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT + // Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work + // out well. In this case I think it's an MPL bug + template<> + struct and_with_two_args + { + template + struct apply : mpl::and_ + {}; + }; +# endif + + /////////////////////////////////////////////////////////////////// + // + // Class zip_iterator_base + // + // Builds and exposes the iterator facade type from which the zip + // iterator will be derived. + // + template + struct zip_iterator_base + { + private: + // Reference type is the type of the tuple obtained from the + // iterators' reference types. + typedef typename + detail::tuple_of_references::type reference; + + // Value type is the same as reference type. + typedef reference value_type; + + // Difference type is the first iterator's difference type + typedef typename iterator_traits< + typename tuples::element<0, IteratorTuple>::type + >::difference_type difference_type; + + // Traversal catetgory is the minimum traversal category in the + // iterator tuple. + typedef typename + detail::minimum_traversal_category_in_iterator_tuple< + IteratorTuple + >::type traversal_category; + public: + + // The iterator facade type from which the zip iterator will + // be derived. + typedef iterator_facade< + zip_iterator, + value_type, + traversal_category, + reference, + difference_type + > type; + }; + + template <> + struct zip_iterator_base + { + typedef int type; + }; + } + + ///////////////////////////////////////////////////////////////////// + // + // zip_iterator class definition + // + template + class zip_iterator : + public detail::zip_iterator_base::type + { + + // Typedef super_t as our base class. + typedef typename + detail::zip_iterator_base::type super_t; + + // iterator_core_access is the iterator's best friend. + friend class iterator_core_access; + + public: + + // Construction + // ============ + + // Default constructor + zip_iterator() { } + + // Constructor from iterator tuple + zip_iterator(IteratorTuple iterator_tuple) + : m_iterator_tuple(iterator_tuple) + { } + + // Copy constructor + template + zip_iterator( + const zip_iterator& other, + typename enable_if_convertible< + OtherIteratorTuple, + IteratorTuple + >::type* = 0 + ) : m_iterator_tuple(other.get_iterator_tuple()) + {} + + // Get method for the iterator tuple. + const IteratorTuple& get_iterator_tuple() const + { return m_iterator_tuple; } + + private: + + // Implementation of Iterator Operations + // ===================================== + + // Dereferencing returns a tuple built from the dereferenced + // iterators in the iterator tuple. + typename super_t::reference dereference() const + { + return detail::tuple_impl_specific::tuple_transform( + get_iterator_tuple(), + detail::dereference_iterator() + ); + } + + // Two zip iterators are equal if all iterators in the iterator + // tuple are equal. NOTE: It should be possible to implement this + // as + // + // return get_iterator_tuple() == other.get_iterator_tuple(); + // + // but equality of tuples currently (7/2003) does not compile + // under several compilers. No point in bringing in a bunch + // of #ifdefs here. + // + template + bool equal(const zip_iterator& other) const + { + return detail::tuple_impl_specific::tuple_equal( + get_iterator_tuple(), + other.get_iterator_tuple() + ); + } + + // Advancing a zip iterator means to advance all iterators in the + // iterator tuple. + void advance(typename super_t::difference_type n) + { + detail::tuple_impl_specific::tuple_for_each( + m_iterator_tuple, + detail::advance_iterator(n) + ); + } + // Incrementing a zip iterator means to increment all iterators in + // the iterator tuple. + void increment() + { + detail::tuple_impl_specific::tuple_for_each( + m_iterator_tuple, + detail::increment_iterator() + ); + } + + // Decrementing a zip iterator means to decrement all iterators in + // the iterator tuple. + void decrement() + { + detail::tuple_impl_specific::tuple_for_each( + m_iterator_tuple, + detail::decrement_iterator() + ); + } + + // Distance is calculated using the first iterator in the tuple. + template + typename super_t::difference_type distance_to( + const zip_iterator& other + ) const + { + return boost::tuples::get<0>(other.get_iterator_tuple()) - + boost::tuples::get<0>(this->get_iterator_tuple()); + } + + // Data Members + // ============ + + // The iterator tuple. + IteratorTuple m_iterator_tuple; + + }; + + // Make function for zip iterator + // + template + zip_iterator + make_zip_iterator(IteratorTuple t) + { return zip_iterator(t); } + +} + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/iterator_adaptors.hpp b/deal.II/contrib/boost/include/boost-1.37.0/iterator_adaptors.hpp new file mode 100644 index 0000000000..ed9579c514 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/iterator_adaptors.hpp @@ -0,0 +1,13 @@ +// Copyright David Abrahams 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 www.boost.org/libs/iterator for documentation. + +#ifndef ITERATOR_ADAPTORS_DWA2004725_HPP +# define ITERATOR_ADAPTORS_DWA2004725_HPP + +#define BOOST_ITERATOR_ADAPTORS_VERSION 0x0200 +#include + +#endif // ITERATOR_ADAPTORS_DWA2004725_HPP diff --git a/deal.II/contrib/boost/include/boost-1.37.0/lambda/algorithm.hpp b/deal.II/contrib/boost/include/boost-1.37.0/lambda/algorithm.hpp new file mode 100644 index 0000000000..ced5f4e009 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/lambda/algorithm.hpp @@ -0,0 +1,1377 @@ +// -- algorithm.hpp -- Boost Lambda Library ----------------------------------- +// Copyright (C) 2002 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 2002 Gary Powell (gwpowell@hotmail.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) +// +// For more information, see http://www.boost.org + +#ifndef BOOST_LAMBDA_ALGORITHM_HPP +#define BOOST_LAMBDA_ALGORITHM_HPP + +#include "boost/lambda/core.hpp" + +#include +#include // for iterator_traits +#include // for std::pair + +namespace boost { + namespace lambda { + +namespace ll { + +// for_each --------------------------------- + +struct for_each { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c) const + { return ::std::for_each(a, b, c); } +}; + +// find --------------------------------- + +struct find { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, const C& c) const + { return ::std::find(a, b, c); } +}; + + +// find_if --------------------------------- + +struct find_if { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, C c) const + { return ::std::find_if(a, b, c); } +}; + +// find_end --------------------------------- + +struct find_end { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, C c, C d) const + { return ::std::find_end(a, b, c, d); } + + template + A + operator()(A a, A b, C c, C d, E e) const + { return ::std::find_end(a, b, c, d, e); } + +}; + +// find_first_of --------------------------------- + +struct find_first_of { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, C c, C d) const + { return ::std::find_first_of(a, b, c, d); } + + template + A + operator()(A a, A b, C c, C d, E e) const + { return ::std::find_first_of(a, b, c, d, e); } + +}; + +// adjacent_find --------------------------------- + +struct adjacent_find { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b) const + { return ::std::adjacent_find(a, b); } + + template + A + operator()(A a, A b, C c) const + { return ::std::adjacent_find(a, b, c); } + +}; + +// count --------------------------------- + +struct count { + + template + struct sig { + typedef typename ::std::iterator_traits< + typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type + >::difference_type type; + }; + + template + typename ::std::iterator_traits::difference_type + operator()(A a, A b, const C& c) const + { return ::std::count(a, b, c); } +}; + +// count_if --------------------------------- + +struct count_if { + + template + struct sig { + typedef typename ::std::iterator_traits< + typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type + >::difference_type type; + }; + + template + typename ::std::iterator_traits::difference_type + operator()(A a, A b, C c) const + { return ::std::count_if(a, b, c); } +}; + + +// mismatch --------------------------------- + +struct mismatch { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type element1_type; + + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type element2_type; + + typedef ::std::pair< element1_type, element2_type > type; + }; + + template + ::std::pair + operator()(A a, A b, C c) const + { return ::std::mismatch(a, b, c); } + + template + ::std::pair + operator()(A a, A b, C c, D d) const + { return ::std::mismatch(a, b, c, d); } + +}; + +// equal --------------------------------- + +struct equal { + + template + struct sig { + typedef bool type; + }; + + template + bool + operator()(A a, A b, C c) const + { return ::std::equal(a, b, c); } + + template + bool + operator()(A a, A b, C c, D d) const + { return ::std::equal(a, b, c, d); } + +}; + +// search -------------------------------- + +struct search { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, C c, C d) const + { return std::search(a, b, c, d);} + + template + A + operator()(A a, A b, C c, C d, E e) const + { return std::search(a, b, c, d, e);} + +}; + +// copy --------------------------------- + +struct copy { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c) const + { return ::std::copy(a, b, c); } + +}; + +// copy_backward --------------------------------- + +struct copy_backward { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c) const + { return ::std::copy_backward(a, b, c); } + +}; + +// swap --------------------------------- + +struct swap { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::swap(a, b); } + +}; + +// swap_ranges --------------------------------- + +struct swap_ranges { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c) const + { return ::std::swap_ranges(a, b, c); } + +}; + +// iter_swap --------------------------------- + +struct iter_swap { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::iter_swap(a, b); } + +}; + + +// transform -------------------------------- + +struct transform { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element< + boost::tuples::length::value - 2, + Args + >::type + >::type type; + }; + + template + C + operator()(A a, A b, C c, D d) const + { return std::transform(a, b, c, d);} + + template + D + operator()(A a, A b, C c, D d, E e) const + { return std::transform(a, b, c, d, e);} + +}; + +// replace --------------------------------- + +struct replace { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, const C& c, const C& d) const + { ::std::replace(a, b, c, d); } + +}; + +// replace_if --------------------------------- + +struct replace_if { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, C c, const D& d) const + { ::std::replace_if(a, b, c, d); } + +}; + +// replace_copy --------------------------------- + +struct replace_copy { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c, const D& d, const D& e) const + { return ::std::replace_copy(a, b, c, d, e); } + +}; + +// replace_copy_if --------------------------------- + +struct replace_copy_if { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c, D d, const E& e) const + { return ::std::replace_copy_if(a, b, c, d, e); } + +}; + +// fill --------------------------------- + +struct fill { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, const C& c) const + { ::std::fill(a, b, c); } + +}; + +// fill_n --------------------------------- + +struct fill_n { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, B b, const C& c) const + { ::std::fill_n(a, b, c); } + +}; + +// generate --------------------------------- + +struct generate { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, C c) const + { ::std::generate(a, b, c); } + +}; + +// generate_n --------------------------------- + +struct generate_n { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, B b, C c) const + { ::std::generate_n(a, b, c); } + +}; + +// remove --------------------------------- + +struct remove { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, const C& c) const + { return ::std::remove(a, b, c); } +}; + +// remove_if --------------------------------- + +struct remove_if { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, C c) const + { return ::std::remove_if(a, b, c); } +}; + +// remove_copy --------------------------------- + +struct remove_copy { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c, const D& d) const + { return ::std::remove_copy(a, b, c, d); } +}; + +// remove_copy_if --------------------------------- + +struct remove_copy_if { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c, D d) const + { return ::std::remove_copy_if(a, b, c, d); } +}; + +// unique --------------------------------- + +struct unique { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b) const + { return ::std::unique(a, b); } + + template + A + operator()(A a, A b, C c) const + { return ::std::unique(a, b, c); } + +}; + +// unique_copy --------------------------------- + +struct unique_copy { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c) const + { return ::std::unique_copy(a, b, c); } + + template + C + operator()(A a, A b, C c, D d) const + { return ::std::unique_copy(a, b, c, d); } + +}; + +// reverse --------------------------------- + +struct reverse { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::reverse(a, b); } + +}; + +// reverse_copy --------------------------------- + +struct reverse_copy { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c) const + { return ::std::reverse_copy(a, b, c); } + +}; + +// rotate --------------------------------- + +struct rotate { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, A c) const + { ::std::rotate(a, b, c); } + +}; + +// rotate_copy --------------------------------- + +struct rotate_copy { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + D + operator()(A a, A b, A c, D d) const + { return ::std::rotate_copy(a, b, c, d); } + +}; + +// random_shuffle --------------------------------- + +struct random_shuffle { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::random_shuffle(a, b); } + + template + void + operator()(A a, A b, const C& c) const + { ::std::random_shuffle(a, b, c); } + +}; + + +// partition --------------------------------- + +struct partition { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, C c) const + { return ::std::partition(a, b, c); } + +}; + +// stable_partition --------------------------------- + +struct stable_partition { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, C c) const + { return ::std::stable_partition(a, b, c); } + +}; + +// sort --------------------------------- + +struct sort { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::sort(a, b); } + + template + void + operator()(A a, A b, C c) const + { ::std::sort(a, b, c); } + +}; + +// stable_sort --------------------------------- + +struct stable_sort { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::stable_sort(a, b); } + + template + void + operator()(A a, A b, C c) const + { ::std::stable_sort(a, b, c); } + +}; + +// partial_sort --------------------------------- + +struct partial_sort { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, A c) const + { ::std::partial_sort(a, b, c); } + + template + void + operator()(A a, A b, A c, D d) const + { ::std::partial_sort(a, b, c, d); } + +}; + +// partial_sort_copy --------------------------------- + +struct partial_sort_copy { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<3, Args>::type + >::type type; + }; + + template + C + operator()(A a, A b, C c, C d) const + { return ::std::partial_sort_copy(a, b, c, d); } + + template + C + operator()(A a, A b, C c, C d, E e) const + { return ::std::partial_sort_copy(a, b, c, d, e); } +}; + +// nth_element --------------------------------- + +struct nth_element { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, A c) const + { ::std::nth_element(a, b, c); } + + template + void + operator()(A a, A b, A c, D d) const + { ::std::nth_element(a, b, c, d); } + +}; + +// lower_bound --------------------------------- + +struct lower_bound { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, const C& c) const + { return ::std::lower_bound(a, b, c); } + + template + A + operator()(A a, A b, const C& c, D d) const + { return ::std::lower_bound(a, b, c, d); } + +}; + +// upper_bound --------------------------------- + +struct upper_bound { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b, const C& c) const + { return ::std::upper_bound(a, b, c); } + + template + A + operator()(A a, A b, const C& c, D d) const + { return ::std::upper_bound(a, b, c, d); } + +}; + +// equal_range --------------------------------- + +struct equal_range { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type element_type; + + typedef ::std::pair< element_type, element_type > type; + }; + + template + ::std::pair + operator()(A a, A b, const C& c) const + { return ::std::equal_range(a, b, c); } + + template + ::std::pair + operator()(A a, A b, const C& c, D d) const + { return ::std::equal_range(a, b, c, d); } + +}; + +// binary_search --------------------------------- + +struct binary_search { + + template + struct sig { + typedef bool type; + }; + + template + bool + operator()(A a, A b, const C& c) const + { return ::std::binary_search(a, b, c); } + + template + bool + operator()(A a, A b, const C& c, D d) const + { return ::std::binary_search(a, b, c, d); } + +}; + +// merge -------------------------------- + +struct merge { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<5, Args>::type + >::type type; + }; + + template + E + operator()(A a, A b, C c, C d, E e) const + { return std::merge(a, b, c, d, e);} + + template + E + operator()(A a, A b, C c, C d, E e, F f) const + { return std::merge(a, b, c, d, e, f);} + +}; + +// inplace_merge --------------------------------- + +struct inplace_merge { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b, A c) const + { ::std::inplace_merge(a, b, c); } + + template + void + operator()(A a, A b, A c, D d) const + { ::std::inplace_merge(a, b, c, d); } + +}; + +// includes --------------------------------- + +struct includes { + + template + struct sig { + typedef bool type; + }; + + template + bool + operator()(A a, A b, C c, C d) const + { return ::std::includes(a, b, c, d); } + + template + bool + operator()(A a, A b, C c, C d, E e) const + { return ::std::includes(a, b, c, d, e); } + +}; + +// set_union -------------------------------- + +struct set_union { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<5, Args>::type + >::type type; + }; + + template + E + operator()(A a, A b, C c, C d, E e) const + { return std::set_union(a, b, c, d, e);} + + template + E + operator()(A a, A b, C c, C d, E e, F f) const + { return std::set_union(a, b, c, d, e, f);} + +}; + +// set_intersection -------------------------------- + +struct set_intersection { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<5, Args>::type + >::type type; + }; + + template + E + operator()(A a, A b, C c, C d, E e) const + { return std::set_intersection(a, b, c, d, e);} + + template + E + operator()(A a, A b, C c, C d, E e, F f) const + { return std::set_intersection(a, b, c, d, e, f);} + +}; + +// set_difference -------------------------------- + +struct set_difference { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<5, Args>::type + >::type type; + }; + + template + E + operator()(A a, A b, C c, C d, E e) const + { return std::set_difference(a, b, c, d, e);} + + template + E + operator()(A a, A b, C c, C d, E e, F f) const + { return std::set_difference(a, b, c, d, e, f);} + +}; + + +// set_symmetric_difference -------------------------------- + +struct set_symmetric_difference { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<5, Args>::type + >::type type; + }; + + template + E + operator()(A a, A b, C c, C d, E e) const + { return std::set_symmetric_difference(a, b, c, d, e);} + + template + E + operator()(A a, A b, C c, C d, E e, F f) const + { return std::set_symmetric_difference(a, b, c, d, e, f);} + +}; + +// push_heap --------------------------------- + +struct push_heap { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::push_heap(a, b); } + + template + void + operator()(A a, A b, C c) const + { ::std::push_heap(a, b, c); } + +}; + +// pop_heap --------------------------------- + +struct pop_heap { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::pop_heap(a, b); } + + template + void + operator()(A a, A b, C c) const + { ::std::pop_heap(a, b, c); } + +}; + + +// make_heap --------------------------------- + +struct make_heap { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::make_heap(a, b); } + + template + void + operator()(A a, A b, C c) const + { ::std::make_heap(a, b, c); } + +}; + +// sort_heap --------------------------------- + +struct sort_heap { + + template + struct sig { + typedef void type; + }; + + template + void + operator()(A a, A b) const + { ::std::sort_heap(a, b); } + + template + void + operator()(A a, A b, C c) const + { ::std::sort_heap(a, b, c); } + +}; + +// min --------------------------------- + +struct min { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(const A& a, const A& b) const + { return (::std::min)(a, b); } + + template + A + operator()(const A& a, const A& b, C c) const + { return (::std::min)(a, b, c); } + +}; + +// max --------------------------------- + +struct max { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(const A& a, const A& b) const + { return (::std::max)(a, b); } + + template + A + operator()(const A& a, const A& b, C c) const + { return (::std::max)(a, b, c); } + +}; + +struct min_element { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b) const + { return ::std::min_element(a, b); } + + template + A + operator()(A a, A b, C c) const + { return ::std::min_element(a, b, c); } + +}; + +// max_element --------------------------------- + +struct max_element { + + template + struct sig { + typedef typename boost::remove_const< + typename boost::tuples::element<1, Args>::type + >::type type; + }; + + template + A + operator()(A a, A b) const + { return ::std::max_element(a, b); } + + template + A + operator()(A a, A b, C c) const + { return ::std::max_element(a, b, c); } + +}; + + +// lexicographical_compare --------------------------------- + +struct lexicographical_compare { + + template + struct sig { + typedef bool type; + }; + + template + bool + operator()(A a, A b, C c, C d) const + { return ::std::lexicographical_compare(a, b, c, d); } + + template + bool + operator()(A a, A b, C c, C d, E e) const + { return ::std::lexicographical_compare(a, b, c, d, e); } + +}; + +// next_permutation --------------------------------- + +struct next_permutation { + + template + struct sig { + typedef bool type; + }; + + template + bool + operator()(A a, A b) const + { return ::std::next_permutation(a, b); } + + template + bool + operator()(A a, A b, C c) const + { return ::std::next_permutation(a, b, c); } + +}; + +// prev_permutation --------------------------------- + +struct prev_permutation { + + template + struct sig { + typedef bool type; + }; + + template + bool + operator()(A a, A b) const + { return ::std::prev_permutation(a, b); } + + template + bool + operator()(A a, A b, C c) const + { return ::std::prev_permutation(a, b, c); } + +}; + + + + + +} // end of ll namespace + +// There is no good way to call an overloaded member function in a +// lambda expression. +// The macro below defines a function object class for calling a +// const_iterator returning member function of a container. + +#define CALL_MEMBER(X) \ +struct call_##X { \ +template \ + struct sig { \ + typedef typename boost::remove_const< \ + typename boost::tuples::element<1, Args>::type \ + >::type::const_iterator type; \ + }; \ + \ + template \ + typename T::const_iterator \ + operator()(const T& t) const \ + { \ + return t.X(); \ + } \ +}; + +// create call_begin and call_end classes +CALL_MEMBER(begin) +CALL_MEMBER(end) + +#undef CALL_MEMBER + +} // end of lambda namespace +} // end of boost namespace + + + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/lambda/bind.hpp b/deal.II/contrib/boost/include/boost-1.37.0/lambda/bind.hpp new file mode 100644 index 0000000000..0371393cba --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/lambda/bind.hpp @@ -0,0 +1,19 @@ +// -- bind.hpp -- Boost Lambda Library -------------------------------------- + +// Copyright (C) 1999-2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// Gary Powell (gwpowell@hotmail.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) +// +// For more information, see http://www.boost.org + +#ifndef BOOST_LAMBDA_BIND_HPP +#define BOOST_LAMBDA_BIND_HPP + +#include "boost/lambda/core.hpp" + +#include "boost/lambda/detail/bind_functions.hpp" + +#endif diff --git a/deal.II/contrib/boost/include/boost-1.37.0/lambda/casts.hpp b/deal.II/contrib/boost/include/boost-1.37.0/lambda/casts.hpp new file mode 100644 index 0000000000..a5f68561c5 --- /dev/null +++ b/deal.II/contrib/boost/include/boost-1.37.0/lambda/casts.hpp @@ -0,0 +1,219 @@ +// - casts.hpp -- BLambda Library ------------- +// +// Copyright (C) 2000 Gary Powell (powellg@amazon.com) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org + +// ----------------------------------------------- + +#if !defined(BOOST_LAMBDA_CASTS_HPP) +#define BOOST_LAMBDA_CASTS_HPP + +#include + +namespace boost { +namespace lambda { + +template class cast_action; + +template class static_cast_action; +template class dynamic_cast_action; +template class const_cast_action; +template class reinterpret_cast_action; + +class typeid_action; +class sizeof_action; + +// Cast actions + +template class cast_action > +{ +public: + template + static RET apply(Arg1 &a1) { + return static_cast(a1); + } +}; + +template class cast_action > { +public: + template + static RET apply(Arg1 &a1) { + return dynamic_cast(a1); + } +}; + +template class cast_action > { +public: + template + static RET apply(Arg1 &a1) { + return const_cast(a1); + } +}; + +template class cast_action > { +public: + template + static RET apply(Arg1 &a1) { + return reinterpret_cast(a1); + } +}; + + // typedid action +class typeid_action { +public: + template + static RET apply(Arg1 &a1) { + return typeid(a1); + } +}; + +// sizeof action +class sizeof_action +{ +public: + template + static RET apply(Arg1 &a1) { + return sizeof(a1); + } +}; + + +// return types of casting lambda_functors (all "T" type.) + +template